This repository has been archived by the owner on Feb 29, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1546429 - Add mochitest coverage of Special FXA (Below Search) Sn…
…ippet (#5033)
- Loading branch information
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
"use strict"; | ||
|
||
const {ASRouter} = ChromeUtils.import("resource://activity-stream/lib/ASRouter.jsm"); | ||
|
||
test_newtab({ | ||
async before() { | ||
let data = ASRouter.state.messages.find(m => m.id === "SIMPLE_BELOW_SEARCH_TEST_1"); | ||
ASRouter.messageChannel.sendAsyncMessage("ASRouter:parent-to-child", {type: "SET_MESSAGE", data}); | ||
}, | ||
test: async function test_simple_below_search_snippet() { | ||
// Verify the simple_below_search_snippet renders in container below searchbox | ||
// and nothing is rendered in the footer. | ||
await ContentTaskUtils.waitForCondition( | ||
() => content.document.querySelector(".below-search-snippet .SimpleBelowSearchSnippet"), | ||
"Should find the snippet inside the below search container"); | ||
|
||
is(0, content.document.querySelector("#footer-asrouter-container").childNodes.length, | ||
"Should not find any snippets in the footer container"); | ||
}, | ||
}); | ||
|
||
test_newtab({ | ||
async before() { | ||
let data = ASRouter.state.messages.find(m => m.id === "SIMPLE_TEST_1"); | ||
ASRouter.messageChannel.sendAsyncMessage("ASRouter:parent-to-child", {type: "SET_MESSAGE", data}); | ||
}, | ||
test: async function test_simple_snippet() { | ||
// Verify the simple_snippet renders in the footer and the container below | ||
// searchbox is not rendered. | ||
await ContentTaskUtils.waitForCondition( | ||
() => content.document.querySelector("#footer-asrouter-container .SimpleSnippet"), | ||
"Should find the snippet inside the footer container"); | ||
|
||
ok(!content.document.querySelector(".below-search-snippet"), | ||
"Should not find any snippets below search"); | ||
}, | ||
}); |