summaryrefslogtreecommitdiffstats
path: root/toolkit/mozapps/extensions/test/browser/browser_bug580298.js
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2018-02-11 07:03:16 -0500
committerMatt A. Tobin <email@mattatobin.com>2018-02-11 07:03:16 -0500
commit203eb0f61a09372310a2a8fb57e169cb3f47800b (patch)
tree8490329d3dae4de3c7ffd127bce1f65fdc009abd /toolkit/mozapps/extensions/test/browser/browser_bug580298.js
parente45706ca3acbb6530419433212becc61d5953a2d (diff)
parent8f6d3dab81c7f8f97ef197e26ab9439b09735b8f (diff)
downloadUXP-203eb0f61a09372310a2a8fb57e169cb3f47800b.tar
UXP-203eb0f61a09372310a2a8fb57e169cb3f47800b.tar.gz
UXP-203eb0f61a09372310a2a8fb57e169cb3f47800b.tar.lz
UXP-203eb0f61a09372310a2a8fb57e169cb3f47800b.tar.xz
UXP-203eb0f61a09372310a2a8fb57e169cb3f47800b.zip
Merge branch 'ext-work'FF_Checkpoint_1
Diffstat (limited to 'toolkit/mozapps/extensions/test/browser/browser_bug580298.js')
-rw-r--r--toolkit/mozapps/extensions/test/browser/browser_bug580298.js111
1 files changed, 111 insertions, 0 deletions
diff --git a/toolkit/mozapps/extensions/test/browser/browser_bug580298.js b/toolkit/mozapps/extensions/test/browser/browser_bug580298.js
new file mode 100644
index 000000000..8456cc433
--- /dev/null
+++ b/toolkit/mozapps/extensions/test/browser/browser_bug580298.js
@@ -0,0 +1,111 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+// Tests that certain types of addons do not have their version number
+// displayed. This currently only includes lightweight themes.
+
+var gManagerWindow;
+var gCategoryUtilities;
+var gProvider;
+
+function test() {
+ waitForExplicitFinish();
+
+ gProvider = new MockProvider();
+
+ gProvider.createAddons([{
+ id: "extension@tests.mozilla.org",
+ name: "Extension 1",
+ type: "extension",
+ version: "123"
+ }, {
+ id: "theme@tests.mozilla.org",
+ name: "Theme 2",
+ type: "theme",
+ version: "456"
+ }, {
+ id: "lwtheme@personas.mozilla.org",
+ name: "Persona 3",
+ type: "theme",
+ version: "789"
+ }]);
+
+ open_manager(null, function(aWindow) {
+ gManagerWindow = aWindow;
+ gCategoryUtilities = new CategoryUtilities(gManagerWindow);
+ run_next_test();
+ });
+}
+
+function end_test() {
+ close_manager(gManagerWindow, finish);
+}
+
+function get(aId) {
+ return gManagerWindow.document.getElementById(aId);
+}
+
+function get_node(parent, anonid) {
+ return parent.ownerDocument.getAnonymousElementByAttribute(parent, "anonid", anonid);
+}
+
+function open_details(aList, aItem, aCallback) {
+ aList.ensureElementIsVisible(aItem);
+ EventUtils.synthesizeMouseAtCenter(aItem, { clickCount: 1 }, gManagerWindow);
+ EventUtils.synthesizeMouseAtCenter(aItem, { clickCount: 2 }, gManagerWindow);
+ wait_for_view_load(gManagerWindow, aCallback);
+}
+
+function check_addon_has_version(aList, aName, aVersion) {
+ for (let i = 0; i < aList.itemCount; i++) {
+ let item = aList.getItemAtIndex(i);
+ if (get_node(item, "name").value === aName) {
+ ok(true, "Item with correct name found");
+ is(get_node(item, "version").value, aVersion, "Item has correct version");
+ return item;
+ }
+ }
+ ok(false, "Item with correct name was not found");
+ return null;
+}
+
+add_test(function() {
+ gCategoryUtilities.openType("extension", function() {
+ info("Extension");
+ let list = gManagerWindow.document.getElementById("addon-list");
+ let item = check_addon_has_version(list, "Extension 1", "123");
+ open_details(list, item, function() {
+ is_element_visible(get("detail-version"), "Details view has version visible");
+ is(get("detail-version").value, "123", "Details view has correct version");
+ run_next_test();
+ });
+ });
+});
+
+add_test(function() {
+ gCategoryUtilities.openType("theme", function() {
+ info("Normal theme");
+ let list = gManagerWindow.document.getElementById("addon-list");
+ let item = check_addon_has_version(list, "Theme 2", "456");
+ open_details(list, item, function() {
+ is_element_visible(get("detail-version"), "Details view has version visible");
+ is(get("detail-version").value, "456", "Details view has correct version");
+ run_next_test();
+ });
+ });
+});
+
+add_test(function() {
+ gCategoryUtilities.openType("theme", function() {
+ info("Lightweight theme");
+ let list = gManagerWindow.document.getElementById("addon-list");
+ // See that the version isn't displayed
+ let item = check_addon_has_version(list, "Persona 3", "");
+ open_details(list, item, function() {
+ is_element_hidden(get("detail-version"), "Details view has version hidden");
+ // If the version element is hidden then we don't care about its value
+ run_next_test();
+ });
+ });
+});