diff --git a/devtools/client/inspector/layout/test/browser.ini b/devtools/client/inspector/layout/test/browser.ini index ccebf7f30f5a..9075b50c88ce 100644 --- a/devtools/client/inspector/layout/test/browser.ini +++ b/devtools/client/inspector/layout/test/browser.ini @@ -22,7 +22,8 @@ support-files = [browser_layout_rotate-labels-on-sides.js] [browser_layout_sync.js] [browser_layout_tooltips.js] -[browser_layout_update-after-navigation.js] +[browser_layout_update-after-navigation_01.js] +[browser_layout_update-after-navigation_02.js] [browser_layout_update-after-reload.js] # [browser_layout_update-in-iframes.js] # Bug 1020038 layout-view updates for iframe elements changes diff --git a/devtools/client/inspector/layout/test/browser_layout_update-after-navigation_01.js b/devtools/client/inspector/layout/test/browser_layout_update-after-navigation_01.js new file mode 100644 index 000000000000..27d61aebe105 --- /dev/null +++ b/devtools/client/inspector/layout/test/browser_layout_update-after-navigation_01.js @@ -0,0 +1,63 @@ +/* vim: set ts=2 et sw=2 tw=80: */ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// Test that the layout-view continues to work after a page navigation + +const IFRAME1 = URL_ROOT + "doc_layout_iframe1.html"; +const IFRAME2 = URL_ROOT + "doc_layout_iframe2.html"; + +add_task(function* () { + yield addTab(IFRAME1); + let {inspector, view, testActor} = yield openLayoutView(); + + yield testFirstPage(inspector, view, testActor); + + info("Navigate to the second page"); + yield testActor.eval(`content.location.href="${IFRAME2}"`); + yield inspector.once("markuploaded"); + + yield testSecondPage(inspector, view, testActor); +}); + +function* testFirstPage(inspector, view, testActor) { + info("Test that the layout-view works on the first page"); + + info("Selecting the test node"); + yield selectNode("p", inspector); + + info("Checking that the layout-view shows the right value"); + let paddingElt = view.doc.querySelector(".layout-padding.layout-top > span"); + is(paddingElt.textContent, "50"); + + info("Listening for layout-view changes and modifying the padding"); + let onUpdated = waitForUpdate(inspector); + yield setStyle(testActor, "p", "padding", "20px"); + yield onUpdated; + ok(true, "Layout-view got updated"); + + info("Checking that the layout-view shows the right value after update"); + is(paddingElt.textContent, "20"); +} + +function* testSecondPage(inspector, view, testActor) { + info("Test that the layout-view works on the second page"); + + info("Selecting the test node"); + yield selectNode("p", inspector); + + info("Checking that the layout-view shows the right value"); + let sizeElt = view.doc.querySelector(".layout-size > span"); + is(sizeElt.textContent, "100" + "\u00D7" + "100"); + + info("Listening for layout-view changes and modifying the size"); + let onUpdated = waitForUpdate(inspector); + yield setStyle(testActor, "p", "width", "200px"); + yield onUpdated; + ok(true, "Layout-view got updated"); + + info("Checking that the layout-view shows the right value after update"); + is(sizeElt.textContent, "200" + "\u00D7" + "100"); +} diff --git a/devtools/client/inspector/layout/test/browser_layout_update-after-navigation.js b/devtools/client/inspector/layout/test/browser_layout_update-after-navigation_02.js similarity index 73% rename from devtools/client/inspector/layout/test/browser_layout_update-after-navigation.js rename to devtools/client/inspector/layout/test/browser_layout_update-after-navigation_02.js index 3d082cddab23..1d04ae7163b8 100644 --- a/devtools/client/inspector/layout/test/browser_layout_update-after-navigation.js +++ b/devtools/client/inspector/layout/test/browser_layout_update-after-navigation_02.js @@ -4,8 +4,8 @@ "use strict"; -// Test that the layout-view continues to work after a page navigation and that -// it also works after going back +// Test that the layout-view continues to work after a page navigation and +// going back const IFRAME1 = URL_ROOT + "doc_layout_iframe1.html"; const IFRAME2 = URL_ROOT + "doc_layout_iframe2.html"; @@ -20,8 +20,6 @@ add_task(function* () { yield testActor.eval(`content.location.href="${IFRAME2}"`); yield inspector.once("markuploaded"); - yield testSecondPage(inspector, view, testActor); - info("Go back to the first page"); yield testActor.eval("content.history.back();"); yield inspector.once("markuploaded"); @@ -49,26 +47,6 @@ function* testFirstPage(inspector, view, testActor) { is(paddingElt.textContent, "20"); } -function* testSecondPage(inspector, view, testActor) { - info("Test that the layout-view works on the second page"); - - info("Selecting the test node"); - yield selectNode("p", inspector); - - info("Checking that the layout-view shows the right value"); - let sizeElt = view.doc.querySelector(".layout-size > span"); - is(sizeElt.textContent, "100" + "\u00D7" + "100"); - - info("Listening for layout-view changes and modifying the size"); - let onUpdated = waitForUpdate(inspector); - yield setStyle(testActor, "p", "width", "200px"); - yield onUpdated; - ok(true, "Layout-view got updated"); - - info("Checking that the layout-view shows the right value after update"); - is(sizeElt.textContent, "200" + "\u00D7" + "100"); -} - function* testBackToFirstPage(inspector, view, testActor) { info("Test that the layout-view works on the first page after going back");