From 0dba3ce13340a8787a170c6693b22c040103adb2 Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Tue, 6 Apr 2021 10:27:20 +0100 Subject: chore(3p/gerrit): update gerrit and plugins This reverts commit 9551b628d02323b01ecb80220342eea488f7200e (i.e. this is a rollfoward for https://cl.tvl.fyi/c/depot/+/2817) Change-Id: Iaffcf1cdbe119d26ecb09cc88f9a56436b374c08 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2870 Reviewed-by: tazjin Tested-by: BuildkiteCI --- .../gerrit/polygerrit-revert-typescript.patch | 210 +++++++++++++++++++++ 1 file changed, 210 insertions(+) create mode 100644 third_party/gerrit/polygerrit-revert-typescript.patch (limited to 'third_party/gerrit/polygerrit-revert-typescript.patch') diff --git a/third_party/gerrit/polygerrit-revert-typescript.patch b/third_party/gerrit/polygerrit-revert-typescript.patch new file mode 100644 index 000000000000..4f549ee554d7 --- /dev/null +++ b/third_party/gerrit/polygerrit-revert-typescript.patch @@ -0,0 +1,210 @@ +commit a969f220b8e6e0e8b9f3bab2b1f0b7ec20c3be94 +Author: David Ostrovsky +Date: Mon Mar 29 08:29:17 2021 +0000 + + Revert "Convert gr-app_test to typescript" + + This reverts commit 56fa576885bf7fbddd38a8af2404ea7e5d1d625f. + + Reason for revert: It broke PolyGerrit UI. + + Bug: Issue 14300 + Change-Id: Ice0a70801dad8daea0822ce489ae24892c08ebcd + +diff --git a/polygerrit-ui/app/elements/gr-app.ts b/polygerrit-ui/app/elements/gr-app.ts +index 463fab920f..2d3289d479 100644 +--- a/polygerrit-ui/app/elements/gr-app.ts ++++ b/polygerrit-ui/app/elements/gr-app.ts +@@ -45,7 +45,7 @@ import {installPolymerResin} from '../scripts/polymer-resin-install'; + installPolymerResin(safeTypesBridge); + + @customElement('gr-app') +-export class GrApp extends PolymerElement { ++class GrApp extends PolymerElement { + static get template() { + return htmlTemplate; + } +diff --git a/polygerrit-ui/app/elements/gr-app_test.js b/polygerrit-ui/app/elements/gr-app_test.js +new file mode 100644 +index 0000000000..8178c89732 +--- /dev/null ++++ b/polygerrit-ui/app/elements/gr-app_test.js +@@ -0,0 +1,77 @@ ++/** ++ * @license ++ * Copyright (C) 2016 The Android Open Source Project ++ * ++ * Licensed under the Apache License, Version 2.0 (the "License"); ++ * you may not use this file except in compliance with the License. ++ * You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++ ++import '../test/common-test-setup-karma.js'; ++import './gr-app.js'; ++import {appContext} from '../services/app-context.js'; ++import {GerritNav} from './core/gr-navigation/gr-navigation.js'; ++import {html} from '@polymer/polymer/lib/utils/html-tag.js'; ++import {stubRestApi} from '../test/test-utils.js'; ++ ++const basicFixture = fixtureFromTemplate(html``); ++ ++suite('gr-app tests', () => { ++ let element; ++ let configStub; ++ ++ setup(done => { ++ sinon.stub(appContext.reportingService, 'appStarted'); ++ stub('gr-account-dropdown', '_getTopContent'); ++ stub('gr-router', 'start'); ++ stubRestApi('getAccount').returns(Promise.resolve({})); ++ stubRestApi('getAccountCapabilities').returns(Promise.resolve({})); ++ configStub = stubRestApi('getConfig').returns(Promise.resolve({ ++ plugin: {}, ++ auth: { ++ auth_type: undefined, ++ }, ++ })); ++ stubRestApi('getPreferences').returns(Promise.resolve({my: []})); ++ stubRestApi('getVersion').returns(Promise.resolve(42)); ++ stubRestApi('probePath').returns(Promise.resolve(42)); ++ ++ element = basicFixture.instantiate(); ++ flush(done); ++ }); ++ ++ const appElement = () => element.$['app-element']; ++ ++ test('reporting', () => { ++ assert.isTrue(appElement().reporting.appStarted.calledOnce); ++ }); ++ ++ test('reporting called before router start', () => { ++ const element = appElement(); ++ const appStartedStub = element.reporting.appStarted; ++ const routerStartStub = element.$.router.start; ++ sinon.assert.callOrder(appStartedStub, routerStartStub); ++ }); ++ ++ test('passes config to gr-plugin-host', () => ++ configStub.lastCall.returnValue.then(config => { ++ assert.deepEqual(appElement().$.plugins.config, config); ++ }) ++ ); ++ ++ test('_paramsChanged sets search page', () => { ++ appElement()._paramsChanged({base: {view: GerritNav.View.CHANGE}}); ++ assert.notOk(appElement()._lastSearchPage); ++ appElement()._paramsChanged({base: {view: GerritNav.View.SEARCH}}); ++ assert.ok(appElement()._lastSearchPage); ++ }); ++}); ++ +diff --git a/polygerrit-ui/app/elements/gr-app_test.ts b/polygerrit-ui/app/elements/gr-app_test.ts +deleted file mode 100644 +index 3583a6a3a2..0000000000 +--- a/polygerrit-ui/app/elements/gr-app_test.ts ++++ /dev/null +@@ -1,82 +0,0 @@ +-/** +- * @license +- * Copyright (C) 2016 The Android Open Source Project +- * +- * Licensed under the Apache License, Version 2.0 (the "License"); +- * you may not use this file except in compliance with the License. +- * You may obtain a copy of the License at +- * +- * http://www.apache.org/licenses/LICENSE-2.0 +- * +- * Unless required by applicable law or agreed to in writing, software +- * distributed under the License is distributed on an "AS IS" BASIS, +- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +- * See the License for the specific language governing permissions and +- * limitations under the License. +- */ +- +-import '../test/common-test-setup-karma'; +-import {GrApp} from './gr-app'; +-import {appContext} from '../services/app-context'; +-import {html} from '@polymer/polymer/lib/utils/html-tag'; +-import {queryAndAssert} from '../test/test-utils'; +-import {createServerInfo} from '../test/test-data-generators'; +-import {GrAppElement} from './gr-app-element'; +-import {GrPluginHost} from './plugins/gr-plugin-host/gr-plugin-host'; +-import {GerritView} from '../services/router/router-model'; +-import { +- AppElementChangeViewParams, +- AppElementSearchParam, +-} from './gr-app-types'; +-import {GrRouter} from './core/gr-router/gr-router'; +-import {ReportingService} from '../services/gr-reporting/gr-reporting'; +- +-const basicFixture = fixtureFromTemplate(html``); +- +-suite('gr-app tests', () => { +- let element: GrApp; +- let appStartedStub: sinon.SinonStubbedMember; +- let routerStartStub: sinon.SinonStubbedMember; +- +- setup(done => { +- appStartedStub = sinon.stub(appContext.reportingService, 'appStarted'); +- routerStartStub = stub('gr-router', 'start'); +- stub('gr-account-dropdown', '_getTopContent'); +- +- element = basicFixture.instantiate() as GrApp; +- flush(done); +- }); +- +- const appElement = () => +- queryAndAssert(element, '#app-element'); +- +- test('reporting', () => { +- assert.isTrue(appStartedStub.calledOnce); +- }); +- +- test('reporting called before router start', () => { +- sinon.assert.callOrder(appStartedStub, routerStartStub); +- }); +- +- test('passes config to gr-plugin-host', () => { +- assert.deepEqual( +- queryAndAssert(appElement(), 'gr-plugin-host').config, +- createServerInfo() +- ); +- }); +- +- test('_paramsChanged sets search page', () => { +- appElement()._paramsChanged({ +- path: '', +- value: undefined, +- base: {view: GerritView.CHANGE} as AppElementChangeViewParams, +- }); +- assert.notOk(appElement()._lastSearchPage); +- appElement()._paramsChanged({ +- path: '', +- value: undefined, +- base: {view: GerritView.SEARCH} as AppElementSearchParam, +- }); +- assert.ok(appElement()._lastSearchPage); +- }); +-}); +diff --git a/polygerrit-ui/app/elements/plugins/gr-plugin-host/gr-plugin-host.ts b/polygerrit-ui/app/elements/plugins/gr-plugin-host/gr-plugin-host.ts +index 651eac4e28..ac493a2556 100644 +--- a/polygerrit-ui/app/elements/plugins/gr-plugin-host/gr-plugin-host.ts ++++ b/polygerrit-ui/app/elements/plugins/gr-plugin-host/gr-plugin-host.ts +@@ -20,7 +20,7 @@ import {customElement, property} from '@polymer/decorators'; + import {ServerInfo} from '../../../types/common'; + + @customElement('gr-plugin-host') +-export class GrPluginHost extends PolymerElement { ++class GrPluginHost extends PolymerElement { + @property({type: Object, observer: '_configChanged'}) + config?: ServerInfo; + -- cgit 1.4.1