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 itemRef 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("itemRef.add must reflect correctly."); | |
14 element.itemRef.add('foo'); | |
15 element.itemRef.add('FOO'); | |
16 shouldBeTrue("element.itemRef.length == 2"); | |
17 shouldBe("element.itemRef.toString()", "'foo FOO'"); | |
18 shouldBe("element.itemRef[0]", "'foo'"); | |
19 shouldBe("element.itemRef[1]", "'FOO'"); | |
20 | |
21 debug("<br>itemRef.add must not make any changes if an existing token is added."
); | |
22 element.itemRef.add('foo'); | |
23 shouldBeTrue("element.itemRef.length == 2"); | |
24 shouldBe("element.itemRef.toString()", "'foo FOO'"); | |
25 | |
26 debug("<br>itemRef.remove must reflect correctly."); | |
27 element.itemRef.remove('foo'); | |
28 shouldBeTrue("element.itemRef.length == 1"); | |
29 shouldBe("element.itemRef.toString()", "'FOO'"); | |
30 shouldBeFalse("element.itemRef.contains('foo')"); | |
31 | |
32 debug("<br>itemRef.remove must not make any changes if a non-existing token is r
emoved."); | |
33 element.itemRef.remove('foo'); | |
34 shouldBeTrue("element.itemRef.length == 1"); | |
35 shouldBe("element.itemRef.toString()", "'FOO'"); | |
36 shouldBeFalse("element.itemRef.contains('foo')"); | |
37 | |
38 debug("<br>itemRef.length must be 0 when all tokens are removed."); | |
39 element.itemRef.remove('FOO'); | |
40 shouldBeTrue("element.itemRef.length == 0"); | |
41 shouldBeFalse("element.itemRef.contains('foo')"); | |
42 shouldBeFalse("element.itemRef.contains('FOO')"); | |
43 | |
44 </script> | |
45 <script src="../../js/resources/js-test-post.js"></script> | |
46 </body> | |
47 </html> | |
OLD | NEW |