Merge "Fix plugin counting for plugins with multiple UI plugins"

This commit is contained in:
viktard
2018-05-02 15:57:22 +00:00
committed by Gerrit Code Review
3 changed files with 13 additions and 4 deletions

View File

@@ -33,7 +33,7 @@ limitations under the License.
</test-fixture>
<script>
suite('gr-diff tests', () => {
suite('gr-plugin-host tests', () => {
let element;
let sandbox;
let url;
@@ -54,8 +54,8 @@ limitations under the License.
sandbox.stub(Gerrit, '_setPluginsCount');
element.config = {
plugin: {
html_resource_paths: ['foo/bar', 'baz'],
js_resource_paths: ['42'],
html_resource_paths: ['plugins/foo/bar', 'plugins/baz'],
js_resource_paths: ['plugins/42'],
},
};
assert.isTrue(Gerrit._setPluginsCount.calledWith(3));

View File

@@ -351,6 +351,15 @@ limitations under the License.
return Gerrit.awaitPluginsLoaded();
});
test('multiple ui plugins per java plugin', () => {
const file1 = 'http://test.com/plugins/qaz/static/foo.nocache.js';
const file2 = 'http://test.com/plugins/qaz/static/bar.js';
Gerrit._setPluginsPending([file1, file2]);
Gerrit.install(() => {}, '0.1', file1);
Gerrit.install(() => {}, '0.1', file2);
return Gerrit.awaitPluginsLoaded();
});
test('plugin install errors shows toasts', () => {
const alertStub = sandbox.stub();
document.addEventListener('show-alert', alertStub);

View File

@@ -561,7 +561,7 @@
o[getPluginNameFromUrl(url)] = url;
return o;
}, {});
Gerrit._setPluginsCount(plugins.length);
Gerrit._setPluginsCount(Object.keys(_pluginsPending).length);
};
Gerrit._setPluginsCount = function(count) {