browser_as_render.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. "use strict";
  2. test_newtab({
  3. async before({pushPrefs}) {
  4. await pushPrefs(["browser.newtabpage.activity-stream.improvesearch.handoffToAwesomebar", false]);
  5. },
  6. test: function test_render_search() {
  7. let search = content.document.getElementById("newtab-search-text");
  8. ok(search, "Got the search box");
  9. isnot(search.placeholder, "search_web_placeholder", "Search box is localized");
  10. },
  11. });
  12. test_newtab({
  13. async before({pushPrefs}) {
  14. await pushPrefs(["browser.newtabpage.activity-stream.improvesearch.handoffToAwesomebar", true]);
  15. },
  16. test: function test_render_search_handoff() {
  17. let search = content.document.querySelector(".search-handoff-button");
  18. ok(search, "Got the search handoff button");
  19. },
  20. });
  21. test_newtab(function test_render_topsites() {
  22. let topSites = content.document.querySelector(".top-sites-list");
  23. ok(topSites, "Got the top sites section");
  24. });
  25. test_newtab({
  26. async before({pushPrefs}) {
  27. await pushPrefs(["browser.newtabpage.activity-stream.feeds.topsites", false]);
  28. },
  29. test: function test_render_no_topsites() {
  30. let topSites = content.document.querySelector(".top-sites-list");
  31. ok(!topSites, "No top sites section");
  32. },
  33. });
  34. // This next test runs immediately after test_render_no_topsites to make sure
  35. // the topsites pref is restored
  36. test_newtab(function test_render_topsites_again() {
  37. let topSites = content.document.querySelector(".top-sites-list");
  38. ok(topSites, "Got the top sites section again");
  39. });