browser_computed_select-and-copy-styles-02.js (1082B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 // Tests that properties can be selected and copied from the computed view. 7 8 const TEST_URI = `<div style="text-align:left;width:25px;">Hello world</div>`; 9 10 add_task(async function () { 11 await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI)); 12 const { inspector, view } = await openComputedView(); 13 await selectNode("div", inspector); 14 15 let expectedPattern = "text-align: left;[\\r\\n]+" + "width: 25px;[\\r\\n]*"; 16 await copyAllAndCheckClipboard(view, expectedPattern); 17 18 info("Testing expand then select all copy"); 19 20 expectedPattern = 21 "text-align: left;[\\r\\n]+" + 22 "Best Match element[\\r\\n]+" + 23 "left[\\r\\n]+" + 24 "width: 25px;[\\r\\n]+" + 25 "Best Match element[\\r\\n]+" + 26 "25px[\\r\\n]*"; 27 28 info("Expanding computed view properties"); 29 await expandComputedViewPropertyByIndex(view, 0); 30 await expandComputedViewPropertyByIndex(view, 1); 31 32 await copyAllAndCheckClipboard(view, expectedPattern); 33 });