Bug 1007663 - Avoid showing empty experiments list. r=unfocused

This commit is contained in:
Georg Fritzsche 2014-05-15 11:28:31 +02:00
parent 014baeb0e1
commit 2babd2681f
2 changed files with 47 additions and 1 deletions

View File

@ -236,7 +236,7 @@ richlistitem:not([selected]) * {
.view-pane[type="experiment"] .error,
.view-pane[type="experiment"] .warning,
.view-pane[type="experiment"] .pending,
.view-pane[type="experiment"] .addon:not([pending="uninstall"]) .pending,
.view-pane[type="experiment"] .disabled-postfix,
.view-pane[type="experiment"] .update-postfix,
.view-pane[type="experiment"] .version,

View File

@ -66,6 +66,30 @@ function openDetailsView(aId) {
return deferred.promise;
}
function clickRemoveButton(addonElement) {
let btn = gManagerWindow.document.getAnonymousElementByAttribute(addonElement, "anonid", "remove-btn");
if (!btn) {
return Promise.reject();
}
EventUtils.synthesizeMouseAtCenter(btn, { clickCount: 1 }, gManagerWindow);
let deferred = Promise.defer();
setTimeout(deferred.resolve, 0);
return deferred;
}
function clickUndoButton(addonElement) {
let btn = gManagerWindow.document.getAnonymousElementByAttribute(addonElement, "anonid", "undo-btn");
if (!btn) {
return Promise.reject();
}
EventUtils.synthesizeMouseAtCenter(btn, { clickCount: 1 }, gManagerWindow);
let deferred = Promise.defer();
setTimeout(deferred.resolve, 0);
return deferred;
}
add_task(function* initializeState() {
gManagerWindow = yield open_manager();
gCategoryUtilities = new CategoryUtilities(gManagerWindow);
@ -580,6 +604,28 @@ add_task(function testDetailView() {
is_element_visible(el, "experiment-bullet should be visible.");
});
add_task(function* testRemoveAndUndo() {
if (!gExperiments) {
info("Skipping experiments test because that feature isn't available.");
return;
}
yield gCategoryUtilities.openType("experiment");
let addon = get_addon_element(gManagerWindow, "test-experiment1@experiments.mozilla.org");
Assert.ok(addon, "Got add-on element.");
yield clickRemoveButton(addon);
addon.parentNode.ensureElementIsVisible(addon);
let el = gManagerWindow.document.getAnonymousElementByAttribute(addon, "class", "pending");
is_element_visible(el, "Uninstall undo information should be visible.");
yield clickUndoButton(addon);
addon = get_addon_element(gManagerWindow, "test-experiment1@experiments.mozilla.org");
Assert.ok(addon, "Got add-on element.");
});
add_task(function* testCleanup() {
if (gExperiments) {
Services.prefs.clearUserPref("experiments.enabled");