summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitrii Filippov <dmfilippov@google.com>2020-04-24 14:38:10 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2020-04-24 14:38:10 +0000
commit1f5e96e0dc7f8aae5e3f881e667db90814f3720f (patch)
tree67b699eb6c05a3dc7bc847de03da5a65e652f98e
parentfbf322c360c57ece2e1daa181dce087c86aaff48 (diff)
parentba8fa47dbb5db4f7a74482c81f67945d96efff78 (diff)
Merge changes I01d619c7,Ia2318e15,I91a33a64
* changes: Import Polymer classes instead of global ones in CommentApiMock Convert mock-diff-response element to a function Remove unnessecary Polymer.IronFitMixin definition
-rw-r--r--polygerrit-ui/app/behaviors/keyboard-shortcut-behavior/keyboard-shortcut-behavior.js1
-rw-r--r--polygerrit-ui/app/elements/change/gr-file-list/gr-file-list_test.html5
-rw-r--r--polygerrit-ui/app/elements/diff/gr-comment-api/gr-comment-api-mock_test.js63
-rw-r--r--polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder-element_test.html4
-rw-r--r--polygerrit-ui/app/elements/diff/gr-diff-cursor/gr-diff-cursor_test.html17
-rw-r--r--polygerrit-ui/app/elements/diff/gr-diff/gr-diff_test.html13
-rw-r--r--polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select_test.html1
-rw-r--r--polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer_test.html5
-rw-r--r--polygerrit-ui/app/elements/shared/gr-autocomplete-dropdown/gr-autocomplete-dropdown.js1
-rw-r--r--polygerrit-ui/app/elements/shared/gr-rest-api-interface/mock-diff-response_test.html168
-rw-r--r--polygerrit-ui/app/elements/shared/gr-rest-api-interface/mock-diff-response_test.js166
-rw-r--r--polygerrit-ui/app/test/mock-diff-response.js149
-rw-r--r--polygerrit-ui/app/types/polymer-behaviors.js57
13 files changed, 199 insertions, 451 deletions
diff --git a/polygerrit-ui/app/behaviors/keyboard-shortcut-behavior/keyboard-shortcut-behavior.js b/polygerrit-ui/app/behaviors/keyboard-shortcut-behavior/keyboard-shortcut-behavior.js
index e9b2043666..cb21a9fa5b 100644
--- a/polygerrit-ui/app/behaviors/keyboard-shortcut-behavior/keyboard-shortcut-behavior.js
+++ b/polygerrit-ui/app/behaviors/keyboard-shortcut-behavior/keyboard-shortcut-behavior.js
@@ -103,7 +103,6 @@ shortcuts are.
import '../../scripts/bundled-polymer.js';
import {IronA11yKeysBehavior} from '@polymer/iron-a11y-keys-behavior/iron-a11y-keys-behavior.js';
-import '../../types/polymer-behaviors.js';
import {dom} from '@polymer/polymer/lib/legacy/polymer.dom.js';
const DOC_ONLY = 'DOC_ONLY';
diff --git a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list_test.html b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list_test.html
index 08b25cad37..e0c70a40b1 100644
--- a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list_test.html
+++ b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list_test.html
@@ -44,7 +44,7 @@ limitations under the License.
<script type="module">
import '../../../test/common-test-setup.js';
import '../../diff/gr-comment-api/gr-comment-api.js';
-import '../../shared/gr-rest-api-interface/mock-diff-response_test.js';
+import {getMockDiffResponse} from '../../../test/mock-diff-response.js';
import './gr-file-list.js';
import '../../diff/gr-comment-api/gr-comment-api-mock_test.js';
import {dom} from '@polymer/polymer/lib/legacy/polymer.dom.js';
@@ -1506,7 +1506,6 @@ suite('gr-file-list tests', () => {
];
const setupDiff = function(diff) {
- const mock = document.createElement('mock-diff-response');
diff.comments = {
left: diff.path === '/COMMIT_MSG' ? commitMsgComments : [],
right: [],
@@ -1534,7 +1533,7 @@ suite('gr-file-list tests', () => {
theme: 'DEFAULT',
ignore_whitespace: 'IGNORE_NONE',
};
- diff.diff = mock.diffResponse;
+ diff.diff = getMockDiffResponse();
diff.$.diff.flushDebouncer('renderDiffTable');
};
diff --git a/polygerrit-ui/app/elements/diff/gr-comment-api/gr-comment-api-mock_test.js b/polygerrit-ui/app/elements/diff/gr-comment-api/gr-comment-api-mock_test.js
index 4abdb615ff..77c72d4973 100644
--- a/polygerrit-ui/app/elements/diff/gr-comment-api/gr-comment-api-mock_test.js
+++ b/polygerrit-ui/app/elements/diff/gr-comment-api/gr-comment-api-mock_test.js
@@ -14,41 +14,42 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-(function() {
- 'use strict';
- class CommentApiMock extends Polymer.GestureEventListeners(
- Polymer.LegacyElementMixin(
- Polymer.Element)) {
- static get is() { return 'comment-api-mock'; }
+import {GestureEventListeners} from '@polymer/polymer/lib/mixins/gesture-event-listeners.js';
+import {PolymerElement} from '@polymer/polymer/polymer-element.js';
+import {LegacyElementMixin} from '@polymer/polymer/lib/legacy/legacy-element-mixin.js';
- static get properties() {
- return {
- _changeComments: Object,
- };
- }
+class CommentApiMock extends GestureEventListeners(
+ LegacyElementMixin(
+ PolymerElement)) {
+ static get is() { return 'comment-api-mock'; }
- loadComments() {
- return this._reloadComments();
- }
+ static get properties() {
+ return {
+ _changeComments: Object,
+ };
+ }
+
+ loadComments() {
+ return this._reloadComments();
+ }
- /**
- * For the purposes of the mock, _reloadDrafts is not included because its
- * response is the same type as reloadComments, just makes less API
- * requests. Since this is for test purposes/mocked data anyway, keep this
- * file simpler by just using _reloadComments here instead.
- */
- _reloadDraftsWithCallback(e) {
- return this._reloadComments().then(() => e.detail.resolve());
- }
+ /**
+ * For the purposes of the mock, _reloadDrafts is not included because its
+ * response is the same type as reloadComments, just makes less API
+ * requests. Since this is for test purposes/mocked data anyway, keep this
+ * file simpler by just using _reloadComments here instead.
+ */
+ _reloadDraftsWithCallback(e) {
+ return this._reloadComments().then(() => e.detail.resolve());
+ }
- _reloadComments() {
- return this.$.commentAPI.loadAll(this._changeNum)
- .then(comments => {
- this._changeComments = this.$.commentAPI._changeComments;
- });
- }
+ _reloadComments() {
+ return this.$.commentAPI.loadAll(this._changeNum)
+ .then(comments => {
+ this._changeComments = this.$.commentAPI._changeComments;
+ });
}
+}
- customElements.define(CommentApiMock.is, CommentApiMock);
-})();
+customElements.define(CommentApiMock.is, CommentApiMock);
diff --git a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder-element_test.html b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder-element_test.html
index f4a8073262..0bb748fef8 100644
--- a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder-element_test.html
+++ b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder-element_test.html
@@ -51,7 +51,7 @@ import '../../../test/common-test-setup.js';
import '../gr-diff/gr-diff-group.js';
import './gr-diff-builder.js';
import '../../shared/gr-rest-api-interface/gr-rest-api-interface.js';
-import '../../shared/gr-rest-api-interface/mock-diff-response_test.js';
+import {getMockDiffResponse} from '../../../test/mock-diff-response.js';
import './gr-diff-builder-element.js';
import {dom, flush} from '@polymer/polymer/lib/legacy/polymer.dom.js';
import {GrAnnotation} from '../gr-diff-highlight/gr-annotation.js';
@@ -898,7 +898,7 @@ suite('gr-diff-builder tests', () => {
setup(done => {
element = fixture('mock-diff');
- diff = document.createElement('mock-diff-response').diffResponse;
+ diff = getMockDiffResponse();
element.diff = diff;
prefs = {
diff --git a/polygerrit-ui/app/elements/diff/gr-diff-cursor/gr-diff-cursor_test.html b/polygerrit-ui/app/elements/diff/gr-diff-cursor/gr-diff-cursor_test.html
index d4a9ce12b6..4577696623 100644
--- a/polygerrit-ui/app/elements/diff/gr-diff-cursor/gr-diff-cursor_test.html
+++ b/polygerrit-ui/app/elements/diff/gr-diff-cursor/gr-diff-cursor_test.html
@@ -26,7 +26,6 @@ limitations under the License.
<test-fixture id="basic">
<template>
- <mock-diff-response></mock-diff-response>
<gr-diff></gr-diff>
<gr-diff-cursor></gr-diff-cursor>
<gr-rest-api-interface></gr-rest-api-interface>
@@ -44,22 +43,20 @@ import '../../../test/common-test-setup.js';
import '../gr-diff/gr-diff.js';
import './gr-diff-cursor.js';
import '../../shared/gr-rest-api-interface/gr-rest-api-interface.js';
-import '../../shared/gr-rest-api-interface/mock-diff-response_test.js';
+import {getMockDiffResponse} from '../../../test/mock-diff-response.js';
import {dom} from '@polymer/polymer/lib/legacy/polymer.dom.js';
suite('gr-diff-cursor tests', () => {
let sandbox;
let cursorElement;
let diffElement;
- let mockDiffResponse;
setup(done => {
sandbox = sinon.sandbox.create();
const fixtureElems = fixture('basic');
- mockDiffResponse = fixtureElems[0];
- diffElement = fixtureElems[1];
- cursorElement = fixtureElems[2];
- const restAPI = fixtureElems[3];
+ diffElement = fixtureElems[0];
+ cursorElement = fixtureElems[1];
+ const restAPI = fixtureElems[2];
// Register the diff with the cursor.
cursorElement.push('diffs', diffElement);
@@ -81,7 +78,7 @@ suite('gr-diff-cursor tests', () => {
restAPI.getDiffPreferences().then(prefs => {
diffElement.prefs = prefs;
- diffElement.diff = mockDiffResponse.diffResponse;
+ diffElement.diff = getMockDiffResponse();
});
});
@@ -262,7 +259,7 @@ suite('gr-diff-cursor tests', () => {
done();
}
diffElement.addEventListener('render', renderHandler);
- diffElement._diffChanged(mockDiffResponse.diffResponse);
+ diffElement._diffChanged(getMockDiffResponse());
});
test('initialLineNumber provided', done => {
@@ -285,7 +282,7 @@ suite('gr-diff-cursor tests', () => {
cursorElement.initialLineNumber = 10;
cursorElement.side = 'right';
- diffElement._diffChanged(mockDiffResponse.diffResponse);
+ diffElement._diffChanged(getMockDiffResponse());
});
test('getTargetDiffElement', () => {
diff --git a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff_test.html b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff_test.html
index e6e8ee866c..f7769f505f 100644
--- a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff_test.html
+++ b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff_test.html
@@ -34,7 +34,7 @@ limitations under the License.
<script type="module">
import '../../../test/common-test-setup.js';
import '../../shared/gr-rest-api-interface/gr-rest-api-interface.js';
-import '../../shared/gr-rest-api-interface/mock-diff-response_test.js';
+import {getMockDiffResponse} from '../../../test/mock-diff-response.js';
import './gr-diff.js';
import {dom, flush} from '@polymer/polymer/lib/legacy/polymer.dom.js';
import {GrDiffBuilderImage} from '../gr-diff-builder/gr-diff-builder-image.js';
@@ -235,9 +235,8 @@ suite('gr-diff tests', () => {
element.patchRange = {basePatchNum: 1, patchNum: 2};
element.path = 'file.txt';
- const mock = document.createElement('mock-diff-response');
element.$.diffBuilder._builder = element.$.diffBuilder._getDiffBuilder(
- mock.diffResponse, Object.assign({}, MINIMAL_PREFS));
+ getMockDiffResponse(), Object.assign({}, MINIMAL_PREFS));
// No thread groups.
assert.isNotOk(element._getThreadGroupForLine(contentEl));
@@ -597,8 +596,7 @@ suite('gr-diff tests', () => {
suite('getCursorStops', () => {
const setupDiff = function() {
- const mock = document.createElement('mock-diff-response');
- element.diff = mock.diffResponse;
+ element.diff = getMockDiffResponse();
element.prefs = {
context: 10,
tab_size: 8,
@@ -777,9 +775,8 @@ suite('gr-diff tests', () => {
new CustomEvent('render', {bubbles: true, composed: true}));
return Promise.resolve({});
});
- const mock = document.createElement('mock-diff-response');
sandbox.stub(element, 'getDiffLength').returns(10000);
- element.diff = mock.diffResponse;
+ element.diff = getMockDiffResponse();
element.noRenderOnPrefsChange = true;
});
@@ -1074,7 +1071,7 @@ suite('gr-diff tests', () => {
});
test('getDiffLength', () => {
- const diff = document.createElement('mock-diff-response').diffResponse;
+ const diff = getMockDiffResponse();
assert.equal(element.getDiffLength(diff), 52);
});
diff --git a/polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select_test.html b/polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select_test.html
index d0334e7b95..af2458acc2 100644
--- a/polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select_test.html
+++ b/polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select_test.html
@@ -42,7 +42,6 @@ limitations under the License.
<script type="module">
import '../../../test/common-test-setup.js';
import '../gr-comment-api/gr-comment-api.js';
-import '../../shared/gr-rest-api-interface/mock-diff-response_test.js';
import '../../shared/revision-info/revision-info.js';
import './gr-patch-range-select.js';
import '../gr-comment-api/gr-comment-api-mock_test.js';
diff --git a/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer_test.html b/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer_test.html
index 36af6aebf8..07f95f4dff 100644
--- a/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer_test.html
+++ b/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer_test.html
@@ -32,7 +32,7 @@ limitations under the License.
<script type="module">
import '../../../test/common-test-setup.js';
-import '../../shared/gr-rest-api-interface/mock-diff-response_test.js';
+import {getMockDiffResponse} from '../../../test/mock-diff-response.js';
import './gr-syntax-layer.js';
import {GrAnnotation} from '../gr-diff-highlight/gr-annotation.js';
import {GrDiffLine} from '../gr-diff/gr-diff-line.js';
@@ -65,8 +65,7 @@ suite('gr-syntax-layer tests', () => {
setup(() => {
sandbox = sinon.sandbox.create();
element = fixture('basic');
- const mock = document.createElement('mock-diff-response');
- diff = mock.diffResponse;
+ diff = getMockDiffResponse();
element.diff = diff;
});
diff --git a/polygerrit-ui/app/elements/shared/gr-autocomplete-dropdown/gr-autocomplete-dropdown.js b/polygerrit-ui/app/elements/shared/gr-autocomplete-dropdown/gr-autocomplete-dropdown.js
index 521dcd1d93..46e8829d56 100644
--- a/polygerrit-ui/app/elements/shared/gr-autocomplete-dropdown/gr-autocomplete-dropdown.js
+++ b/polygerrit-ui/app/elements/shared/gr-autocomplete-dropdown/gr-autocomplete-dropdown.js
@@ -28,7 +28,6 @@ import {htmlTemplate} from './gr-autocomplete-dropdown_html.js';
import {KeyboardShortcutBehavior} from '../../../behaviors/keyboard-shortcut-behavior/keyboard-shortcut-behavior.js';
/**
- * @appliesMixin Polymer.IronFitMixin
* @extends Polymer.Element
*/
class GrAutocompleteDropdown extends mixinBehaviors( [
diff --git a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/mock-diff-response_test.html b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/mock-diff-response_test.html
deleted file mode 100644
index 015d71e7ad..0000000000
--- a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/mock-diff-response_test.html
+++ /dev/null
@@ -1,168 +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.
--->
-
-<link rel="import" href="/bower_components/polymer/polymer.html">
-<link rel="import" href="../../../test/common-test-setup.html"/>
-<dom-module id="mock-diff-response">
- <template></template>
- <script>
- (function() {
- 'use strict';
-
- const RESPONSE = {
- meta_a: {
- name: 'lorem-ipsum.txt',
- content_type: 'text/plain',
- lines: 45,
- },
- meta_b: {
- name: 'lorem-ipsum.txt',
- content_type: 'text/plain',
- lines: 48,
- },
- intraline_status: 'OK',
- change_type: 'MODIFIED',
- diff_header: [
- 'diff --git a/lorem-ipsum.txt b/lorem-ipsum.txt',
- 'index b2adcf4..554ae49 100644',
- '--- a/lorem-ipsum.txt',
- '+++ b/lorem-ipsum.txt',
- ],
- content: [
- {
- ab: [
- 'Lorem ipsum dolor sit amet, suspendisse inceptos vehicula, ' +
- 'nulla phasellus.',
- 'Mattis lectus.',
- 'Sodales duis.',
- 'Orci a faucibus.',
- ],
- },
- {
- b: [
- 'Nullam neque, ligula ac, id blandit.',
- 'Sagittis tincidunt torquent, tempor nunc amet.',
- 'At rhoncus id.',
- ],
- },
- {
- ab: [
- 'Sem nascetur, erat ut, non in.',
- 'A donec, venenatis pellentesque dis.',
- 'Mauris mauris.',
- 'Quisque nisl duis, facilisis viverra.',
- 'Justo purus, semper eget et.',
- ],
- },
- {
- a: [
- 'Est amet, vestibulum pellentesque.',
- 'Erat ligula.',
- 'Justo eros.',
- 'Fringilla quisque.',
- ],
- },
- {
- ab: [
- 'Arcu eget, rhoncus amet cursus, ipsum elementum.',
- 'Eros suspendisse.',
- ],
- },
- {
- a: [
- 'Rhoncus tempor, ultricies aliquam ipsum.',
- ],
- b: [
- 'Rhoncus tempor, ultricies praesent ipsum.',
- ],
- edit_a: [
- [
- 26,
- 7,
- ],
- ],
- edit_b: [
- [
- 26,
- 8,
- ],
- ],
- },
- {
- ab: [
- 'Sollicitudin duis.',
- 'Blandit blandit, ante nisl fusce.',
- 'Felis ac at, tellus consectetuer.',
- 'Sociis ligula sapien, egestas leo.',
- 'Cum pulvinar, sed mauris, cursus neque velit.',
- 'Augue porta lobortis.',
- 'Nibh lorem, amet fermentum turpis, vel pulvinar diam.',
- 'Id quam ipsum, id urna et, massa suspendisse.',
- 'Ac nec, nibh praesent.',
- 'Rutrum vestibulum.',
- 'Est tellus, bibendum habitasse.',
- 'Justo facilisis, vel nulla.',
- 'Donec eu, vulputate neque aliquam, nulla dui.',
- 'Risus adipiscing in.',
- 'Lacus arcu arcu.',
- 'Urna velit.',
- 'Urna a dolor.',
- 'Lectus magna augue, convallis mattis tortor, sed tellus ' +
- 'consequat.',
- 'Etiam dui, blandit wisi.',
- 'Mi nec.',
- 'Vitae eget vestibulum.',
- 'Ullamcorper nunc ante, nec imperdiet felis, consectetur in.',
- 'Ac eget.',
- 'Vel fringilla, interdum pellentesque placerat, proin ante.',
- ],
- },
- {
- b: [
- 'Eu congue risus.',
- 'Enim ac, quis elementum.',
- 'Non et elit.',
- 'Etiam aliquam, diam vel nunc.',
- ],
- },
- {
- ab: [
- 'Nec at.',
- 'Arcu mauris, venenatis lacus fermentum, praesent duis.',
- 'Pellentesque amet et, tellus duis.',
- 'Ipsum arcu vitae, justo elit, sed libero tellus.',
- 'Metus rutrum euismod, vivamus sodales, vel arcu nisl.',
- ],
- },
- ],
- };
-
- Polymer({
- is: 'mock-diff-response',
-
- properties: {
- diffResponse: {
- type: Object,
- value() {
- return RESPONSE;
- },
- },
- },
- });
- })();
- </script>
-</dom-module>
diff --git a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/mock-diff-response_test.js b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/mock-diff-response_test.js
deleted file mode 100644
index e7bc662384..0000000000
--- a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/mock-diff-response_test.js
+++ /dev/null
@@ -1,166 +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 '../../../scripts/bundled-polymer.js';
-
-import '../../../test/common-test-setup.js';
-import {Polymer} from '@polymer/polymer/lib/legacy/polymer-fn.js';
-import {html} from '@polymer/polymer/lib/utils/html-tag.js';
-
-const RESPONSE = {
- meta_a: {
- name: 'lorem-ipsum.txt',
- content_type: 'text/plain',
- lines: 45,
- },
- meta_b: {
- name: 'lorem-ipsum.txt',
- content_type: 'text/plain',
- lines: 48,
- },
- intraline_status: 'OK',
- change_type: 'MODIFIED',
- diff_header: [
- 'diff --git a/lorem-ipsum.txt b/lorem-ipsum.txt',
- 'index b2adcf4..554ae49 100644',
- '--- a/lorem-ipsum.txt',
- '+++ b/lorem-ipsum.txt',
- ],
- content: [
- {
- ab: [
- 'Lorem ipsum dolor sit amet, suspendisse inceptos vehicula, ' +
- 'nulla phasellus.',
- 'Mattis lectus.',
- 'Sodales duis.',
- 'Orci a faucibus.',
- ],
- },
- {
- b: [
- 'Nullam neque, ligula ac, id blandit.',
- 'Sagittis tincidunt torquent, tempor nunc amet.',
- 'At rhoncus id.',
- ],
- },
- {
- ab: [
- 'Sem nascetur, erat ut, non in.',
- 'A donec, venenatis pellentesque dis.',
- 'Mauris mauris.',
- 'Quisque nisl duis, facilisis viverra.',
- 'Justo purus, semper eget et.',
- ],
- },
- {
- a: [
- 'Est amet, vestibulum pellentesque.',
- 'Erat ligula.',
- 'Justo eros.',
- 'Fringilla quisque.',
- ],
- },
- {
- ab: [
- 'Arcu eget, rhoncus amet cursus, ipsum elementum.',
- 'Eros suspendisse.',
- ],
- },
- {
- a: [
- 'Rhoncus tempor, ultricies aliquam ipsum.',
- ],
- b: [
- 'Rhoncus tempor, ultricies praesent ipsum.',
- ],
- edit_a: [
- [
- 26,
- 7,
- ],
- ],
- edit_b: [
- [
- 26,
- 8,
- ],
- ],
- },
- {
- ab: [
- 'Sollicitudin duis.',
- 'Blandit blandit, ante nisl fusce.',
- 'Felis ac at, tellus consectetuer.',
- 'Sociis ligula sapien, egestas leo.',
- 'Cum pulvinar, sed mauris, cursus neque velit.',
- 'Augue porta lobortis.',
- 'Nibh lorem, amet fermentum turpis, vel pulvinar diam.',
- 'Id quam ipsum, id urna et, massa suspendisse.',
- 'Ac nec, nibh praesent.',
- 'Rutrum vestibulum.',
- 'Est tellus, bibendum habitasse.',
- 'Justo facilisis, vel nulla.',
- 'Donec eu, vulputate neque aliquam, nulla dui.',
- 'Risus adipiscing in.',
- 'Lacus arcu arcu.',
- 'Urna velit.',
- 'Urna a dolor.',
- 'Lectus magna augue, convallis mattis tortor, sed tellus ' +
- 'consequat.',
- 'Etiam dui, blandit wisi.',
- 'Mi nec.',
- 'Vitae eget vestibulum.',
- 'Ullamcorper nunc ante, nec imperdiet felis, consectetur in.',
- 'Ac eget.',
- 'Vel fringilla, interdum pellentesque placerat, proin ante.',
- ],
- },
- {
- b: [
- 'Eu congue risus.',
- 'Enim ac, quis elementum.',
- 'Non et elit.',
- 'Etiam aliquam, diam vel nunc.',
- ],
- },
- {
- ab: [
- 'Nec at.',
- 'Arcu mauris, venenatis lacus fermentum, praesent duis.',
- 'Pellentesque amet et, tellus duis.',
- 'Ipsum arcu vitae, justo elit, sed libero tellus.',
- 'Metus rutrum euismod, vivamus sodales, vel arcu nisl.',
- ],
- },
- ],
-};
-
-Polymer({
- _template: html`
-
-`,
-
- is: 'mock-diff-response',
-
- properties: {
- diffResponse: {
- type: Object,
- value() {
- return RESPONSE;
- },
- },
- },
-});
diff --git a/polygerrit-ui/app/test/mock-diff-response.js b/polygerrit-ui/app/test/mock-diff-response.js
new file mode 100644
index 0000000000..8ca44c24aa
--- /dev/null
+++ b/polygerrit-ui/app/test/mock-diff-response.js
@@ -0,0 +1,149 @@
+/**
+ * @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.
+ */
+
+export function getMockDiffResponse() {
+ // Return new response, so tests can't affect each other - if a test somehow
+ // modifies it, the future calls return original value
+ // Do not put it to a const outside of a method
+ return {
+ meta_a: {
+ name: 'lorem-ipsum.txt',
+ content_type: 'text/plain',
+ lines: 45,
+ },
+ meta_b: {
+ name: 'lorem-ipsum.txt',
+ content_type: 'text/plain',
+ lines: 48,
+ },
+ intraline_status: 'OK',
+ change_type: 'MODIFIED',
+ diff_header: [
+ 'diff --git a/lorem-ipsum.txt b/lorem-ipsum.txt',
+ 'index b2adcf4..554ae49 100644',
+ '--- a/lorem-ipsum.txt',
+ '+++ b/lorem-ipsum.txt',
+ ],
+ content: [
+ {
+ ab: [
+ 'Lorem ipsum dolor sit amet, suspendisse inceptos vehicula, ' +
+ 'nulla phasellus.',
+ 'Mattis lectus.',
+ 'Sodales duis.',
+ 'Orci a faucibus.',
+ ],
+ },
+ {
+ b: [
+ 'Nullam neque, ligula ac, id blandit.',
+ 'Sagittis tincidunt torquent, tempor nunc amet.',
+ 'At rhoncus id.',
+ ],
+ },
+ {
+ ab: [
+ 'Sem nascetur, erat ut, non in.',
+ 'A donec, venenatis pellentesque dis.',
+ 'Mauris mauris.',
+ 'Quisque nisl duis, facilisis viverra.',
+ 'Justo purus, semper eget et.',
+ ],
+ },
+ {
+ a: [
+ 'Est amet, vestibulum pellentesque.',
+ 'Erat ligula.',
+ 'Justo eros.',
+ 'Fringilla quisque.',
+ ],
+ },
+ {
+ ab: [
+ 'Arcu eget, rhoncus amet cursus, ipsum elementum.',
+ 'Eros suspendisse.',
+ ],
+ },
+ {
+ a: [
+ 'Rhoncus tempor, ultricies aliquam ipsum.',
+ ],
+ b: [
+ 'Rhoncus tempor, ultricies praesent ipsum.',
+ ],
+ edit_a: [
+ [
+ 26,
+ 7,
+ ],
+ ],
+ edit_b: [
+ [
+ 26,
+ 8,
+ ],
+ ],
+ },
+ {
+ ab: [
+ 'Sollicitudin duis.',
+ 'Blandit blandit, ante nisl fusce.',
+ 'Felis ac at, tellus consectetuer.',
+ 'Sociis ligula sapien, egestas leo.',
+ 'Cum pulvinar, sed mauris, cursus neque velit.',
+ 'Augue porta lobortis.',
+ 'Nibh lorem, amet fermentum turpis, vel pulvinar diam.',
+ 'Id quam ipsum, id urna et, massa suspendisse.',
+ 'Ac nec, nibh praesent.',
+ 'Rutrum vestibulum.',
+ 'Est tellus, bibendum habitasse.',
+ 'Justo facilisis, vel nulla.',
+ 'Donec eu, vulputate neque aliquam, nulla dui.',
+ 'Risus adipiscing in.',
+ 'Lacus arcu arcu.',
+ 'Urna velit.',
+ 'Urna a dolor.',
+ 'Lectus magna augue, convallis mattis tortor, sed tellus ' +
+ 'consequat.',
+ 'Etiam dui, blandit wisi.',
+ 'Mi nec.',
+ 'Vitae eget vestibulum.',
+ 'Ullamcorper nunc ante, nec imperdiet felis, consectetur in.',
+ 'Ac eget.',
+ 'Vel fringilla, interdum pellentesque placerat, proin ante.',
+ ],
+ },
+ {
+ b: [
+ 'Eu congue risus.',
+ 'Enim ac, quis elementum.',
+ 'Non et elit.',
+ 'Etiam aliquam, diam vel nunc.',
+ ],
+ },
+ {
+ ab: [
+ 'Nec at.',
+ 'Arcu mauris, venenatis lacus fermentum, praesent duis.',
+ 'Pellentesque amet et, tellus duis.',
+ 'Ipsum arcu vitae, justo elit, sed libero tellus.',
+ 'Metus rutrum euismod, vivamus sodales, vel arcu nisl.',
+ ],
+ },
+ ],
+ };
+}
diff --git a/polygerrit-ui/app/types/polymer-behaviors.js b/polygerrit-ui/app/types/polymer-behaviors.js
deleted file mode 100644
index 30b5f5d2d2..0000000000
--- a/polygerrit-ui/app/types/polymer-behaviors.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * @license
- * Copyright (C) 2019 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.
- */
-
-/**
- * For the purposes of template type checking, externs should be added for
- * anything set on the window object. Note that sub-properties of these
- * declared properties are considered something separate.
- *
- * This file is only for template type checking, not used in Gerrit code.
- */
-
-/* eslint-disable no-var */
-/* eslint-disable no-unused-vars */
-
-function PolymerMixins() {
- // This function must not be called.
- // Due to an issue in polymer linter the linter can't
- // process correctly some behaviors from Polymer library.
- // To workaround this issue, here we define a minimal mixin to allow
- // linter process our code correctly. You can add more properties to mixins
- // if needed.
-
- // Important! Use mixins from these file only inside JSDoc comments.
- // Do not use it in the real code
-
- /**
- * @polymer
- * @mixinFunction
- * */
- Polymer.IronFitMixin = base =>
- class extends base {
- static get properties() {
- return {
- positionTarget: Object,
- };
- }
- };
-
- /**
- * @polymerBehavior
- * */
- Polymer.IronA11yKeysBehavior = [];
-}