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 /toolkit/components/reader/test/browser_localfile_readerMode.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 'toolkit/components/reader/test/browser_localfile_readerMode.js')
-rw-r--r-- | toolkit/components/reader/test/browser_localfile_readerMode.js | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/toolkit/components/reader/test/browser_localfile_readerMode.js b/toolkit/components/reader/test/browser_localfile_readerMode.js new file mode 100644 index 0000000000..118e4bb23f --- /dev/null +++ b/toolkit/components/reader/test/browser_localfile_readerMode.js @@ -0,0 +1,54 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +const TEST_BASE_URI = getResolvedURI(getRootDirectory(gTestPath)).spec; + +let readerButton = document.getElementById("reader-mode-button"); + +/** + * Reader mode should work on local files. + */ +add_task(async function test_readermode_available_for_local_files() { + await BrowserTestUtils.withNewTab( + TEST_BASE_URI + "readerModeArticle.html", + async function (browser) { + await TestUtils.waitForCondition( + () => !readerButton.hidden, + "Reader mode button should become visible" + ); + + is_element_visible( + readerButton, + "Reader mode button is present on a reader-able page" + ); + + // Switch page into reader mode. + let promiseTabLoad = BrowserTestUtils.browserLoaded(browser); + readerButton.click(); + await promiseTabLoad; + + let readerUrl = gBrowser.selectedBrowser.currentURI.spec; + ok( + readerUrl.startsWith("about:reader"), + "about:reader loaded after clicking reader mode button" + ); + is_element_visible( + readerButton, + "Reader mode button is present on about:reader" + ); + + is( + gURLBar.untrimmedValue, + TEST_BASE_URI + "readerModeArticle.html", + "gURLBar value is about:reader URL" + ); + is( + gURLBar.value, + gURLBar.untrimmedValue, + "gURLBar is displaying original article URL" + ); + } + ); +}); |