browser_boxmodel_update-after-reload.js (1439B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 // Test that the box model view continues to work after the page is reloaded 7 8 add_task(async function () { 9 const tab = await addTab(URL_ROOT + "doc_boxmodel_iframe1.html"); 10 const browser = tab.linkedBrowser; 11 const { inspector, boxmodel } = await openLayoutView(); 12 13 info("Test that the box model view works on the first page"); 14 await assertBoxModelView(inspector, boxmodel, browser); 15 16 info("Reload the page"); 17 const onMarkupLoaded = waitForMarkupLoaded(inspector); 18 await reloadBrowser(); 19 await onMarkupLoaded; 20 21 info("Test that the box model view works on the reloaded page"); 22 await assertBoxModelView(inspector, boxmodel, browser); 23 }); 24 25 async function assertBoxModelView(inspector, boxmodel, browser) { 26 await selectNode("p", inspector); 27 28 info("Checking that the box model view shows the right value"); 29 const paddingElt = boxmodel.document.querySelector( 30 ".boxmodel-padding.boxmodel-top > span" 31 ); 32 is(paddingElt.textContent, "50"); 33 34 info("Listening for box model view changes and modifying the padding"); 35 const onUpdated = waitForUpdate(inspector); 36 await setStyle(browser, "p", "padding", "20px"); 37 await onUpdated; 38 ok(true, "Box model view got updated"); 39 40 info("Checking that the box model view shows the right value after update"); 41 is(paddingElt.textContent, "20"); 42 }