Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Side by Side Diff: LayoutTests/fast/dom/MicroData/propertynodelist-test-add-remove-element.html

Issue 14028014: Remove MicroData implementation (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Also delete all the tests Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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>Microdata properties collection must update on adding or removing property.</ p>
9 <div itemprop="foo" id="test">
10 </div>
11 <div itemscope id="microdata-item">
12 <p itemprop="foo"></p>
13 </div>
14 <div id="console"></div>
15 <script>
16 var item = document.getElementById('microdata-item');
17 var propertyNodeList = item.properties.namedItem('foo');
18 var testElement = document.getElementById('test');
19
20 shouldBeTrue("propertyNodeList.length == '1'");
21 shouldBeTrue("propertyNodeList[0] == item.children[0]");
22
23 debug('Add a property to the item.');
24 item.appendChild(createElement('div', {itemprop: 'foo'}));
25 shouldBeTrue("propertyNodeList.length == 2");
26 shouldBeTrue("propertyNodeList[0] == item.children[0]");
27 shouldBeTrue("propertyNodeList[1] == item.children[1]");
28
29 debug('Remove itemprop attribute of the first child.');
30 item.children[0].removeAttribute('itemprop');
31 shouldBeTrue("propertyNodeList.length == 1");
32 shouldBeTrue("propertyNodeList[0] == item.children[1]");
33
34 debug('Add itemprop attribute to the first child.');
35 item.children[0].setAttribute('itemprop', 'foo');
36 shouldBeTrue("propertyNodeList.length == 2");
37 shouldBeTrue("propertyNodeList[0] == item.children[0]");
38 shouldBeTrue("propertyNodeList[1] == item.children[1]");
39
40 debug('Add itemref attribute.');
41 item.setAttribute('itemref', 'test');
42 shouldBeTrue("propertyNodeList.length == 3");
43 shouldBeTrue("propertyNodeList[0] == testElement");
44 shouldBeTrue("propertyNodeList[1] == item.children[0]");
45 shouldBeTrue("propertyNodeList[2] == item.children[1]");
46
47 debug('Remove itemref attribute.');
48 item.removeAttribute('itemref');
49 shouldBeTrue("propertyNodeList.length == 2");
50 shouldBeTrue("propertyNodeList[0] == item.children[0]");
51 shouldBeTrue("propertyNodeList[1] == item.children[1]");
52
53 debug('Add itemref attribute.');
54 item.setAttribute('itemref', 'test');
55 shouldBeTrue("propertyNodeList.length == 3");
56 shouldBeTrue("propertyNodeList[0] == testElement");
57 shouldBeTrue("propertyNodeList[1] == item.children[0]");
58 shouldBeTrue("propertyNodeList[2] == item.children[1]");
59 </script>
60 <script src="../../js/resources/js-test-post.js"></script>
61 </body>
62 </html>
63
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698