Skip theme loading if it was preloaded with a bundle
Change-Id: Ib73a9c68ffea49b4905f0512cc3a5931b6343088
This commit is contained in:
@@ -40,7 +40,10 @@
|
||||
this._handleMigrations(plugins.js_resource_paths || [], htmlPlugins)
|
||||
.map(p => this._urlFor(p))
|
||||
.filter(p => !Gerrit._isPluginPreloaded(p));
|
||||
const defaultTheme = this._urlFor(config.default_theme);
|
||||
const shouldLoadTheme = config.default_theme &&
|
||||
!Gerrit._isPluginPreloaded('preloaded:gerrit-theme');
|
||||
const defaultTheme =
|
||||
shouldLoadTheme ? this._urlFor(config.default_theme) : null;
|
||||
const pluginsPending =
|
||||
[].concat(jsPlugins, htmlPlugins, defaultTheme || []);
|
||||
Gerrit._setPluginsPending(pluginsPending);
|
||||
|
@@ -197,6 +197,17 @@ limitations under the License.
|
||||
assert.isTrue(Gerrit._setPluginsPending.calledWith([url + '/oof']));
|
||||
});
|
||||
|
||||
test('skips default theme loading if preloaded', () => {
|
||||
sandbox.stub(Gerrit, '_isPluginPreloaded')
|
||||
.withArgs('preloaded:gerrit-theme').returns(true);
|
||||
sandbox.stub(Gerrit, '_setPluginsPending');
|
||||
element.config = {
|
||||
default_theme: '/oof',
|
||||
plugin: {},
|
||||
};
|
||||
assert.isFalse(element.importHref.calledWith(url + '/oof'));
|
||||
});
|
||||
|
||||
test('skips preloaded plugins', () => {
|
||||
sandbox.stub(Gerrit, '_isPluginPreloaded')
|
||||
.withArgs(url + '/plugins/foo/bar').returns(true)
|
||||
|
Reference in New Issue
Block a user