diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /devtools/client/inspector/compatibility/test/browser/browser_compatibility_event_document-reload.js | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/client/inspector/compatibility/test/browser/browser_compatibility_event_document-reload.js')
-rw-r--r-- | devtools/client/inspector/compatibility/test/browser/browser_compatibility_event_document-reload.js | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/devtools/client/inspector/compatibility/test/browser/browser_compatibility_event_document-reload.js b/devtools/client/inspector/compatibility/test/browser/browser_compatibility_event_document-reload.js new file mode 100644 index 0000000000..a7f18e0811 --- /dev/null +++ b/devtools/client/inspector/compatibility/test/browser/browser_compatibility_event_document-reload.js @@ -0,0 +1,95 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// Test the issues after reloading the browsing document. + +const TEST_URI = ` + <style> + body { + color: blue; + ruby-align: center; + user-modify: read-only; + } + div { + scrollbar-width: thin; + } + </style> + <body> + <div>test</div> + </body> +`; + +const TEST_DATA_SELECTED = [ + { + property: "ruby-align", + url: "https://developer.mozilla.org/docs/Web/CSS/ruby-align", + }, + { + property: "user-modify", + url: "https://developer.mozilla.org/docs/Web/CSS/user-modify", + }, +]; + +const TEST_DATA_ALL = [ + ...TEST_DATA_SELECTED, + { + property: "scrollbar-width", + url: "https://developer.mozilla.org/docs/Web/CSS/scrollbar-width", + }, +]; + +const { + COMPATIBILITY_UPDATE_SELECTED_NODE_FAILURE, + COMPATIBILITY_UPDATE_TOP_LEVEL_TARGET_FAILURE, +} = require("resource://devtools/client/inspector/compatibility/actions/index.js"); + +add_task(async function () { + const tab = await addTab( + "data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI) + ); + + const { allElementsPane, inspector, selectedElementPane } = + await openCompatibilityView(); + + info("Check the issues on the selected element"); + await assertIssueList(selectedElementPane, TEST_DATA_SELECTED); + info("Check the issues on all elements"); + await assertIssueList(allElementsPane, TEST_DATA_ALL); + + let isUpdateSelectedNodeFailure = false; + let isUpdateTopLevelTargetFailure = false; + waitForDispatch( + inspector.store, + COMPATIBILITY_UPDATE_SELECTED_NODE_FAILURE + ).then(() => { + isUpdateSelectedNodeFailure = true; + }); + waitForDispatch( + inspector.store, + COMPATIBILITY_UPDATE_TOP_LEVEL_TARGET_FAILURE + ).then(() => { + isUpdateTopLevelTargetFailure = true; + }); + + info("Reload the browsing page"); + const onReloaded = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser); + const onUpdateSelectedNode = waitForUpdateSelectedNodeAction(inspector.store); + const onUpdateTopLevelTarget = waitForUpdateTopLevelTargetAction( + inspector.store + ); + gBrowser.reloadTab(tab); + await Promise.all([onReloaded, onUpdateSelectedNode, onUpdateTopLevelTarget]); + + info("Check whether the failure action will be fired or not"); + ok( + !isUpdateSelectedNodeFailure && !isUpdateTopLevelTargetFailure, + "No error occurred" + ); + + info("Check the issues on the selected element again"); + await assertIssueList(selectedElementPane, TEST_DATA_SELECTED); + info("Check the issues on all elements again"); + await assertIssueList(allElementsPane, TEST_DATA_ALL); +}); |