summaryrefslogtreecommitdiffstats
path: root/devtools/client/inspector/boxmodel/test/browser_boxmodel_update-after-reload.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--devtools/client/inspector/boxmodel/test/browser_boxmodel_update-after-reload.js42
1 files changed, 42 insertions, 0 deletions
diff --git a/devtools/client/inspector/boxmodel/test/browser_boxmodel_update-after-reload.js b/devtools/client/inspector/boxmodel/test/browser_boxmodel_update-after-reload.js
new file mode 100644
index 0000000000..f6d309c8e2
--- /dev/null
+++ b/devtools/client/inspector/boxmodel/test/browser_boxmodel_update-after-reload.js
@@ -0,0 +1,42 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+// Test that the box model view continues to work after the page is reloaded
+
+add_task(async function () {
+ const tab = await addTab(URL_ROOT + "doc_boxmodel_iframe1.html");
+ const browser = tab.linkedBrowser;
+ const { inspector, boxmodel } = await openLayoutView();
+
+ info("Test that the box model view works on the first page");
+ await assertBoxModelView(inspector, boxmodel, browser);
+
+ info("Reload the page");
+ const onMarkupLoaded = waitForMarkupLoaded(inspector);
+ await reloadBrowser();
+ await onMarkupLoaded;
+
+ info("Test that the box model view works on the reloaded page");
+ await assertBoxModelView(inspector, boxmodel, browser);
+});
+
+async function assertBoxModelView(inspector, boxmodel, browser) {
+ await selectNode("p", inspector);
+
+ info("Checking that the box model view shows the right value");
+ const paddingElt = boxmodel.document.querySelector(
+ ".boxmodel-padding.boxmodel-top > span"
+ );
+ is(paddingElt.textContent, "50");
+
+ info("Listening for box model view changes and modifying the padding");
+ const onUpdated = waitForUpdate(inspector);
+ await setStyle(browser, "p", "padding", "20px");
+ await onUpdated;
+ ok(true, "Box model view got updated");
+
+ info("Checking that the box model view shows the right value after update");
+ is(paddingElt.textContent, "20");
+}