Bug 1499096 - Update tests using ok() to is(), with minor fixes;r=Standard8

Depends on D8741
This changeset updates some calls to ok() that should actually be calls to is()
and that needed tiny fixes to match the expected value.

Differential Revision: https://phabricator.services.mozilla.com/D8742

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Julian Descottes 2018-10-23 07:21:18 +00:00
parent 73e3a16c0d
commit 305dfd1207
6 changed files with 19 additions and 13 deletions

View File

@ -25,8 +25,9 @@ add_task(async function() {
ok(!selectedTab.hasAttribute("aria-selected"),
"Selected tab shouldn't be marked as aria-selected when only one tab is selected");
} else {
ok(selectedTabs.length, tabs.length, "Check number of selected tabs");
for (let tab of tabs) {
const uniqueTabs = [...new Set(tabs)];
is(selectedTabs.length, uniqueTabs.length, "Check number of selected tabs");
for (let tab of uniqueTabs) {
ok(tab.multiselected, "Tab should be multi-selected");
ok(_multiSelectedTabsSet.has(tab), "Tab should be in _multiSelectedTabsSet");
ok(selectedTabs.includes(tab), "Tab should be in selectedTabs");

View File

@ -3,15 +3,15 @@
"use strict";
const TEST_URL = "http://example.com";
const TEST_URL = "http://example.com/";
add_task(async function setup() {
let oldHomepagePref = Services.prefs.getCharPref("browser.startup.homepage");
await openPreferencesViaOpenPreferencesAPI("paneHome", {leaveOpen: true});
Assert.ok(gBrowser.currentURI.spec, "about:preferences#home",
"#home should be in the URI for about:preferences");
Assert.equal(gBrowser.currentURI.spec, "about:preferences#home",
"#home should be in the URI for about:preferences");
registerCleanupFunction(async () => {
Services.prefs.setCharPref("browser.startup.homepage", oldHomepagePref);
@ -42,6 +42,6 @@ add_task(async function testSetHomepageFromBookmark() {
dialog.document.documentElement.getButton("accept").click();
Assert.ok(Services.prefs.getCharPref("browser.startup.homepage"), TEST_URL,
"Should have set the homepage to the same as the bookmark.");
Assert.equal(Services.prefs.getCharPref("browser.startup.homepage"), TEST_URL,
"Should have set the homepage to the same as the bookmark.");
});

View File

@ -52,7 +52,8 @@
let connectionsChanged = waitForConnectionChange("opened", 2);
items[0].click();
ok(win.document.querySelector("window").className, "busy", "UI is busy");
ok(win.document.querySelector("window").classList.contains("busy"),
"UI is busy");
await win.UI._busyPromise;
await connectionsChanged;

View File

@ -99,7 +99,8 @@
let connectionsChanged = waitForConnectionChange("opened", 2);
items[0].click();
ok(win.document.querySelector("window").className, "busy", "UI is busy");
ok(win.document.querySelector("window").classList.contains("busy"),
"UI is busy");
await win.UI._busyPromise;
await connectionsChanged;
@ -164,7 +165,8 @@
// Click the infinite runtime
items[1].click();
ok(win.document.querySelector("window").className, "busy", "UI is busy");
ok(win.document.querySelector("window").classList.contains("busy"),
"UI is busy");
// Wait for error message since connection never completes
await new Promise(resolve => {
@ -177,7 +179,8 @@
// Click the prolonged runtime
items[2].click();
ok(win.document.querySelector("window").className, "busy", "UI is busy");
ok(win.document.querySelector("window").classList.contains("busy"),
"UI is busy");
// Check for unexpected error message since this is prolonged
const noErrorDeferred = new Promise((resolve, reject) => {

View File

@ -48,7 +48,8 @@
docRuntime.querySelectorAll(".runtime-panel-item-other")[1].click();
ok(win.document.querySelector("window").className, "busy", "UI is busy");
ok(win.document.querySelector("window").classList.contains("busy"),
"UI is busy");
await win.UI._busyPromise;
await deferred;

View File

@ -18,7 +18,7 @@ b.postMessage(42);
SimpleTest.waitForExplicitFinish();
onmessage= function(e) {
ok(e.data, "42", "BroadcastChannel works with data URLs");
is(e.data, 42, "BroadcastChannel works with data URLs");
SimpleTest.finish();
}