From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- .../newtab/test/browser/browser_as_render.js | 83 ++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 browser/components/newtab/test/browser/browser_as_render.js (limited to 'browser/components/newtab/test/browser/browser_as_render.js') diff --git a/browser/components/newtab/test/browser/browser_as_render.js b/browser/components/newtab/test/browser/browser_as_render.js new file mode 100644 index 0000000000..2e82786b16 --- /dev/null +++ b/browser/components/newtab/test/browser/browser_as_render.js @@ -0,0 +1,83 @@ +"use strict"; + +test_newtab({ + async before({ pushPrefs }) { + await pushPrefs([ + "browser.newtabpage.activity-stream.improvesearch.handoffToAwesomebar", + false, + ]); + }, + test: function test_render_search() { + let search = content.document.getElementById("newtab-search-text"); + ok(search, "Got the search box"); + isnot( + search.placeholder, + "search_web_placeholder", + "Search box is localized" + ); + }, +}); + +test_newtab({ + async before({ pushPrefs }) { + await pushPrefs([ + "browser.newtabpage.activity-stream.improvesearch.handoffToAwesomebar", + true, + ]); + }, + test: function test_render_search_handoff() { + let search = content.document.querySelector(".search-handoff-button"); + ok(search, "Got the search handoff button"); + }, +}); + +test_newtab(function test_render_topsites() { + let topSites = content.document.querySelector(".top-sites-list"); + ok(topSites, "Got the top sites section"); +}); + +test_newtab({ + async before({ pushPrefs }) { + await pushPrefs([ + "browser.newtabpage.activity-stream.feeds.topsites", + false, + ]); + }, + test: function test_render_no_topsites() { + let topSites = content.document.querySelector(".top-sites-list"); + ok(!topSites, "No top sites section"); + }, +}); + +// This next test runs immediately after test_render_no_topsites to make sure +// the topsites pref is restored +test_newtab(function test_render_topsites_again() { + let topSites = content.document.querySelector(".top-sites-list"); + ok(topSites, "Got the top sites section again"); +}); + +test_newtab({ + async before({ pushPrefs }) { + await pushPrefs([ + "browser.newtabpage.activity-stream.logowordmark.alwaysVisible", + false, + ]); + }, + test: function test_render_logo_false() { + let logoWordmark = content.document.querySelector(".logo-and-wordmark"); + ok(!logoWordmark, "The logo is not rendered when pref is false"); + }, +}); + +test_newtab({ + async before({ pushPrefs }) { + await pushPrefs([ + "browser.newtabpage.activity-stream.logowordmark.alwaysVisible", + true, + ]); + }, + test: function test_render_logo() { + let logoWordmark = content.document.querySelector(".logo-and-wordmark"); + ok(logoWordmark, "The logo is rendered when pref is true"); + }, +}); -- cgit v1.2.3