1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
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");
},
});
|