From 0dfd58c7844eb13a599fd9a4f1a43fa0d153ed6e Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Thu, 16 Jan 2020 11:54:36 +0000 Subject: [PATCH 1/3] Compute download file icon immediately Build process changes may have changed the load order, so this tintable is now registered too late (after the theme is set). Fixes https://github.com/vector-im/riot-web/issues/11881 --- src/Tinter.js | 4 ++++ 1 file changed, 4 insertions(+) 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() { From dab31d724dcc45cb3dfed87d8eed442e6526b147 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Thu, 16 Jan 2020 14:01:15 +0000 Subject: [PATCH 2/3] Support uri option in request mock --- __mocks__/browser-request.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/__mocks__/browser-request.js b/__mocks__/browser-request.js index 45f83a1763..8038262091 100644 --- a/__mocks__/browser-request.js +++ b/__mocks__/browser-request.js @@ -1,14 +1,15 @@ 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}, ""); From 0ef362a79317c2a1dc77f987816b6fddef32e4c7 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Thu, 16 Jan 2020 14:06:54 +0000 Subject: [PATCH 3/3] Request mock should send truthy for errors --- __mocks__/browser-request.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__mocks__/browser-request.js b/__mocks__/browser-request.js index 8038262091..7d231fb9db 100644 --- a/__mocks__/browser-request.js +++ b/__mocks__/browser-request.js @@ -12,6 +12,6 @@ module.exports = jest.fn((opts, cb) => { } else if (url && url.endsWith("en_EN.json")) { cb(undefined, {status: 200}, JSON.stringify(en)); } else { - cb(undefined, {status: 404}, ""); + cb(true, {status: 404}, ""); } });