OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../resources/js-test.js"></script> | 4 <script src="../../resources/js-test.js"></script> |
5 </head> | 5 </head> |
6 <body> | 6 <body> |
7 <script> | 7 <script> |
8 | 8 |
9 description('Tests the DOM bindings for the ping attribute'); | 9 description('Tests the DOM bindings for the ping attribute'); |
10 | 10 |
11 var anchor = document.createElement('a'); | 11 var anchor = document.createElement('a'); |
12 shouldBeEqualToString('anchor.ping', ''); | 12 shouldBe('anchor.ping', '[]'); |
13 anchor.setAttribute('ping', 'p1'); | 13 anchor.setAttribute('ping', 'p1'); |
14 shouldBeEqualToString('anchor.ping', 'p1'); | 14 shouldBe('anchor.ping', '["p1"]'); |
15 anchor.ping = 'p2'; | 15 anchor.ping = 'p2'; |
16 shouldBeEqualToString('anchor.getAttribute("ping")', 'p2'); | 16 shouldBeEqualToString('anchor.getAttribute("ping")', 'p2'); |
| 17 anchor.ping.add('p3'); |
| 18 shouldBe('anchor.ping', '["p2","p3"]'); |
| 19 shouldBeTrue('anchor.ping.contains("p3")'); |
| 20 anchor.ping.remove('p2'); |
| 21 shouldBe('anchor.ping', '["p3"]'); |
17 anchor.ping = null; | 22 anchor.ping = null; |
18 shouldBeEqualToString('anchor.getAttribute("ping")', 'null'); | 23 shouldBeEqualToString('anchor.getAttribute("ping")', 'null'); |
19 shouldBeEqualToString('anchor.ping', 'null'); | 24 shouldBe('anchor.ping', '["null"]'); |
20 | 25 |
21 var area = document.createElement('area'); | 26 var area = document.createElement('area'); |
22 shouldBeEqualToString('area.ping', ''); | 27 shouldBe('area.ping', '[]'); |
23 area.setAttribute('ping', 'p1'); | 28 area.setAttribute('ping', 'p1'); |
24 shouldBeEqualToString('area.ping', 'p1'); | 29 shouldBe('area.ping', '["p1"]'); |
25 area.ping = 'p2'; | 30 area.ping = 'p2'; |
26 shouldBeEqualToString('area.getAttribute("ping")', 'p2'); | 31 shouldBeEqualToString('area.getAttribute("ping")', 'p2'); |
| 32 area.ping.add('p3'); |
| 33 shouldBe('area.ping', '["p2","p3"]'); |
| 34 shouldBeTrue('area.ping.contains("p3")'); |
| 35 area.ping.remove('p2'); |
| 36 shouldBe('area.ping', '["p3"]'); |
27 area.ping = null; | 37 area.ping = null; |
28 shouldBeEqualToString('area.getAttribute("ping")', 'null'); | 38 shouldBeEqualToString('area.getAttribute("ping")', 'null'); |
29 shouldBeEqualToString('area.ping', 'null'); | 39 shouldBe('area.ping', '["null"]'); |
30 | 40 |
31 </script> | 41 </script> |
32 </body> | 42 </body> |
33 </html> | 43 </html> |
OLD | NEW |