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

Side by Side Diff: LayoutTests/inspector/elements/set-attribute.html

Issue 881263002: DevTools: use target-based model accessors only. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 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
1 <html> 1 <html>
2 <head> 2 <head>
3 <script src="../../http/tests/inspector/inspector-test.js"></script> 3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../http/tests/inspector/elements-test.js"></script> 4 <script src="../../http/tests/inspector/elements-test.js"></script>
5 <script> 5 <script>
6 6
7 function setAttribute(name, value) 7 function setAttribute(name, value)
8 { 8 {
9 var node = document.getElementById("node"); 9 var node = document.getElementById("node");
10 node.setAttribute(name, value); 10 node.setAttribute(name, value);
(...skipping 19 matching lines...) Expand all
30 InspectorTest.dumpElementsTree(targetNode); 30 InspectorTest.dumpElementsTree(targetNode);
31 next(); 31 next();
32 } 32 }
33 InspectorTest.selectNodeWithId("node", callback); 33 InspectorTest.selectNodeWithId("node", callback);
34 }, 34 },
35 35
36 function testAttributeUpdated(next) 36 function testAttributeUpdated(next)
37 { 37 {
38 function callback() 38 function callback()
39 { 39 {
40 WebInspector.domModel.removeEventListener(WebInspector.DOMModel. Events.AttrModified, callback); 40 InspectorTest.domModel.removeEventListener(WebInspector.DOMModel .Events.AttrModified, callback);
41 InspectorTest.addResult("===== On attribute set ====="); 41 InspectorTest.addResult("===== On attribute set =====");
42 InspectorTest.dumpElementsTree(targetNode); 42 InspectorTest.dumpElementsTree(targetNode);
43 next(); 43 next();
44 } 44 }
45 WebInspector.domModel.addEventListener(WebInspector.DOMModel.Events. AttrModified, callback); 45 InspectorTest.domModel.addEventListener(WebInspector.DOMModel.Events .AttrModified, callback);
46 InspectorTest.evaluateInPage("setAttribute('name', 'value')"); 46 InspectorTest.evaluateInPage("setAttribute('name', 'value')");
47 }, 47 },
48 48
49 function testAttributeSameValueNotUpdated(next) 49 function testAttributeSameValueNotUpdated(next)
50 { 50 {
51 function callback() 51 function callback()
52 { 52 {
53 InspectorTest.addResult("===== On attribute modified (should be 'newValue') ====="); 53 InspectorTest.addResult("===== On attribute modified (should be 'newValue') =====");
54 InspectorTest.dumpElementsTree(targetNode); 54 InspectorTest.dumpElementsTree(targetNode);
55 WebInspector.domModel.removeEventListener(WebInspector.DOMModel. Events.AttrModified, callback); 55 InspectorTest.domModel.removeEventListener(WebInspector.DOMModel .Events.AttrModified, callback);
56 next(); 56 next();
57 } 57 }
58 WebInspector.domModel.addEventListener(WebInspector.DOMModel.Events. AttrModified, callback); 58 InspectorTest.domModel.addEventListener(WebInspector.DOMModel.Events .AttrModified, callback);
59 // Setting the same property value should not result in the AttrModi fied event. 59 // Setting the same property value should not result in the AttrModi fied event.
60 InspectorTest.evaluateInPage("setAttribute('name', 'value')"); 60 InspectorTest.evaluateInPage("setAttribute('name', 'value')");
61 InspectorTest.evaluateInPage("setAttribute('name', 'value')"); 61 InspectorTest.evaluateInPage("setAttribute('name', 'value')");
62 InspectorTest.evaluateInPage("setAttribute('name', 'newValue')"); 62 InspectorTest.evaluateInPage("setAttribute('name', 'newValue')");
63 }, 63 },
64 64
65 function testAttributeRemoved(next) 65 function testAttributeRemoved(next)
66 { 66 {
67 function callback() 67 function callback()
68 { 68 {
69 WebInspector.domModel.removeEventListener(WebInspector.DOMModel. Events.AttrRemoved, callback); 69 InspectorTest.domModel.removeEventListener(WebInspector.DOMModel .Events.AttrRemoved, callback);
70 InspectorTest.addResult("=== On attribute removed ==="); 70 InspectorTest.addResult("=== On attribute removed ===");
71 InspectorTest.dumpElementsTree(targetNode); 71 InspectorTest.dumpElementsTree(targetNode);
72 next(); 72 next();
73 } 73 }
74 WebInspector.domModel.addEventListener(WebInspector.DOMModel.Events. AttrRemoved, callback); 74 InspectorTest.domModel.addEventListener(WebInspector.DOMModel.Events .AttrRemoved, callback);
75 InspectorTest.evaluateInPage("removeAttribute('name')"); 75 InspectorTest.evaluateInPage("removeAttribute('name')");
76 }, 76 },
77 77
78 function testSetAttributeValue(next) 78 function testSetAttributeValue(next)
79 { 79 {
80 function callback() 80 function callback()
81 { 81 {
82 WebInspector.domModel.removeEventListener(WebInspector.DOMModel. Events.AttrModified, callback); 82 InspectorTest.domModel.removeEventListener(WebInspector.DOMModel .Events.AttrModified, callback);
83 InspectorTest.addResult("=== Set attribute value ==="); 83 InspectorTest.addResult("=== Set attribute value ===");
84 InspectorTest.dumpElementsTree(targetNode); 84 InspectorTest.dumpElementsTree(targetNode);
85 next(); 85 next();
86 } 86 }
87 WebInspector.domModel.addEventListener(WebInspector.DOMModel.Events. AttrModified, callback); 87 InspectorTest.domModel.addEventListener(WebInspector.DOMModel.Events .AttrModified, callback);
88 targetNode.setAttributeValue("foo", "bar"); 88 targetNode.setAttributeValue("foo", "bar");
89 }, 89 },
90 90
91 function testSetAttributeText(next) 91 function testSetAttributeText(next)
92 { 92 {
93 function callback() 93 function callback()
94 { 94 {
95 WebInspector.domModel.removeEventListener(WebInspector.DOMModel. Events.AttrRemoved, callback); 95 InspectorTest.domModel.removeEventListener(WebInspector.DOMModel .Events.AttrRemoved, callback);
96 InspectorTest.addResult("=== Set attribute as text ==="); 96 InspectorTest.addResult("=== Set attribute as text ===");
97 InspectorTest.dumpElementsTree(targetNode); 97 InspectorTest.dumpElementsTree(targetNode);
98 next(); 98 next();
99 } 99 }
100 WebInspector.domModel.addEventListener(WebInspector.DOMModel.Events. AttrRemoved, callback); 100 InspectorTest.domModel.addEventListener(WebInspector.DOMModel.Events .AttrRemoved, callback);
101 targetNode.setAttribute("foo", "foo2='baz2' foo3='baz3'"); 101 targetNode.setAttribute("foo", "foo2='baz2' foo3='baz3'");
102 }, 102 },
103 103
104 function testRemoveAttributeAsText(next) 104 function testRemoveAttributeAsText(next)
105 { 105 {
106 function callback() 106 function callback()
107 { 107 {
108 WebInspector.domModel.removeEventListener(WebInspector.DOMModel. Events.AttrRemoved, callback); 108 InspectorTest.domModel.removeEventListener(WebInspector.DOMModel .Events.AttrRemoved, callback);
109 InspectorTest.addResult("=== Remove attribute as text ==="); 109 InspectorTest.addResult("=== Remove attribute as text ===");
110 InspectorTest.dumpElementsTree(targetNode); 110 InspectorTest.dumpElementsTree(targetNode);
111 next(); 111 next();
112 } 112 }
113 WebInspector.domModel.addEventListener(WebInspector.DOMModel.Events. AttrRemoved, callback); 113 InspectorTest.domModel.addEventListener(WebInspector.DOMModel.Events .AttrRemoved, callback);
114 targetNode.setAttribute("foo3", ""); 114 targetNode.setAttribute("foo3", "");
115 }, 115 },
116 116
117 function testSetMalformedAttributeText(next) 117 function testSetMalformedAttributeText(next)
118 { 118 {
119 function callback(error) 119 function callback(error)
120 { 120 {
121 InspectorTest.addResult("Error: " + error); 121 InspectorTest.addResult("Error: " + error);
122 WebInspector.domModel.removeEventListener(WebInspector.DOMModel. Events.AttrModified, callback); 122 InspectorTest.domModel.removeEventListener(WebInspector.DOMModel .Events.AttrModified, callback);
123 InspectorTest.addResult("=== Set malformed attribute as text === "); 123 InspectorTest.addResult("=== Set malformed attribute as text === ");
124 InspectorTest.dumpElementsTree(targetNode); 124 InspectorTest.dumpElementsTree(targetNode);
125 next(); 125 next();
126 } 126 }
127 targetNode.setAttribute("foo2", "foo2='missingquote", callback); 127 targetNode.setAttribute("foo2", "foo2='missingquote", callback);
128 } 128 }
129 ]); 129 ]);
130 } 130 }
131 131
132 </script> 132 </script>
133 </head> 133 </head>
134 134
135 <body onload="runTest()"> 135 <body onload="runTest()">
136 <p> 136 <p>
137 Tests that elements panel updates dom tree structure upon setting attribute. 137 Tests that elements panel updates dom tree structure upon setting attribute.
138 </p> 138 </p>
139 139
140 <div id="node"></div> 140 <div id="node"></div>
141 141
142 </body> 142 </body>
143 </html> 143 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698