| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <script src="../../js/resources/js-test-pre.js"></script> | |
| 5 <script src="resources/microdata-common.js"></script> | |
| 6 </head> | |
| 7 <body> | |
| 8 <p>This tests that itemType attribute must update correctly when token have been
added or removed.</p> | |
| 9 <div id="console"></div> | |
| 10 <script> | |
| 11 var element = createElement('div', {}); | |
| 12 | |
| 13 debug("itemType.add must reflect correctly."); | |
| 14 element.itemType.add('http://example.com/foo'); | |
| 15 element.itemType.add('http://example.com/FOO'); | |
| 16 | |
| 17 shouldBeTrue("element.itemType.length == 2"); | |
| 18 shouldBeTrue("element.itemType.toString() == 'http://example.com/foo http://exam
ple.com/FOO'"); | |
| 19 shouldBe("element.itemType[0]", "'http://example.com/foo'"); | |
| 20 shouldBe("element.itemType[1]", "'http://example.com/FOO'"); | |
| 21 shouldBe("element.itemType.item(0)", "'http://example.com/foo'"); | |
| 22 shouldBe("element.itemType.item(1)", "'http://example.com/FOO'"); | |
| 23 | |
| 24 debug("<br>itemType.add must not make any changes if an existing token is added.
"); | |
| 25 element.itemType.add('http://example.com/foo'); | |
| 26 shouldBeTrue("element.itemType.length == 2"); | |
| 27 shouldBeTrue("element.itemType.toString() == 'http://example.com/foo http://exam
ple.com/FOO'"); | |
| 28 | |
| 29 debug("<br>itemType.remove must reflect correctly."); | |
| 30 element.itemType.remove('http://example.com/foo'); | |
| 31 shouldBeTrue("element.itemType.length == 1"); | |
| 32 shouldBeFalse("element.itemType.contains('http://example.com/foo')") | |
| 33 shouldBeTrue("element.itemType.toString() == 'http://example.com/FOO'"); | |
| 34 | |
| 35 debug("<br>itemType.remove must not make any changes if remove is called for a t
oken that doesn't exist."); | |
| 36 element.itemType.remove('http://example.com/foo'); | |
| 37 shouldBeTrue("element.itemType.length == 1"); | |
| 38 shouldBeFalse("element.itemType.contains('http://example.com/foo')"); | |
| 39 shouldBeTrue("element.itemType.toString() == 'http://example.com/FOO'"); | |
| 40 | |
| 41 debug("<br>itemType.length must be 0 when all tokens are removed."); | |
| 42 element.itemType.remove('http://example.com/FOO'); | |
| 43 shouldBeTrue("element.itemType.length == 0"); | |
| 44 shouldBeFalse("element.itemType.contains('http://example.com/foo')"); | |
| 45 shouldBeFalse("element.itemType.contains('http://example.com/FOO')"); | |
| 46 | |
| 47 </script> | |
| 48 <script src="../../js/resources/js-test-post.js"></script> | |
| 49 </body> | |
| 50 </html> | |
| OLD | NEW |