| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> | |
| 4 <script src="../../../http/tests/inspector/elements-test.js"></script> | |
| 5 <style> | |
| 6 #inspected { | |
| 7 color: red; | |
| 8 } | |
| 9 </style> | |
| 10 <script> | |
| 11 function test() { | |
| 12 InspectorTest.runTestSuite([ | |
| 13 function selectNode(next) | |
| 14 { | |
| 15 InspectorTest.selectNodeAndWaitForStylesWithComputed("inspected", ne
xt); | |
| 16 }, | |
| 17 | |
| 18 function testColorSwatchInMatchRules(next) | |
| 19 { | |
| 20 var treeItem = InspectorTest.getMatchedStylePropertyTreeItem("color"
); | |
| 21 InspectorTest.addResult("Initial color value: " + treeItem.valueElem
ent.textContent); | |
| 22 var swatch = treeItem.valueElement.querySelector("span[is=color-swat
ch]").shadowRoot.querySelector(".color-swatch-inner"); | |
| 23 swatch.dispatchEvent(createShiftClick()); | |
| 24 InspectorTest.addResult("After shift-click: " + treeItem.valueElemen
t.textContent); | |
| 25 InspectorTest.addResult("Has popover before click: " + !!document.qu
erySelector("body > .popover-container")); | |
| 26 | |
| 27 swatch.click(); | |
| 28 InspectorTest.addResult("Has popover after click: " + !!document.que
rySelector("body > .popover-container")); | |
| 29 next(); | |
| 30 }, | |
| 31 | |
| 32 function testColorSwatchInComputedRules(next) | |
| 33 { | |
| 34 var computedProperty = InspectorTest.findComputedPropertyWithName("c
olor"); | |
| 35 var computedPropertyValue = computedProperty.querySelector(".value")
; | |
| 36 InspectorTest.addResult("Initial color value: " + computedPropertyVa
lue.textContent); | |
| 37 var swatch = computedPropertyValue.querySelector("span[is=color-swat
ch]").shadowRoot.querySelector(".color-swatch-inner"); | |
| 38 swatch.dispatchEvent(createShiftClick()); | |
| 39 InspectorTest.addResult("After shift-click color value: " + computed
PropertyValue.textContent); | |
| 40 next(); | |
| 41 } | |
| 42 ]); | |
| 43 | |
| 44 function createShiftClick() | |
| 45 { | |
| 46 var event = document.createEvent("MouseEvent"); | |
| 47 event.initMouseEvent("click", true, true, null, 1, 0, 0, 0, 0, false, fa
lse, true, false, 0, null); | |
| 48 return event; | |
| 49 } | |
| 50 } | |
| 51 </script> | |
| 52 </head> | |
| 53 | |
| 54 <body onload="runTest()"> | |
| 55 <p>The patch verifies that color swatch functions properly in matched and comput
ed styles. crbug.com/461363</p> | |
| 56 | |
| 57 <div id="inspected">Inspected div</div> | |
| 58 | |
| 59 </body> | |
| 60 </html> | |
| OLD | NEW |