| <html> |
| <head> |
| <script src="../../../http/tests/inspector/inspector-test.js"></script> |
| <script src="../../../http/tests/inspector/elements-test.js"></script> |
| <script> |
| |
| function testSetNewValue() |
| { |
| document.getElementById("node-set-new-value").style.setProperty("color", "blue"); |
| } |
| |
| function testSetSameValue() |
| { |
| document.getElementById("node-set-same-value").style.setProperty("color", "red"); |
| } |
| |
| function test() |
| { |
| // Save time on style updates. |
| Elements.StylesSidebarPane.prototype.update = function() {}; |
| Elements.MetricsSidebarPane.prototype.update = function() {}; |
| |
| InspectorTest.runTestSuite([ |
| function testSetUp(next) |
| { |
| InspectorTest.expandElementsTree(next); |
| }, |
| |
| function testSetNewValue(next) |
| { |
| InspectorTest.evaluateInPage("testSetNewValue()"); |
| |
| InspectorTest.domModel.addEventListener(SDK.DOMModel.Events.AttrModified, listener); |
| function listener(event) |
| { |
| InspectorTest.addResult("SDK.DOMModel.Events.AttrModified should be issued"); |
| InspectorTest.domModel.removeEventListener(SDK.DOMModel.Events.AttrModified, listener); |
| next(); |
| } |
| }, |
| |
| function testSetSameValue(next) |
| { |
| InspectorTest.evaluateInPage("testSetSameValue()", next); |
| |
| InspectorTest.domModel.addEventListener(SDK.DOMModel.Events.AttrModified, listener); |
| function listener(event) |
| { |
| InspectorTest.addResult("SDK.DOMModel.Events.AttrModified should not be issued"); |
| InspectorTest.domModel.removeEventListener(SDK.DOMModel.Events.AttrModified, listener); |
| } |
| } |
| ]); |
| } |
| |
| </script> |
| </head> |
| |
| <body onload="runTest()"> |
| <p> |
| Tests that style modification generates attribute updated event only when attribute is actually changed. |
| </p> |
| |
| <div id="container"> |
| <div id="node-set-new-value" style="color:red"></div> |
| <div id="node-set-same-value" style="color:red"></div> |
| </div> |
| </body> |
| </html> |