Bug 1642282 - Register a calendar before running browser_categoryColors.js. rs=bustage-fix a=pmorris
authorGeoff Lankow <geoff@darktrojan.net>
Tue, 02 Jun 2020 11:13:26 +1200
changeset 39316 aef3b87e8b7e2c1ec9b08acd48b314f5dea4b0db
parent 39315 8fe382e22b1b84bac5d2048867f499e8f0c952d7
child 39317 9beb6b92df03d79f16e778f32dd00860405b1150
push id402
push userclokep@gmail.com
push dateMon, 29 Jun 2020 20:48:04 +0000
reviewersbustage-fix, pmorris
bugs1642282
Bug 1642282 - Register a calendar before running browser_categoryColors.js. rs=bustage-fix a=pmorris
calendar/test/browser/preferences/browser_categoryColors.js
--- a/calendar/test/browser/preferences/browser_categoryColors.js
+++ b/calendar/test/browser/preferences/browser_categoryColors.js
@@ -1,13 +1,24 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
+var { cal } = ChromeUtils.import("resource:///modules/calendar/calUtils.jsm");
+
 add_task(async function testCategoryColors() {
+  let manager = cal.getCalendarManager();
+  let calendar = manager.createCalendar("memory", Services.io.newURI("moz-memory-calendar://"));
+  calendar.name = "Mochitest";
+  manager.registerCalendar(calendar);
+
+  registerCleanupFunction(async () => {
+    manager.unregisterCalendar(calendar);
+  });
+
   let { prefsWindow, prefsDocument } = await openNewPrefsTab("paneLightning", "categorieslist");
 
   let listBox = prefsDocument.getElementById("categorieslist");
   Assert.equal(listBox.itemChildren.length, 22);
 
   for (let item of listBox.itemChildren) {
     info(`${item.firstElementChild.value}: ${item.lastElementChild.style.backgroundColor}`);
     Assert.ok(item.lastElementChild.style.backgroundColor);