Skip to content
This repository has been archived by the owner on Feb 29, 2020. It is now read-only.

Commit

Permalink
Bug 1546429 - Add mochitest coverage of Special FXA (Below Search) Sn…
Browse files Browse the repository at this point in the history
…ippet (#5033)
  • Loading branch information
rlr committed May 16, 2019
1 parent e323516 commit 46cad59
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/browser/browser.ini
Expand Up @@ -8,10 +8,12 @@ prefs =
browser.newtabpage.activity-stream.discoverystream.endpoints=data:
browser.newtabpage.activity-stream.feeds.section.topstories=true
browser.newtabpage.activity-stream.feeds.section.topstories.options={}
browser.newtabpage.activity-stream.asrouter.devtoolsEnabled=true

[browser_activity_stream_strings.js]
[browser_as_load_location.js]
[browser_as_render.js]
[browser_asrouter_snippets.js]
[browser_asrouter_targeting.js]
[browser_asrouter_trigger_listeners.js]
[browser_discovery_styles.js]
Expand Down
37 changes: 37 additions & 0 deletions test/browser/browser_asrouter_snippets.js
@@ -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");
},
});

0 comments on commit 46cad59

Please sign in to comment.