OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <script src="../../resources/js-test.js"></script> |
| 5 </head> |
| 6 <body> |
| 7 <script> |
| 8 description('Unittests for private scripts.'); |
| 9 if (internals) |
| 10 debug('This test needs window.internals.'); |
| 11 |
| 12 internals.doNothing(); |
| 13 shouldBe('internals.return123()', '123'); |
| 14 shouldBe('internals.echoInteger(111)', '111'); |
| 15 shouldBeEqualToString('internals.echoString("foo")', 'foo') |
| 16 shouldBe('internals.addInteger(111, 222)', '333'); |
| 17 shouldBeEqualToString('internals.addString("foo", "bar")', 'foobar') |
| 18 |
| 19 shouldBe('internals.getIntegerFromPrototype()', '0'); |
| 20 internals.setIntegerToPrototype(123); |
| 21 shouldBe('internals.getIntegerFromPrototype()', '123'); |
| 22 |
| 23 shouldBe('internals.getIntegerFromDocument(document)', '0'); |
| 24 internals.setIntegerToDocument(document, 123); |
| 25 shouldBe('internals.getIntegerFromDocument(document)', '123'); |
| 26 |
| 27 var node1 = internals.createElement(document); |
| 28 var node2 = internals.createElement(document); |
| 29 var node3 = internals.createElement(document); |
| 30 var node4 = internals.createElement(document); |
| 31 internals.appendChild(node1, node2); |
| 32 internals.appendChild(node1, node3); |
| 33 internals.appendChild(node1, node4); |
| 34 shouldBe('internals.firstChild(node1)', 'node2'); |
| 35 shouldBe('internals.nextSibling(node2)', 'node3'); |
| 36 shouldBe('internals.nextSibling(node3)', 'node4'); |
| 37 shouldBe('internals.nextSibling(node4)', 'null'); |
| 38 |
| 39 var node5 = internals.createElement(document); |
| 40 shouldBeEqualToString('internals.innerHTML(node5)', '') |
| 41 internals.setInnerHTML(node5, '<div>foo</div>'); |
| 42 shouldBeEqualToString('internals.innerHTML(node5)', '<div>foo</div>') |
| 43 var node6 = internals.firstChild(node5); |
| 44 shouldBeEqualToString('internals.innerHTML(node6)', 'foo'); |
| 45 |
| 46 var node7 = internals.createElement(document); |
| 47 shouldBeEqualToString('internals.innerHTML(node7)', '') |
| 48 internals.addClickListener(node7); |
| 49 internals.clickNode(document, node7); |
| 50 shouldBeEqualToString('internals.innerHTML(node7)', 'clicked') |
| 51 |
| 52 </script> |
| 53 </body> |
| 54 </html> |
OLD | NEW |