diff --git a/__mocks__/browser-request.js b/__mocks__/browser-request.js index 45f83a1763..7d231fb9db 100644 --- a/__mocks__/browser-request.js +++ b/__mocks__/browser-request.js @@ -1,16 +1,17 @@ const en = require("../src/i18n/strings/en_EN"); module.exports = jest.fn((opts, cb) => { - if (opts.url.endsWith("languages.json")) { + const url = opts.url || opts.uri; + if (url && url.endsWith("languages.json")) { cb(undefined, {status: 200}, JSON.stringify({ "en": { "fileName": "en_EN.json", "label": "English", }, })); - } else if (opts.url.endsWith("en_EN.json")) { + } else if (url && url.endsWith("en_EN.json")) { cb(undefined, {status: 200}, JSON.stringify(en)); } else { - cb(undefined, {status: 404}, ""); + cb(true, {status: 404}, ""); } }); diff --git a/src/Tinter.js b/src/Tinter.js index de9ae94097..24a4d25a00 100644 --- a/src/Tinter.js +++ b/src/Tinter.js @@ -143,10 +143,14 @@ class Tinter { * over time then the best bet is to register a single callback for the * entire set. * + * To ensure the tintable work happens at least once, it is also called as + * part of registration. + * * @param {Function} tintable Function to call when the tint changes. */ registerTintable(tintable) { this.tintables.push(tintable); + tintable(); } getKeyRgb() {