diff options
Diffstat (limited to 'polygerrit-ui/app/elements/gr-app_test.html')
-rw-r--r-- | polygerrit-ui/app/elements/gr-app_test.html | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/polygerrit-ui/app/elements/gr-app_test.html b/polygerrit-ui/app/elements/gr-app_test.html index 28251fe59e..3712ffa169 100644 --- a/polygerrit-ui/app/elements/gr-app_test.html +++ b/polygerrit-ui/app/elements/gr-app_test.html @@ -18,9 +18,9 @@ limitations under the License. <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes"> <title>gr-app</title> -<script src="../bower_components/webcomponentsjs/webcomponents.min.js"></script> +<script src="../bower_components/webcomponentsjs/webcomponents-lite.min.js"></script> <script src="../bower_components/web-component-tester/browser.js"></script> - +<link rel="import" href="../test/common-test-setup.html"/> <link rel="import" href="gr-app.html"> <script>void(0);</script> @@ -32,11 +32,11 @@ limitations under the License. </test-fixture> <script> - suite('gr-app tests', function() { - var sandbox; - var element; + suite('gr-app tests', () => { + let sandbox; + let element; - setup(function(done) { + setup(done => { sandbox = sinon.sandbox.create(); stub('gr-reporting', { appStarted: sandbox.stub(), @@ -45,43 +45,43 @@ limitations under the License. _getTopContent: sinon.stub(), }); stub('gr-rest-api-interface', { - getAccount: function() { return Promise.resolve({}); }, - getAccountCapabilities: function() { return Promise.resolve({}); }, - getConfig: function() { + getAccount() { return Promise.resolve({}); }, + getAccountCapabilities() { return Promise.resolve({}); }, + getConfig() { return Promise.resolve({ gerrit: {web_uis: ['GWT', 'POLYGERRIT']}, - plugin: {js_resource_paths: []}, + plugin: {}, }); }, - getVersion: function() { return Promise.resolve(42); }, + getPreferences() { return Promise.resolve({my: []}); }, + getVersion() { return Promise.resolve(42); }, + probePath() { return Promise.resolve(42); }, }); element = fixture('basic'); flush(done); }); - teardown(function() { + teardown(() => { sandbox.restore(); }); - test('reporting', function() { + test('reporting', () => { assert.isTrue(element.$.reporting.appStarted.calledOnce); }); - test('location change updates gwt footer', function(done) { + test('location change updates gwt footer', done => { element._path = '/test/path'; - flush(function() { - var gwtLink = element.$$('#gwtLink'); - assert.equal( - gwtLink.href, - 'http://' + location.host + element.getBaseUrl() + '/?polygerrit=0#/test/path' - ); + flush(() => { + const gwtLink = element.$$('#gwtLink'); + assert.equal(gwtLink.href, 'http://' + location.host + + element.getBaseUrl() + '/?polygerrit=0#/test/path'); done(); }); }); - test('_handleLocationChange handles hashes', function(done) { - var curLocation = { + test('_handleLocationChange handles hashes', done => { + const curLocation = { pathname: '/c/1/1/testfile.txt', hash: '#2', host: location.host, @@ -89,21 +89,21 @@ limitations under the License. sandbox.stub(element, '_handleSearchPageChange'); element._handleLocationChange({detail: curLocation}); - flush(function() { - var gwtLink = element.$$('#gwtLink'); + flush(() => { + const gwtLink = element.$$('#gwtLink'); assert.equal( - gwtLink.href, - 'http://' + location.host + element.getBaseUrl() + + gwtLink.href, + 'http://' + location.host + element.getBaseUrl() + '/?polygerrit=0#/c/1/1/testfile.txt@2' ); done(); }); }); - test('sets plugins count', function() { - sandbox.stub(Gerrit, '_setPluginsCount'); - element._loadPlugins([]); - assert.isTrue(Gerrit._setPluginsCount.calledWithExactly(0)); + test('passes config to gr-plugin-host', () => { + return element.$.restAPI.getConfig.lastCall.returnValue.then(config => { + assert.deepEqual(element.$.plugins.config, config); + }); }); }); </script> |