Bug 1458230 - Fix various Assert.ok tests that should be using Assert.equals in places related code. r?paolo
MozReview-Commit-ID: 7i1fPn10Xbe
--- a/browser/components/places/tests/browser/browser_bookmarksProperties.js
+++ b/browser/components/places/tests/browser/browser_bookmarksProperties.js
@@ -208,19 +208,19 @@ gTests.push({
self.window.document.documentElement.cancelDialog();
break;
case "popupshown":
tagsField.popup.removeEventListener("popupshown", this, true);
// In case this test fails the window will close, the test will fail
// since we didn't set _cleanShutdown.
let richlistbox = tagsField.popup.richlistbox;
// Focus and select first result.
- Assert.ok(richlistbox.itemCount, 1, "We have 1 autocomplete result");
+ Assert.equal(richlistbox.itemCount, 1, "We have 1 autocomplete result");
tagsField.popup.selectedIndex = 0;
- Assert.ok(richlistbox.selectedItems.length, 1,
+ Assert.equal(richlistbox.selectedItems.length, 1,
"We have selected a tag from the autocomplete popup");
info("About to focus the autocomplete results");
richlistbox.focus();
EventUtils.synthesizeKey("VK_ESCAPE", {}, self.window);
break;
default:
Assert.ok(false, "unknown event: " + aEvent.type);
}
--- a/toolkit/components/places/tests/bookmarks/test_405938_restore_queries.js
+++ b/toolkit/components/places/tests/bookmarks/test_405938_restore_queries.js
@@ -132,17 +132,17 @@ var test = {
dateAdded: new Date(date + ((this._extraBookmarksCount - i) * 1000)),
});
}
}
var toolbar =
PlacesUtils.getFolderContents(PlacesUtils.toolbarFolderId,
false, true).root;
- Assert.ok(toolbar.childCount, 1);
+ Assert.equal(toolbar.childCount, 1);
var folderNode = toolbar.getChild(0);
Assert.equal(folderNode.type, folderNode.RESULT_TYPE_FOLDER);
Assert.equal(folderNode.title, this._testRootTitle);
folderNode.QueryInterface(Ci.nsINavHistoryQueryResultNode);
folderNode.containerOpen = true;
// |_count| folders + the query nodes
--- a/toolkit/components/places/tests/bookmarks/test_424958-json-quoted-folders.js
+++ b/toolkit/components/places/tests/bookmarks/test_424958-json-quoted-folders.js
@@ -38,17 +38,17 @@ var quotesTest = {
var query = PlacesUtils.history.getNewQuery();
query.setFolders([PlacesUtils.bookmarks.toolbarFolder], 1);
var result = PlacesUtils.history.executeQuery(query, PlacesUtils.history.getNewQueryOptions());
var toolbar = result.root;
toolbar.containerOpen = true;
// test for our quoted folder
- Assert.ok(toolbar.childCount, 1);
+ Assert.equal(toolbar.childCount, 1);
var folderNode = toolbar.getChild(0);
Assert.equal(folderNode.type, folderNode.RESULT_TYPE_FOLDER);
Assert.equal(folderNode.title, this._folderTitle);
// clean up
toolbar.containerOpen = false;
}
};
--- a/toolkit/components/places/tests/unit/test_async_transactions.js
+++ b/toolkit/components/places/tests/unit/test_async_transactions.js
@@ -239,17 +239,17 @@ function ensureAnnotationsSet(aGuid, aAn
Assert.ok(changes.has(anno.name));
let changeInfo = changes.get(anno.name);
Assert.ok(changeInfo.isAnnoProperty);
Assert.equal(changeInfo.newValue, anno.value);
}
}
function ensureItemsMoved(...items) {
- Assert.ok(observer.itemsMoved.size, items.length);
+ Assert.equal(observer.itemsMoved.size, items.length);
for (let item of items) {
Assert.ok(observer.itemsMoved.has(item.guid));
let info = observer.itemsMoved.get(item.guid);
Assert.equal(info.oldParentGuid, item.oldParentGuid);
Assert.equal(info.oldIndex, item.oldIndex);
Assert.equal(info.newParentGuid, item.newParentGuid);
Assert.equal(info.newIndex, item.newIndex);
}