Fix Gerrit, should honor global init

Change-Id: Ibec762d85280c1bf5d0f55a862cdd7202ebabcf8
This commit is contained in:
Tao Zhou
2020-09-11 09:32:00 +02:00
parent 2a04aa3509
commit 7859dc8501
2 changed files with 5 additions and 1 deletions

View File

@@ -75,7 +75,7 @@ function flushPreinstalls() {
export const _testOnly_flushPreinstalls = flushPreinstalls;
export function initGerritPluginApi() {
window.Gerrit = {};
window.Gerrit = window.Gerrit || {};
flushPreinstalls();
initGerritPluginsMethods(window.Gerrit as GerritGlobal);
// Preloaded plugins should be installed after Gerrit.install() is set,

View File

@@ -31,6 +31,7 @@ import {_testOnly_getShortcutManagerInstance} from '../mixins/keyboard-shortcut-
import sinon from 'sinon/pkg/sinon-esm.js';
import {safeTypesBridge} from '../utils/safe-types-util.js';
import {_testOnly_initGerritPluginApi} from '../elements/shared/gr-js-api-interface/gr-gerrit.js';
import {initGlobalVariables} from '../elements/gr-app-global-var-init.js';
window.sinon = sinon;
security.polymer_resin.install({
@@ -60,6 +61,9 @@ window.fixture = function(fixtureId, model) {
};
setup(() => {
window.Gerrit = {};
initGlobalVariables();
// If the following asserts fails - then window.stub is
// overwritten by some other code.
assert.equal(cleanups.length, 0);