2010-11-16 05:19:50 -08:00
|
|
|
/* Any copyright is dedicated to the Public Domain.
|
|
|
|
* http://creativecommons.org/publicdomain/zero/1.0/
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Test:
|
|
|
|
// * if add-on is installed to the add-on bar, the bar is made visible.
|
|
|
|
// * if add-on is uninstalled from the add-on bar, and no more add-ons there,
|
|
|
|
// the bar is hidden.
|
|
|
|
|
|
|
|
function test() {
|
|
|
|
let aml = AddonsMgrListener;
|
|
|
|
ok(aml, "AddonsMgrListener exists");
|
|
|
|
// check is hidden
|
2010-12-11 10:41:53 -08:00
|
|
|
is(aml.addonBar.collapsed, true, "add-on bar is hidden initially");
|
2010-11-16 05:19:50 -08:00
|
|
|
// aob gets the count
|
|
|
|
AddonsMgrListener.onInstalling();
|
|
|
|
// add an item
|
|
|
|
let element = document.createElement("toolbaritem");
|
2010-12-11 10:41:53 -08:00
|
|
|
element.id = "bug598923-addon-item";
|
2010-11-16 05:19:50 -08:00
|
|
|
aml.addonBar.appendChild(element);
|
|
|
|
// aob checks the count, makes visible
|
|
|
|
AddonsMgrListener.onInstalled();
|
|
|
|
// check is visible
|
2010-12-11 10:41:53 -08:00
|
|
|
is(aml.addonBar.collapsed, false, "add-on bar has been made visible");
|
2010-11-16 05:19:50 -08:00
|
|
|
// aob gets the count
|
|
|
|
AddonsMgrListener.onUninstalling();
|
|
|
|
// remove an item
|
|
|
|
aml.addonBar.removeChild(element);
|
|
|
|
// aob checks the count, makes hidden
|
|
|
|
AddonsMgrListener.onUninstalled();
|
|
|
|
// check is hidden
|
2010-12-11 10:41:53 -08:00
|
|
|
is(aml.addonBar.collapsed, true, "add-on bar is hidden again");
|
2010-11-16 05:19:50 -08:00
|
|
|
}
|