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/styleeditor/test/browser_styleeditor_remove_stylesheet.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/styleeditor/test/browser_styleeditor_remove_stylesheet.js')
-rw-r--r-- | devtools/client/styleeditor/test/browser_styleeditor_remove_stylesheet.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/devtools/client/styleeditor/test/browser_styleeditor_remove_stylesheet.js b/devtools/client/styleeditor/test/browser_styleeditor_remove_stylesheet.js new file mode 100644 index 0000000000..69a23c0947 --- /dev/null +++ b/devtools/client/styleeditor/test/browser_styleeditor_remove_stylesheet.js @@ -0,0 +1,29 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + +// Test that a removed style sheet don't show up in the style editor anymore. + +const TESTCASE_URI = TEST_BASE_HTTPS + "simple.html"; + +add_task(async function () { + const { ui } = await openStyleEditorForURL(TESTCASE_URI); + + is(ui.editors.length, 2, "Two sheets present after load."); + + info("Removing the <style> node"); + const onStyleRemoved = waitFor(() => ui.editors.length == 1); + await SpecialPowers.spawn(gBrowser.selectedBrowser, [], () => { + content.document.querySelector("style").remove(); + }); + await onStyleRemoved; + is(ui.editors.length, 1, "There's only one stylesheet remaining"); + + info("Removing the <link> node"); + const onLinkRemoved = waitFor(() => !ui.editors.length); + await SpecialPowers.spawn(gBrowser.selectedBrowser, [], () => { + content.document.querySelector("link").remove(); + }); + await onLinkRemoved; + is(ui.editors.length, 0, "There's no stylesheet displayed anymore"); +}); |