Merge "Revert "Deprecate ignored state and 'star:' queries.""
diff --git a/java/com/google/gerrit/lucene/LuceneGroupIndex.java b/java/com/google/gerrit/lucene/LuceneGroupIndex.java
index 223a73b..d475ab7 100644
--- a/java/com/google/gerrit/lucene/LuceneGroupIndex.java
+++ b/java/com/google/gerrit/lucene/LuceneGroupIndex.java
@@ -15,7 +15,7 @@
package com.google.gerrit.lucene;
import static com.google.common.collect.Iterables.getOnlyElement;
-import static com.google.gerrit.server.index.group.GroupField.UUID;
+import static com.google.gerrit.server.index.group.GroupField.UUID_FIELD_SPEC;
import com.google.common.collect.ImmutableSet;
import com.google.gerrit.entities.AccountGroup;
@@ -57,14 +57,14 @@
private static final String GROUPS = "groups";
- private static final String UUID_SORT_FIELD = sortFieldName(UUID);
+ private static final String UUID_SORT_FIELD = sortFieldName(UUID_FIELD_SPEC);
private static Term idTerm(InternalGroup group) {
return idTerm(group.getGroupUUID());
}
private static Term idTerm(AccountGroup.UUID uuid) {
- return QueryBuilder.stringTerm(UUID.getName(), uuid.get());
+ return QueryBuilder.stringTerm(UUID_FIELD_SPEC.getName(), uuid.get());
}
private final GerritIndexWriterConfig indexWriterConfig;
@@ -108,7 +108,7 @@
void add(Document doc, Values<InternalGroup> values) {
// Add separate DocValues field for the field that is needed for sorting.
SchemaField<InternalGroup, ?> f = values.getField();
- if (f == UUID) {
+ if (f == UUID_FIELD_SPEC) {
String value = (String) getOnlyElement(values.getValues());
doc.add(new SortedDocValuesField(UUID_SORT_FIELD, new BytesRef(value)));
}
@@ -153,7 +153,8 @@
@Override
protected InternalGroup fromDocument(Document doc) {
- AccountGroup.UUID uuid = AccountGroup.uuid(doc.getField(UUID.getName()).stringValue());
+ AccountGroup.UUID uuid =
+ AccountGroup.uuid(doc.getField(UUID_FIELD_SPEC.getName()).stringValue());
// Use the GroupCache rather than depending on any stored fields in the
// document (of which there shouldn't be any).
return groupCache.get().get(uuid).orElse(null);
diff --git a/java/com/google/gerrit/server/index/IndexUtils.java b/java/com/google/gerrit/server/index/IndexUtils.java
index 2add1ca..80cc463 100644
--- a/java/com/google/gerrit/server/index/IndexUtils.java
+++ b/java/com/google/gerrit/server/index/IndexUtils.java
@@ -94,9 +94,9 @@
*/
public static Set<String> groupFields(QueryOptions opts) {
Set<String> fs = opts.fields();
- return fs.contains(GroupField.UUID.getName())
+ return fs.contains(GroupField.UUID_FIELD_SPEC.getName())
? fs
- : Sets.union(fs, ImmutableSet.of(GroupField.UUID.getName()));
+ : Sets.union(fs, ImmutableSet.of(GroupField.UUID_FIELD_SPEC.getName()));
}
/** Returns a index-friendly representation of a {@link CurrentUser} to be used in queries. */
diff --git a/java/com/google/gerrit/server/index/group/GroupField.java b/java/com/google/gerrit/server/index/group/GroupField.java
index dd6aa3b..7a26f31 100644
--- a/java/com/google/gerrit/server/index/group/GroupField.java
+++ b/java/com/google/gerrit/server/index/group/GroupField.java
@@ -15,15 +15,12 @@
package com.google.gerrit.server.index.group;
import static com.google.common.collect.ImmutableList.toImmutableList;
-import static com.google.gerrit.index.FieldDef.exact;
-import static com.google.gerrit.index.FieldDef.storedOnly;
import com.google.common.base.MoreObjects;
import com.google.gerrit.entities.Account;
import com.google.gerrit.entities.AccountGroup;
import com.google.gerrit.entities.InternalGroup;
import com.google.gerrit.git.ObjectIds;
-import com.google.gerrit.index.FieldDef;
import com.google.gerrit.index.IndexedField;
import com.google.gerrit.index.SchemaUtil;
import java.sql.Timestamp;
@@ -44,8 +41,14 @@
ID_FIELD.integer("id");
/** Group UUID. */
- public static final FieldDef<InternalGroup, String> UUID =
- exact("uuid").stored().build(g -> g.getGroupUUID().get());
+ public static final IndexedField<InternalGroup, String> UUID_FIELD =
+ IndexedField.<InternalGroup>stringBuilder("UUID")
+ .required()
+ .stored()
+ .build(g -> g.getGroupUUID().get());
+
+ public static final IndexedField<InternalGroup, String>.SearchSpec UUID_FIELD_SPEC =
+ UUID_FIELD.exact("uuid");
/** Group owner UUID. */
public static final IndexedField<InternalGroup, String> OWNER_UUID_FIELD =
@@ -120,12 +123,17 @@
SUBGROUP_FIELD.exact("subgroup");
/** ObjectId of HEAD:refs/groups/<UUID>. */
- public static final FieldDef<InternalGroup, byte[]> REF_STATE =
- storedOnly("ref_state")
+ public static final IndexedField<InternalGroup, byte[]> REF_STATE_FIELD =
+ IndexedField.<InternalGroup>byteArrayBuilder("RefState")
+ .stored()
+ .required()
.build(
g -> {
byte[] a = new byte[ObjectIds.STR_LEN];
MoreObjects.firstNonNull(g.getRefState(), ObjectId.zeroId()).copyTo(a, 0);
return a;
});
+
+ public static final IndexedField<InternalGroup, byte[]>.SearchSpec REF_STATE_SPEC =
+ REF_STATE_FIELD.storedOnly("ref_state");
}
diff --git a/java/com/google/gerrit/server/index/group/GroupSchemaDefinitions.java b/java/com/google/gerrit/server/index/group/GroupSchemaDefinitions.java
index 6690102..26f9e96 100644
--- a/java/com/google/gerrit/server/index/group/GroupSchemaDefinitions.java
+++ b/java/com/google/gerrit/server/index/group/GroupSchemaDefinitions.java
@@ -33,7 +33,7 @@
static final Schema<InternalGroup> V5 =
schema(
/* version= */ 5,
- ImmutableList.of(GroupField.REF_STATE, GroupField.UUID),
+ ImmutableList.of(),
ImmutableList.of(
GroupField.CREATED_ON_FIELD,
GroupField.DESCRIPTION_FIELD,
@@ -43,7 +43,9 @@
GroupField.NAME_FIELD,
GroupField.NAME_PART_FIELD,
GroupField.OWNER_UUID_FIELD,
- GroupField.SUBGROUP_FIELD),
+ GroupField.REF_STATE_FIELD,
+ GroupField.SUBGROUP_FIELD,
+ GroupField.UUID_FIELD),
ImmutableList.<IndexedField<InternalGroup, ?>.SearchSpec>of(
GroupField.CREATED_ON_SPEC,
GroupField.DESCRIPTION_SPEC,
@@ -53,7 +55,9 @@
GroupField.NAME_SPEC,
GroupField.NAME_PART_SPEC,
GroupField.OWNER_UUID_SPEC,
- GroupField.SUBGROUP_SPEC));
+ GroupField.REF_STATE_SPEC,
+ GroupField.SUBGROUP_SPEC,
+ GroupField.UUID_FIELD_SPEC));
// Bump Lucene version requires reindexing
@Deprecated static final Schema<InternalGroup> V6 = schema(V5);
diff --git a/java/com/google/gerrit/server/index/group/IndexedGroupQuery.java b/java/com/google/gerrit/server/index/group/IndexedGroupQuery.java
index 90070b6..cacf919 100644
--- a/java/com/google/gerrit/server/index/group/IndexedGroupQuery.java
+++ b/java/com/google/gerrit/server/index/group/IndexedGroupQuery.java
@@ -36,9 +36,9 @@
public static QueryOptions createOptions(
IndexConfig config, int start, int limit, Set<String> fields) {
// Always include GroupField.UUID since it is needed to load the group from NoteDb.
- if (!fields.contains(GroupField.UUID.getName())) {
+ if (!fields.contains(GroupField.UUID_FIELD_SPEC.getName())) {
fields = new HashSet<>(fields);
- fields.add(GroupField.UUID.getName());
+ fields.add(GroupField.UUID_FIELD_SPEC.getName());
}
return QueryOptions.create(config, start, limit, fields);
}
diff --git a/java/com/google/gerrit/server/index/group/StalenessChecker.java b/java/com/google/gerrit/server/index/group/StalenessChecker.java
index 4ce3f5b..0bce282 100644
--- a/java/com/google/gerrit/server/index/group/StalenessChecker.java
+++ b/java/com/google/gerrit/server/index/group/StalenessChecker.java
@@ -39,7 +39,7 @@
@Singleton
public class StalenessChecker {
public static final ImmutableSet<String> FIELDS =
- ImmutableSet.of(GroupField.UUID.getName(), GroupField.REF_STATE.getName());
+ ImmutableSet.of(GroupField.UUID_FIELD_SPEC.getName(), GroupField.REF_STATE_SPEC.getName());
private final GroupIndexCollection indexes;
private final GitRepositoryManager repoManager;
@@ -84,7 +84,8 @@
try (Repository repo = repoManager.openRepository(allUsers)) {
Ref ref = repo.exactRef(RefNames.refsGroups(uuid));
ObjectId head = ref == null ? ObjectId.zeroId() : ref.getObjectId();
- ObjectId idFromIndex = ObjectId.fromString(result.get().getValue(GroupField.REF_STATE), 0);
+ ObjectId idFromIndex =
+ ObjectId.fromString(result.get().getValue(GroupField.REF_STATE_SPEC), 0);
if (head.equals(idFromIndex)) {
return StalenessCheckResult.notStale();
}
diff --git a/java/com/google/gerrit/server/query/group/GroupPredicates.java b/java/com/google/gerrit/server/query/group/GroupPredicates.java
index 8d935d6..e742cba 100644
--- a/java/com/google/gerrit/server/query/group/GroupPredicates.java
+++ b/java/com/google/gerrit/server/query/group/GroupPredicates.java
@@ -30,7 +30,7 @@
}
public static Predicate<InternalGroup> uuid(AccountGroup.UUID uuid) {
- return new GroupPredicate(GroupField.UUID, GroupQueryBuilder.FIELD_UUID, uuid.get());
+ return new GroupPredicate(GroupField.UUID_FIELD_SPEC, GroupQueryBuilder.FIELD_UUID, uuid.get());
}
public static Predicate<InternalGroup> description(String description) {
diff --git a/javatests/com/google/gerrit/server/query/group/AbstractQueryGroupsTest.java b/javatests/com/google/gerrit/server/query/group/AbstractQueryGroupsTest.java
index 094c52e..6c8e4d8 100644
--- a/javatests/com/google/gerrit/server/query/group/AbstractQueryGroupsTest.java
+++ b/javatests/com/google/gerrit/server/query/group/AbstractQueryGroupsTest.java
@@ -380,7 +380,7 @@
indexes.getSearchIndex().getSchema().getStoredFields()));
assertThat(rawFields).isPresent();
- assertThat(rawFields.get().getValue(GroupField.UUID)).isEqualTo(uuid.get());
+ assertThat(rawFields.get().getValue(GroupField.UUID_FIELD_SPEC)).isEqualTo(uuid.get());
}
@Test
diff --git a/plugins/replication b/plugins/replication
index 97bdaf5..f1aefa2 160000
--- a/plugins/replication
+++ b/plugins/replication
@@ -1 +1 @@
-Subproject commit 97bdaf577369a76e144be0dee5b158186be3a153
+Subproject commit f1aefa28f821699cc1ddd37bf0aa85177c775f17
diff --git a/polygerrit-ui/app/.eslintrc.js b/polygerrit-ui/app/.eslintrc.js
index d898377..7ff2596 100644
--- a/polygerrit-ui/app/.eslintrc.js
+++ b/polygerrit-ui/app/.eslintrc.js
@@ -385,7 +385,6 @@
a11ySuite: 'readonly',
assert: 'readonly',
expect: 'readonly',
- fixture: 'readonly',
flush: 'readonly',
setup: 'readonly',
sinon: 'readonly',
@@ -395,8 +394,6 @@
suiteTeardown: 'readonly',
teardown: 'readonly',
test: 'readonly',
- fixtureFromElement: 'readonly',
- fixtureFromTemplate: 'readonly',
},
},
{
diff --git a/polygerrit-ui/app/api/package.json b/polygerrit-ui/app/api/package.json
index 94195f8..79c8bb6 100644
--- a/polygerrit-ui/app/api/package.json
+++ b/polygerrit-ui/app/api/package.json
@@ -1,9 +1,9 @@
{
"name": "@gerritcodereview/typescript-api",
- "version": "3.6.0",
+ "version": "3.7.0",
"description": "Gerrit Code Review - TypeScript API",
"homepage": "https://www.gerritcodereview.com/",
"browser": true,
"dependencies": {},
"license": "Apache-2.0"
-}
\ No newline at end of file
+}
diff --git a/polygerrit-ui/app/constants/constants.ts b/polygerrit-ui/app/constants/constants.ts
index 355f06c..1394677 100644
--- a/polygerrit-ui/app/constants/constants.ts
+++ b/polygerrit-ui/app/constants/constants.ts
@@ -52,7 +52,7 @@
SERVICE_USER = 'SERVICE_USER',
}
-export enum PrimaryTab {
+export enum Tab {
FILES = 'files',
/**
* When renaming 'comments' or 'findings', UrlFormatter.java must be updated.
@@ -63,13 +63,6 @@
}
/**
- * Tab names for secondary tabs on change view page.
- */
-export enum SecondaryTab {
- CHANGE_LOG = '_changeLog',
-}
-
-/**
* Tag names of change log messages.
*/
export enum MessageTag {
diff --git a/polygerrit-ui/app/elements/admin/gr-access-section/gr-access-section.ts b/polygerrit-ui/app/elements/admin/gr-access-section/gr-access-section.ts
index cf22a6b..d5a83a7 100644
--- a/polygerrit-ui/app/elements/admin/gr-access-section/gr-access-section.ts
+++ b/polygerrit-ui/app/elements/admin/gr-access-section/gr-access-section.ts
@@ -357,6 +357,7 @@
if (!this.permissions) {
return;
}
+ delete this.section?.value.permissions[this.permissions[index].id];
this.permissions = this.permissions
.slice(0, index)
.concat(this.permissions.slice(index + 1, this.permissions.length));
diff --git a/polygerrit-ui/app/elements/admin/gr-access-section/gr-access-section_test.ts b/polygerrit-ui/app/elements/admin/gr-access-section/gr-access-section_test.ts
index b8cee66..1c6a013 100644
--- a/polygerrit-ui/app/elements/admin/gr-access-section/gr-access-section_test.ts
+++ b/polygerrit-ui/app/elements/admin/gr-access-section/gr-access-section_test.ts
@@ -13,7 +13,7 @@
import {GitRef} from '../../../types/common';
import {queryAndAssert} from '../../../utils/common-util';
import {GrButton} from '../../shared/gr-button/gr-button';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
suite('gr-access-section tests', () => {
let element: GrAccessSection;
@@ -71,102 +71,105 @@
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <fieldset class="gr-form-styles" id="section">
- <div id="mainContainer">
- <div class="header">
- <div class="name">
- <h3 class="heading-3">Reference: refs/*</h3>
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <fieldset class="gr-form-styles" id="section">
+ <div id="mainContainer">
+ <div class="header">
+ <div class="name">
+ <h3 class="heading-3">Reference: refs/*</h3>
+ <gr-button
+ aria-disabled="false"
+ id="editBtn"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ <gr-icon icon="edit" id="icon" small filled></gr-icon>
+ </gr-button>
+ </div>
+ <iron-input class="editRefInput">
+ <input class="editRefInput" type="text" />
+ </iron-input>
<gr-button
aria-disabled="false"
- id="editBtn"
+ id="deleteBtn"
link=""
role="button"
tabindex="0"
>
- <gr-icon icon="edit" id="icon" small filled></gr-icon>
+ Remove
</gr-button>
</div>
- <iron-input class="editRefInput">
- <input class="editRefInput" type="text" />
- </iron-input>
+ <div class="sectionContent">
+ <gr-permission> </gr-permission>
+ <div id="addPermission">
+ Add permission:
+ <select id="permissionSelect">
+ <option value="label-Code-Review">Label Code-Review</option>
+ <option value="labelAs-Code-Review">
+ Label Code-Review (On Behalf Of)
+ </option>
+ <option value="abandon">Abandon</option>
+ <option value="addPatchSet">Add Patch Set</option>
+ <option value="create">Create Reference</option>
+ <option value="createSignedTag">Create Signed Tag</option>
+ <option value="createTag">Create Annotated Tag</option>
+ <option value="delete">Delete Reference</option>
+ <option value="deleteChanges">Delete Changes</option>
+ <option value="deleteOwnChanges">Delete Own Changes</option>
+ <option value="editHashtags">Edit Hashtags</option>
+ <option value="editTopicName">Edit Topic Name</option>
+ <option value="forgeAuthor">Forge Author Identity</option>
+ <option value="forgeCommitter">
+ Forge Committer Identity
+ </option>
+ <option value="forgeServerAsCommitter">
+ Forge Server Identity
+ </option>
+ <option value="owner">Owner</option>
+ <option value="push">Push</option>
+ <option value="pushMerge">Push Merge Commit</option>
+ <option value="rebase">Rebase</option>
+ <option value="removeReviewer">Remove Reviewer</option>
+ <option value="revert">Revert</option>
+ <option value="submit">Submit</option>
+ <option value="submitAs">Submit (On Behalf Of)</option>
+ <option value="toggleWipState">
+ Toggle Work In Progress State
+ </option>
+ <option value="viewPrivateChanges">
+ View Private Changes
+ </option>
+ </select>
+ <gr-button
+ aria-disabled="false"
+ id="addBtn"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Add
+ </gr-button>
+ </div>
+ </div>
+ </div>
+ <div id="deletedContainer">
+ <span> Reference: refs/* was deleted </span>
<gr-button
aria-disabled="false"
- id="deleteBtn"
+ id="undoRemoveBtn"
link=""
role="button"
tabindex="0"
>
- Remove
+ Undo
</gr-button>
</div>
- <div class="sectionContent">
- <gr-permission> </gr-permission>
- <div id="addPermission">
- Add permission:
- <select id="permissionSelect">
- <option value="label-Code-Review">Label Code-Review</option>
- <option value="labelAs-Code-Review">
- Label Code-Review (On Behalf Of)
- </option>
- <option value="abandon">Abandon</option>
- <option value="addPatchSet">Add Patch Set</option>
- <option value="create">Create Reference</option>
- <option value="createSignedTag">Create Signed Tag</option>
- <option value="createTag">Create Annotated Tag</option>
- <option value="delete">Delete Reference</option>
- <option value="deleteChanges">Delete Changes</option>
- <option value="deleteOwnChanges">Delete Own Changes</option>
- <option value="editHashtags">Edit Hashtags</option>
- <option value="editTopicName">Edit Topic Name</option>
- <option value="forgeAuthor">Forge Author Identity</option>
- <option value="forgeCommitter">
- Forge Committer Identity
- </option>
- <option value="forgeServerAsCommitter">
- Forge Server Identity
- </option>
- <option value="owner">Owner</option>
- <option value="push">Push</option>
- <option value="pushMerge">Push Merge Commit</option>
- <option value="rebase">Rebase</option>
- <option value="removeReviewer">Remove Reviewer</option>
- <option value="revert">Revert</option>
- <option value="submit">Submit</option>
- <option value="submitAs">Submit (On Behalf Of)</option>
- <option value="toggleWipState">
- Toggle Work In Progress State
- </option>
- <option value="viewPrivateChanges">
- View Private Changes
- </option>
- </select>
- <gr-button
- aria-disabled="false"
- id="addBtn"
- link=""
- role="button"
- tabindex="0"
- >
- Add
- </gr-button>
- </div>
- </div>
- </div>
- <div id="deletedContainer">
- <span> Reference: refs/* was deleted </span>
- <gr-button
- aria-disabled="false"
- id="undoRemoveBtn"
- link=""
- role="button"
- tabindex="0"
- >
- Undo
- </gr-button>
- </div>
- </fieldset>
- `);
+ </fieldset>
+ `
+ );
});
test('updateSection', () => {
diff --git a/polygerrit-ui/app/elements/admin/gr-admin-group-list/gr-admin-group-list_test.ts b/polygerrit-ui/app/elements/admin/gr-admin-group-list/gr-admin-group-list_test.ts
index e792682..331c2c7 100644
--- a/polygerrit-ui/app/elements/admin/gr-admin-group-list/gr-admin-group-list_test.ts
+++ b/polygerrit-ui/app/elements/admin/gr-admin-group-list/gr-admin-group-list_test.ts
@@ -19,8 +19,7 @@
import {GrDialog} from '../../shared/gr-dialog/gr-dialog';
import {GrOverlay} from '../../shared/gr-overlay/gr-overlay';
import {SHOWN_ITEMS_COUNT} from '../../../constants/constants';
-
-const basicFixture = fixtureFromElement('gr-admin-group-list');
+import {fixture, html} from '@open-wc/testing';
function createGroup(name: string, counter: number) {
return {
@@ -60,50 +59,52 @@
const value: AppElementAdminParams = {view: GerritView.ADMIN, adminView: ''};
setup(async () => {
- element = basicFixture.instantiate();
- await element.updateComplete;
+ element = await fixture(html`<gr-admin-group-list></gr-admin-group-list>`);
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <gr-list-view>
- <table class="genericList" id="list">
- <tbody>
- <tr class="headerRow">
- <th class="name topHeader">Group Name</th>
- <th class="description topHeader">Group Description</th>
- <th class="topHeader visibleToAll">Visible To All</th>
- </tr>
- <tr class="loading loadingMsg" id="loading">
- <td>Loading...</td>
- </tr>
- </tbody>
- <tbody class="loading"></tbody>
- </table>
- </gr-list-view>
- <gr-overlay
- aria-hidden="true"
- id="createOverlay"
- style="outline: none; display: none;"
- tabindex="-1"
- with-backdrop=""
- >
- <gr-dialog
- class="confirmDialog"
- confirm-label="Create"
- confirm-on-enter=""
- disabled=""
- id="createDialog"
- role="dialog"
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <gr-list-view>
+ <table class="genericList" id="list">
+ <tbody>
+ <tr class="headerRow">
+ <th class="name topHeader">Group Name</th>
+ <th class="description topHeader">Group Description</th>
+ <th class="topHeader visibleToAll">Visible To All</th>
+ </tr>
+ <tr class="loading loadingMsg" id="loading">
+ <td>Loading...</td>
+ </tr>
+ </tbody>
+ <tbody class="loading"></tbody>
+ </table>
+ </gr-list-view>
+ <gr-overlay
+ aria-hidden="true"
+ id="createOverlay"
+ style="outline: none; display: none;"
+ tabindex="-1"
+ with-backdrop=""
>
- <div class="header" slot="header">Create Group</div>
- <div class="main" slot="main">
- <gr-create-group-dialog id="createNewModal">
- </gr-create-group-dialog>
- </div>
- </gr-dialog>
- </gr-overlay>
- `);
+ <gr-dialog
+ class="confirmDialog"
+ confirm-label="Create"
+ confirm-on-enter=""
+ disabled=""
+ id="createDialog"
+ role="dialog"
+ >
+ <div class="header" slot="header">Create Group</div>
+ <div class="main" slot="main">
+ <gr-create-group-dialog id="createNewModal">
+ </gr-create-group-dialog>
+ </div>
+ </gr-dialog>
+ </gr-overlay>
+ `
+ );
});
test('computeGroupUrl', () => {
diff --git a/polygerrit-ui/app/elements/admin/gr-admin-view/gr-admin-view_test.ts b/polygerrit-ui/app/elements/admin/gr-admin-view/gr-admin-view_test.ts
index c4fad42..158679c 100644
--- a/polygerrit-ui/app/elements/admin/gr-admin-view/gr-admin-view_test.ts
+++ b/polygerrit-ui/app/elements/admin/gr-admin-view/gr-admin-view_test.ts
@@ -8,15 +8,20 @@
import {AdminSubsectionLink, GrAdminView} from './gr-admin-view';
import {GerritNav} from '../../core/gr-navigation/gr-navigation';
import {getPluginLoader} from '../../shared/gr-js-api-interface/gr-plugin-loader';
-import {mockPromise, stubBaseUrl, stubRestApi} from '../../../test/test-utils';
+import {
+ mockPromise,
+ stubBaseUrl,
+ stubElement,
+ stubRestApi,
+} from '../../../test/test-utils';
import {GerritView} from '../../../services/router/router-model';
import {query, queryAll, queryAndAssert} from '../../../test/test-utils';
import {GrRepoList} from '../gr-repo-list/gr-repo-list';
import {GroupId, GroupName, RepoName, Timestamp} from '../../../types/common';
import {GrDropdownList} from '../../shared/gr-dropdown-list/gr-dropdown-list';
import {GrGroup} from '../gr-group/gr-group';
-
-const basicFixture = fixtureFromElement('gr-admin-view');
+import {GroupDetailView, RepoDetailView} from '../../../utils/router-util';
+import {fixture, html} from '@open-wc/testing';
function createAdminCapabilities() {
return {
@@ -30,7 +35,7 @@
let element: GrAdminView;
setup(async () => {
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-admin-view></gr-admin-view>`);
stubRestApi('getProjectConfig').returns(Promise.resolve(undefined));
const pluginsLoaded = Promise.resolve();
sinon.stub(getPluginLoader(), 'awaitPluginsLoaded').returns(pluginsLoaded);
@@ -312,8 +317,8 @@
element.repoName = 'my-repo' as RepoName;
element.params = {
repo: 'my-repo' as RepoName,
- view: GerritNav.View.REPO,
- detail: GerritNav.RepoDetailView.ACCESS,
+ view: GerritView.REPO,
+ detail: RepoDetailView.ACCESS,
};
stubRestApi('getAccountCapabilities').returns(
Promise.resolve(createAdminCapabilities())
@@ -341,36 +346,36 @@
name: 'General',
view: GerritView.REPO,
url: '',
- detailType: GerritNav.RepoDetailView.GENERAL,
+ detailType: RepoDetailView.GENERAL,
},
{
name: 'Access',
view: GerritView.REPO,
- detailType: GerritNav.RepoDetailView.ACCESS,
+ detailType: RepoDetailView.ACCESS,
url: '',
},
{
name: 'Commands',
view: GerritView.REPO,
- detailType: GerritNav.RepoDetailView.COMMANDS,
+ detailType: RepoDetailView.COMMANDS,
url: '',
},
{
name: 'Branches',
view: GerritView.REPO,
- detailType: GerritNav.RepoDetailView.BRANCHES,
+ detailType: RepoDetailView.BRANCHES,
url: '',
},
{
name: 'Tags',
view: GerritView.REPO,
- detailType: GerritNav.RepoDetailView.TAGS,
+ detailType: RepoDetailView.TAGS,
url: '',
},
{
name: 'Dashboards',
view: GerritView.REPO,
- detailType: GerritNav.RepoDetailView.DASHBOARDS,
+ detailType: RepoDetailView.DASHBOARDS,
url: '',
},
],
@@ -406,7 +411,7 @@
value: 'repogeneral',
view: GerritView.REPO,
url: '',
- detailType: GerritNav.RepoDetailView.GENERAL,
+ detailType: RepoDetailView.GENERAL,
parent: 'my-repo' as RepoName,
},
{
@@ -414,7 +419,7 @@
value: 'repoaccess',
view: GerritView.REPO,
url: '',
- detailType: GerritNav.RepoDetailView.ACCESS,
+ detailType: RepoDetailView.ACCESS,
parent: 'my-repo' as RepoName,
},
{
@@ -422,7 +427,7 @@
value: 'repocommands',
view: GerritView.REPO,
url: '',
- detailType: GerritNav.RepoDetailView.COMMANDS,
+ detailType: RepoDetailView.COMMANDS,
parent: 'my-repo' as RepoName,
},
{
@@ -430,7 +435,7 @@
value: 'repobranches',
view: GerritView.REPO,
url: '',
- detailType: GerritNav.RepoDetailView.BRANCHES,
+ detailType: RepoDetailView.BRANCHES,
parent: 'my-repo' as RepoName,
},
{
@@ -438,7 +443,7 @@
value: 'repotags',
view: GerritView.REPO,
url: '',
- detailType: GerritNav.RepoDetailView.TAGS,
+ detailType: RepoDetailView.TAGS,
parent: 'my-repo' as RepoName,
},
{
@@ -446,7 +451,7 @@
value: 'repodashboards',
view: GerritView.REPO,
url: '',
- detailType: GerritNav.RepoDetailView.DASHBOARDS,
+ detailType: RepoDetailView.DASHBOARDS,
parent: 'my-repo' as RepoName,
},
];
@@ -491,7 +496,7 @@
assert.isTrue(element.selectedIsCurrentPage(selected));
selected.parent = 'my-second-repo' as RepoName;
assert.isFalse(element.selectedIsCurrentPage(selected));
- selected.detailType = GerritNav.RepoDetailView.GENERAL;
+ selected.detailType = RepoDetailView.GENERAL;
assert.isFalse(element.selectedIsCurrentPage(selected));
});
@@ -510,51 +515,54 @@
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <gr-page-nav class="navStyles">
- <ul class="sectionContent">
- <li class="sectionTitle">
- <a
- class="title"
- href="//localhost:9876/admin/repos"
- rel="noopener"
- >
- Repositories
- </a>
- </li>
- <li class="sectionTitle">
- <a
- class="title"
- href="//localhost:9876/admin/groups"
- rel="noopener"
- >
- Groups
- </a>
- </li>
- <li class="sectionTitle">
- <a
- class="title"
- href="//localhost:9876/admin/plugins"
- rel="noopener"
- >
- Plugins
- </a>
- </li>
- </ul>
- </gr-page-nav>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <gr-page-nav class="navStyles">
+ <ul class="sectionContent">
+ <li class="sectionTitle">
+ <a
+ class="title"
+ href="//localhost:9876/admin/repos"
+ rel="noopener"
+ >
+ Repositories
+ </a>
+ </li>
+ <li class="sectionTitle">
+ <a
+ class="title"
+ href="//localhost:9876/admin/groups"
+ rel="noopener"
+ >
+ Groups
+ </a>
+ </li>
+ <li class="sectionTitle">
+ <a
+ class="title"
+ href="//localhost:9876/admin/plugins"
+ rel="noopener"
+ >
+ Plugins
+ </a>
+ </li>
+ </ul>
+ </gr-page-nav>
+ `
+ );
});
suite('repos', () => {
setup(() => {
- stub('gr-repo-access', '_repoChanged').callsFake(() =>
+ stubElement('gr-repo-access', '_repoChanged').callsFake(() =>
Promise.resolve()
);
});
test('repo list', async () => {
element.params = {
- view: GerritNav.View.ADMIN,
+ view: GerritView.ADMIN,
adminView: 'gr-repo-list',
openCreateModal: false,
};
@@ -566,7 +574,7 @@
test('repo', async () => {
element.params = {
- view: GerritNav.View.REPO,
+ view: GerritView.REPO,
repo: 'foo' as RepoName,
};
element.repoName = 'foo' as RepoName;
@@ -579,8 +587,8 @@
test('repo access', async () => {
element.params = {
- view: GerritNav.View.REPO,
- detail: GerritNav.RepoDetailView.ACCESS,
+ view: GerritView.REPO,
+ detail: RepoDetailView.ACCESS,
repo: 'foo' as RepoName,
};
element.repoName = 'foo' as RepoName;
@@ -593,8 +601,8 @@
test('repo dashboards', async () => {
element.params = {
- view: GerritNav.View.REPO,
- detail: GerritNav.RepoDetailView.DASHBOARDS,
+ view: GerritView.REPO,
+ detail: RepoDetailView.DASHBOARDS,
repo: 'foo' as RepoName,
};
element.repoName = 'foo' as RepoName;
@@ -610,8 +618,8 @@
let getGroupConfigStub: sinon.SinonStub;
setup(async () => {
- stub('gr-group', 'loadGroup').callsFake(() => Promise.resolve());
- stub('gr-group-members', 'loadGroupDetails').callsFake(() =>
+ stubElement('gr-group', 'loadGroup').callsFake(() => Promise.resolve());
+ stubElement('gr-group-members', 'loadGroupDetails').callsFake(() =>
Promise.resolve()
);
@@ -628,7 +636,7 @@
test('group list', async () => {
element.params = {
- view: GerritNav.View.ADMIN,
+ view: GerritView.ADMIN,
adminView: 'gr-admin-group-list',
openCreateModal: false,
};
@@ -640,7 +648,7 @@
test('internal group', async () => {
element.params = {
- view: GerritNav.View.GROUP,
+ view: GerritView.GROUP,
groupId: '1234' as GroupId,
};
element.groupName = 'foo' as GroupName;
@@ -665,7 +673,7 @@
})
);
element.params = {
- view: GerritNav.View.GROUP,
+ view: GerritView.GROUP,
groupId: '1234' as GroupId,
};
element.groupName = 'foo' as GroupName;
@@ -684,8 +692,8 @@
test('group members', async () => {
element.params = {
- view: GerritNav.View.GROUP,
- detail: GerritNav.GroupDetailView.MEMBERS,
+ view: GerritView.GROUP,
+ detail: GroupDetailView.MEMBERS,
groupId: '1234' as GroupId,
};
element.groupName = 'foo' as GroupName;
diff --git a/polygerrit-ui/app/elements/admin/gr-confirm-delete-item-dialog/gr-confirm-delete-item-dialog_test.ts b/polygerrit-ui/app/elements/admin/gr-confirm-delete-item-dialog/gr-confirm-delete-item-dialog_test.ts
index cb86a37..982e42a 100644
--- a/polygerrit-ui/app/elements/admin/gr-confirm-delete-item-dialog/gr-confirm-delete-item-dialog_test.ts
+++ b/polygerrit-ui/app/elements/admin/gr-confirm-delete-item-dialog/gr-confirm-delete-item-dialog_test.ts
@@ -8,33 +8,36 @@
import {GrConfirmDeleteItemDialog} from './gr-confirm-delete-item-dialog';
import {queryAndAssert} from '../../../test/test-utils';
import {GrDialog} from '../../shared/gr-dialog/gr-dialog';
-
-const basicFixture = fixtureFromElement('gr-confirm-delete-item-dialog');
+import {fixture, html} from '@open-wc/testing';
suite('gr-confirm-delete-item-dialog tests', () => {
let element: GrConfirmDeleteItemDialog;
setup(async () => {
- element = basicFixture.instantiate();
- await flush();
+ element = await fixture(
+ html`<gr-confirm-delete-item-dialog></gr-confirm-delete-item-dialog>`
+ );
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <gr-dialog
- confirm-label="Delete UNKNOWN ITEM TYPE"
- confirm-on-enter=""
- role="dialog"
- >
- <div class="header" slot="header">UNKNOWN ITEM TYPE Deletion</div>
- <div class="main" slot="main">
- <label for="branchInput">
- Do you really want to delete the following UNKNOWN ITEM TYPE?
- </label>
- <div>UNKNOWN ITEM</div>
- </div>
- </gr-dialog>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <gr-dialog
+ confirm-label="Delete UNKNOWN ITEM TYPE"
+ confirm-on-enter=""
+ role="dialog"
+ >
+ <div class="header" slot="header">UNKNOWN ITEM TYPE Deletion</div>
+ <div class="main" slot="main">
+ <label for="branchInput">
+ Do you really want to delete the following UNKNOWN ITEM TYPE?
+ </label>
+ <div>UNKNOWN ITEM</div>
+ </div>
+ </gr-dialog>
+ `
+ );
});
test('_handleConfirmTap', () => {
diff --git a/polygerrit-ui/app/elements/admin/gr-create-change-dialog/gr-create-change-dialog_test.ts b/polygerrit-ui/app/elements/admin/gr-create-change-dialog/gr-create-change-dialog_test.ts
index 5dfdf7a..b885279 100644
--- a/polygerrit-ui/app/elements/admin/gr-create-change-dialog/gr-create-change-dialog_test.ts
+++ b/polygerrit-ui/app/elements/admin/gr-create-change-dialog/gr-create-change-dialog_test.ts
@@ -11,8 +11,7 @@
import {createChange} from '../../../test/test-data-generators';
import {queryAndAssert, stubRestApi} from '../../../test/test-utils';
import {IronAutogrowTextareaElement} from '@polymer/iron-autogrow-textarea/iron-autogrow-textarea';
-
-const basicFixture = fixtureFromElement('gr-create-change-dialog');
+import {fixture, html} from '@open-wc/testing';
suite('gr-create-change-dialog tests', () => {
let element: GrCreateChangeDialog;
@@ -31,70 +30,77 @@
return Promise.resolve([]);
}
});
- element = basicFixture.instantiate();
- await element.updateComplete;
+ element = await fixture(
+ html`<gr-create-change-dialog></gr-create-change-dialog>`
+ );
element.repoName = 'test-repo' as RepoName;
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div class="gr-form-styles">
- <section>
- <span class="title"> Select branch for new change </span>
- <span class="value">
- <gr-autocomplete id="branchInput" placeholder="Destination branch">
- </gr-autocomplete>
- </span>
- </section>
- <section>
- <span class="title"> Provide base commit sha1 for change </span>
- <span class="value">
- <iron-input>
- <input
- id="baseCommitInput"
- maxlength="40"
- placeholder="(optional)"
- />
- </iron-input>
- </span>
- </section>
- <section>
- <span class="title"> Enter topic for new change </span>
- <span class="value">
- <iron-input>
- <input
- id="tagNameInput"
- maxlength="1024"
- placeholder="(optional)"
- />
- </iron-input>
- </span>
- </section>
- <section id="description">
- <span class="title"> Description </span>
- <span class="value">
- <iron-autogrow-textarea
- aria-disabled="false"
- autocomplete="on"
- class="message"
- id="messageInput"
- maxrows="15"
- placeholder="Insert the description of the change."
- rows="4"
- >
- </iron-autogrow-textarea>
- </span>
- </section>
- <section>
- <label class="title" for="privateChangeCheckBox">
- Private change
- </label>
- <span class="value">
- <input id="privateChangeCheckBox" type="checkbox" />
- </span>
- </section>
- </div>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div class="gr-form-styles">
+ <section>
+ <span class="title"> Select branch for new change </span>
+ <span class="value">
+ <gr-autocomplete
+ id="branchInput"
+ placeholder="Destination branch"
+ >
+ </gr-autocomplete>
+ </span>
+ </section>
+ <section>
+ <span class="title"> Provide base commit sha1 for change </span>
+ <span class="value">
+ <iron-input>
+ <input
+ id="baseCommitInput"
+ maxlength="40"
+ placeholder="(optional)"
+ />
+ </iron-input>
+ </span>
+ </section>
+ <section>
+ <span class="title"> Enter topic for new change </span>
+ <span class="value">
+ <iron-input>
+ <input
+ id="tagNameInput"
+ maxlength="1024"
+ placeholder="(optional)"
+ />
+ </iron-input>
+ </span>
+ </section>
+ <section id="description">
+ <span class="title"> Description </span>
+ <span class="value">
+ <iron-autogrow-textarea
+ aria-disabled="false"
+ autocomplete="on"
+ class="message"
+ id="messageInput"
+ maxrows="15"
+ placeholder="Insert the description of the change."
+ rows="4"
+ >
+ </iron-autogrow-textarea>
+ </span>
+ </section>
+ <section>
+ <label class="title" for="privateChangeCheckBox">
+ Private change
+ </label>
+ <span class="value">
+ <input id="privateChangeCheckBox" type="checkbox" />
+ </span>
+ </section>
+ </div>
+ `
+ );
});
test('new change created with default', async () => {
diff --git a/polygerrit-ui/app/elements/admin/gr-create-group-dialog/gr-create-group-dialog_test.ts b/polygerrit-ui/app/elements/admin/gr-create-group-dialog/gr-create-group-dialog_test.ts
index 11c63b8..e413d46 100644
--- a/polygerrit-ui/app/elements/admin/gr-create-group-dialog/gr-create-group-dialog_test.ts
+++ b/polygerrit-ui/app/elements/admin/gr-create-group-dialog/gr-create-group-dialog_test.ts
@@ -14,8 +14,7 @@
} from '../../../test/test-utils';
import {IronInputElement} from '@polymer/iron-input';
import {GroupId} from '../../../types/common';
-
-const basicFixture = fixtureFromElement('gr-create-group-dialog');
+import {fixture, html} from '@open-wc/testing';
suite('gr-create-group-dialog tests', () => {
let element: GrCreateGroupDialog;
@@ -23,23 +22,27 @@
const GROUP_NAME = 'test-group';
setup(async () => {
- element = basicFixture.instantiate();
- await element.updateComplete;
+ element = await fixture(
+ html`<gr-create-group-dialog></gr-create-group-dialog>`
+ );
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div class="gr-form-styles">
- <div id="form">
- <section>
- <span class="title"> Group name </span>
- <iron-input>
- <input />
- </iron-input>
- </section>
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div class="gr-form-styles">
+ <div id="form">
+ <section>
+ <span class="title"> Group name </span>
+ <iron-input>
+ <input />
+ </iron-input>
+ </section>
+ </div>
</div>
- </div>
- `);
+ `
+ );
});
test('name is updated correctly', async () => {
diff --git a/polygerrit-ui/app/elements/admin/gr-create-pointer-dialog/gr-create-pointer-dialog_test.ts b/polygerrit-ui/app/elements/admin/gr-create-pointer-dialog/gr-create-pointer-dialog_test.ts
index de29ad5..d1ddcaf 100644
--- a/polygerrit-ui/app/elements/admin/gr-create-pointer-dialog/gr-create-pointer-dialog_test.ts
+++ b/polygerrit-ui/app/elements/admin/gr-create-pointer-dialog/gr-create-pointer-dialog_test.ts
@@ -14,8 +14,7 @@
import {BranchName} from '../../../types/common';
import {IronInputElement} from '@polymer/iron-input';
import {RepoDetailView} from '../../../utils/router-util';
-
-const basicFixture = fixtureFromElement('gr-create-pointer-dialog');
+import {fixture, html} from '@open-wc/testing';
suite('gr-create-pointer-dialog tests', () => {
let element: GrCreatePointerDialog;
@@ -24,35 +23,39 @@
queryAndAssert<IronInputElement>(element, 'iron-input');
setup(async () => {
- element = basicFixture.instantiate();
- await element.updateComplete;
+ element = await fixture(
+ html`<gr-create-pointer-dialog></gr-create-pointer-dialog>`
+ );
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div class="gr-form-styles">
- <div id="form">
- <section id="itemNameSection">
- <span class="title"> name </span>
- <iron-input>
- <input placeholder=" Name" />
- </iron-input>
- </section>
- <section id="itemRevisionSection">
- <span class="title"> Initial Revision </span>
- <iron-input>
- <input placeholder="Revision (Branch or SHA-1)" />
- </iron-input>
- </section>
- <section id="itemAnnotationSection">
- <span class="title"> Annotation </span>
- <iron-input>
- <input placeholder="Annotation (Optional)" />
- </iron-input>
- </section>
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div class="gr-form-styles">
+ <div id="form">
+ <section id="itemNameSection">
+ <span class="title"> name </span>
+ <iron-input>
+ <input placeholder=" Name" />
+ </iron-input>
+ </section>
+ <section id="itemRevisionSection">
+ <span class="title"> Initial Revision </span>
+ <iron-input>
+ <input placeholder="Revision (Branch or SHA-1)" />
+ </iron-input>
+ </section>
+ <section id="itemAnnotationSection">
+ <span class="title"> Annotation </span>
+ <iron-input>
+ <input placeholder="Annotation (Optional)" />
+ </iron-input>
+ </section>
+ </div>
</div>
- </div>
- `);
+ `
+ );
});
test('branch created', async () => {
diff --git a/polygerrit-ui/app/elements/admin/gr-create-repo-dialog/gr-create-repo-dialog_test.ts b/polygerrit-ui/app/elements/admin/gr-create-repo-dialog/gr-create-repo-dialog_test.ts
index c2de839..aba71e3 100644
--- a/polygerrit-ui/app/elements/admin/gr-create-repo-dialog/gr-create-repo-dialog_test.ts
+++ b/polygerrit-ui/app/elements/admin/gr-create-repo-dialog/gr-create-repo-dialog_test.ts
@@ -14,72 +14,75 @@
import {BranchName, GroupId, RepoName} from '../../../types/common';
import {GrAutocomplete} from '../../shared/gr-autocomplete/gr-autocomplete';
import {GrSelect} from '../../shared/gr-select/gr-select';
-
-const basicFixture = fixtureFromElement('gr-create-repo-dialog');
+import {fixture, html} from '@open-wc/testing';
suite('gr-create-repo-dialog tests', () => {
let element: GrCreateRepoDialog;
setup(async () => {
- element = basicFixture.instantiate();
- await element.updateComplete;
+ element = await fixture(
+ html`<gr-create-repo-dialog></gr-create-repo-dialog>`
+ );
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div class="gr-form-styles">
- <div id="form">
- <section>
- <span class="title"> Repository name </span>
- <iron-input>
- <input autocomplete="on" id="repoNameInput" />
- </iron-input>
- </section>
- <section>
- <span class="title"> Default Branch </span>
- <iron-input>
- <input autocomplete="off" id="defaultBranchNameInput" />
- </iron-input>
- </section>
- <section>
- <span class="title"> Rights inherit from </span>
- <span class="value">
- <gr-autocomplete id="rightsInheritFromInput"> </gr-autocomplete>
- </span>
- </section>
- <section>
- <span class="title"> Owner </span>
- <span class="value">
- <gr-autocomplete id="ownerInput"> </gr-autocomplete>
- </span>
- </section>
- <section>
- <span class="title"> Create initial empty commit </span>
- <span class="value">
- <gr-select id="initialCommit">
- <select>
- <option value="false">False</option>
- <option value="true">True</option>
- </select>
- </gr-select>
- </span>
- </section>
- <section>
- <span class="title">
- Only serve as parent for other repositories
- </span>
- <span class="value">
- <gr-select id="parentRepo">
- <select>
- <option value="false">False</option>
- <option value="true">True</option>
- </select>
- </gr-select>
- </span>
- </section>
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div class="gr-form-styles">
+ <div id="form">
+ <section>
+ <span class="title"> Repository name </span>
+ <iron-input>
+ <input autocomplete="on" id="repoNameInput" />
+ </iron-input>
+ </section>
+ <section>
+ <span class="title"> Default Branch </span>
+ <iron-input>
+ <input autocomplete="off" id="defaultBranchNameInput" />
+ </iron-input>
+ </section>
+ <section>
+ <span class="title"> Rights inherit from </span>
+ <span class="value">
+ <gr-autocomplete id="rightsInheritFromInput"> </gr-autocomplete>
+ </span>
+ </section>
+ <section>
+ <span class="title"> Owner </span>
+ <span class="value">
+ <gr-autocomplete id="ownerInput"> </gr-autocomplete>
+ </span>
+ </section>
+ <section>
+ <span class="title"> Create initial empty commit </span>
+ <span class="value">
+ <gr-select id="initialCommit">
+ <select>
+ <option value="false">False</option>
+ <option value="true">True</option>
+ </select>
+ </gr-select>
+ </span>
+ </section>
+ <section>
+ <span class="title">
+ Only serve as parent for other repositories
+ </span>
+ <span class="value">
+ <gr-select id="parentRepo">
+ <select>
+ <option value="false">False</option>
+ <option value="true">True</option>
+ </select>
+ </gr-select>
+ </span>
+ </section>
+ </div>
</div>
- </div>
- `);
+ `
+ );
});
test('default values are populated', () => {
diff --git a/polygerrit-ui/app/elements/admin/gr-group-audit-log/gr-group-audit-log_test.ts b/polygerrit-ui/app/elements/admin/gr-group-audit-log/gr-group-audit-log_test.ts
index 9e32ebe..08b434b 100644
--- a/polygerrit-ui/app/elements/admin/gr-group-audit-log/gr-group-audit-log_test.ts
+++ b/polygerrit-ui/app/elements/admin/gr-group-audit-log/gr-group-audit-log_test.ts
@@ -23,33 +23,34 @@
createGroupInfo,
} from '../../../test/test-data-generators';
import {PageErrorEvent} from '../../../types/events';
-
-const basicFixture = fixtureFromElement('gr-group-audit-log');
+import {fixture, html} from '@open-wc/testing';
suite('gr-group-audit-log tests', () => {
let element: GrGroupAuditLog;
setup(async () => {
- element = basicFixture.instantiate();
- await element.updateComplete;
+ element = await fixture(html`<gr-group-audit-log></gr-group-audit-log>`);
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <table class="genericList" id="list">
- <tbody>
- <tr class="headerRow">
- <th class="date topHeader">Date</th>
- <th class="topHeader type">Type</th>
- <th class="member topHeader">Member</th>
- <th class="by-user topHeader">By User</th>
- </tr>
- <tr class="loading loadingMsg" id="loading">
- <td>Loading...</td>
- </tr>
- </tbody>
- </table>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <table class="genericList" id="list">
+ <tbody>
+ <tr class="headerRow">
+ <th class="date topHeader">Date</th>
+ <th class="topHeader type">Type</th>
+ <th class="member topHeader">Member</th>
+ <th class="by-user topHeader">By User</th>
+ </tr>
+ <tr class="loading loadingMsg" id="loading">
+ <td>Loading...</td>
+ </tr>
+ </tbody>
+ </table>
+ `
+ );
});
suite('members', () => {
diff --git a/polygerrit-ui/app/elements/admin/gr-group-members/gr-group-members_test.ts b/polygerrit-ui/app/elements/admin/gr-group-members/gr-group-members_test.ts
index c789168..bb28236 100644
--- a/polygerrit-ui/app/elements/admin/gr-group-members/gr-group-members_test.ts
+++ b/polygerrit-ui/app/elements/admin/gr-group-members/gr-group-members_test.ts
@@ -29,8 +29,7 @@
import {PageErrorEvent} from '../../../types/events.js';
import {getAccountSuggestions} from '../../../utils/account-util';
import {getAppContext} from '../../../services/app-context';
-
-const basicFixture = fixtureFromElement('gr-group-members');
+import {fixture, html} from '@open-wc/testing';
suite('gr-group-members tests', () => {
let element: GrGroupMembers;
@@ -138,8 +137,7 @@
stubRestApi('getGroupMembers').returns(Promise.resolve(groupMembers));
stubRestApi('getIsGroupOwner').returns(Promise.resolve(true));
stubRestApi('getIncludedGroup').returns(Promise.resolve(includedGroups));
- element = basicFixture.instantiate();
- await element.updateComplete;
+ element = await fixture(html`<gr-group-members></gr-group-members>`);
stubBaseUrl('https://test/site');
element.groupId = 'testId1' as GroupId;
groupStub = stubRestApi('getGroupConfig').returns(Promise.resolve(groups));
@@ -147,213 +145,218 @@
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div class="gr-form-styles main">
- <div id="loading">Loading...</div>
- <div id="loadedContent">
- <h1 class="heading-1" id="Title">Administrators</h1>
- <div id="form">
- <h3 class="heading-3" id="members">Members</h3>
- <fieldset>
- <span class="value">
- <gr-autocomplete
- id="groupMemberSearchInput"
- placeholder="Name Or Email"
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div class="gr-form-styles main">
+ <div id="loading">Loading...</div>
+ <div id="loadedContent">
+ <h1 class="heading-1" id="Title">Administrators</h1>
+ <div id="form">
+ <h3 class="heading-3" id="members">Members</h3>
+ <fieldset>
+ <span class="value">
+ <gr-autocomplete
+ id="groupMemberSearchInput"
+ placeholder="Name Or Email"
+ >
+ </gr-autocomplete>
+ </span>
+ <gr-button
+ aria-disabled="true"
+ disabled=""
+ id="saveGroupMember"
+ role="button"
+ tabindex="-1"
>
- </gr-autocomplete>
- </span>
- <gr-button
- aria-disabled="true"
- disabled=""
- id="saveGroupMember"
- role="button"
- tabindex="-1"
- >
- Add
- </gr-button>
- <table id="groupMembers">
- <tbody>
- <tr class="headerRow">
- <th class="nameHeader">Name</th>
- <th class="emailAddressHeader">Email Address</th>
- <th class="deleteHeader">Delete Member</th>
- </tr>
- </tbody>
- <tbody>
- <tr>
- <td class="nameColumn">
- <gr-account-label clickable="" deselected="">
- </gr-account-label>
- </td>
- <td>jane.roe@example.com</td>
- <td class="deleteColumn">
- <gr-button
- aria-disabled="false"
- class="deleteMembersButton"
- data-index="0"
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- <tr>
- <td class="nameColumn">
- <gr-account-label clickable="" deselected="">
- </gr-account-label>
- </td>
- <td>john.doe@example.com</td>
- <td class="deleteColumn">
- <gr-button
- aria-disabled="false"
- class="deleteMembersButton"
- data-index="1"
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- <tr>
- <td class="nameColumn">
- <gr-account-label clickable="" deselected="">
- </gr-account-label>
- </td>
- <td></td>
- <td class="deleteColumn">
- <gr-button
- aria-disabled="false"
- class="deleteMembersButton"
- data-index="2"
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- <tr>
- <td class="nameColumn">
- <gr-account-label clickable="" deselected="">
- </gr-account-label>
- </td>
- <td></td>
- <td class="deleteColumn">
- <gr-button
- aria-disabled="false"
- class="deleteMembersButton"
- data-index="3"
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- </tbody>
- </table>
- </fieldset>
- <h3 class="heading-3" id="includedGroups">Included Groups</h3>
- <fieldset>
- <span class="value">
- <gr-autocomplete
- id="includedGroupSearchInput"
- placeholder="Group Name"
+ Add
+ </gr-button>
+ <table id="groupMembers">
+ <tbody>
+ <tr class="headerRow">
+ <th class="nameHeader">Name</th>
+ <th class="emailAddressHeader">Email Address</th>
+ <th class="deleteHeader">Delete Member</th>
+ </tr>
+ </tbody>
+ <tbody>
+ <tr>
+ <td class="nameColumn">
+ <gr-account-label clickable="" deselected="">
+ </gr-account-label>
+ </td>
+ <td>jane.roe@example.com</td>
+ <td class="deleteColumn">
+ <gr-button
+ aria-disabled="false"
+ class="deleteMembersButton"
+ data-index="0"
+ role="button"
+ tabindex="0"
+ >
+ Delete
+ </gr-button>
+ </td>
+ </tr>
+ <tr>
+ <td class="nameColumn">
+ <gr-account-label clickable="" deselected="">
+ </gr-account-label>
+ </td>
+ <td>john.doe@example.com</td>
+ <td class="deleteColumn">
+ <gr-button
+ aria-disabled="false"
+ class="deleteMembersButton"
+ data-index="1"
+ role="button"
+ tabindex="0"
+ >
+ Delete
+ </gr-button>
+ </td>
+ </tr>
+ <tr>
+ <td class="nameColumn">
+ <gr-account-label clickable="" deselected="">
+ </gr-account-label>
+ </td>
+ <td></td>
+ <td class="deleteColumn">
+ <gr-button
+ aria-disabled="false"
+ class="deleteMembersButton"
+ data-index="2"
+ role="button"
+ tabindex="0"
+ >
+ Delete
+ </gr-button>
+ </td>
+ </tr>
+ <tr>
+ <td class="nameColumn">
+ <gr-account-label clickable="" deselected="">
+ </gr-account-label>
+ </td>
+ <td></td>
+ <td class="deleteColumn">
+ <gr-button
+ aria-disabled="false"
+ class="deleteMembersButton"
+ data-index="3"
+ role="button"
+ tabindex="0"
+ >
+ Delete
+ </gr-button>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </fieldset>
+ <h3 class="heading-3" id="includedGroups">Included Groups</h3>
+ <fieldset>
+ <span class="value">
+ <gr-autocomplete
+ id="includedGroupSearchInput"
+ placeholder="Group Name"
+ >
+ </gr-autocomplete>
+ </span>
+ <gr-button
+ aria-disabled="true"
+ disabled=""
+ id="saveIncludedGroups"
+ role="button"
+ tabindex="-1"
>
- </gr-autocomplete>
- </span>
- <gr-button
- aria-disabled="true"
- disabled=""
- id="saveIncludedGroups"
- role="button"
- tabindex="-1"
- >
- Add
- </gr-button>
- <table id="includedGroups">
- <tbody>
- <tr class="headerRow">
- <th class="groupNameHeader">Group Name</th>
- <th class="descriptionHeader">Description</th>
- <th class="deleteIncludedHeader">Delete Group</th>
- </tr>
- </tbody>
- <tbody>
- <tr>
- <td class="nameColumn">
- <a href="https://group/url" rel="noopener"> testName </a>
- </td>
- <td></td>
- <td class="deleteColumn">
- <gr-button
- aria-disabled="false"
- class="deleteIncludedGroupButton"
- data-index="0"
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- <tr>
- <td class="nameColumn">
- <a href="https://test/site/group/url" rel="noopener">
- testName2
- </a>
- </td>
- <td></td>
- <td class="deleteColumn">
- <gr-button
- aria-disabled="false"
- class="deleteIncludedGroupButton"
- data-index="1"
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- <tr>
- <td class="nameColumn">
- <a href="https://test/site/group/url" rel="noopener">
- testName3
- </a>
- </td>
- <td></td>
- <td class="deleteColumn">
- <gr-button
- aria-disabled="false"
- class="deleteIncludedGroupButton"
- data-index="2"
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- </tbody>
- </table>
- </fieldset>
+ Add
+ </gr-button>
+ <table id="includedGroups">
+ <tbody>
+ <tr class="headerRow">
+ <th class="groupNameHeader">Group Name</th>
+ <th class="descriptionHeader">Description</th>
+ <th class="deleteIncludedHeader">Delete Group</th>
+ </tr>
+ </tbody>
+ <tbody>
+ <tr>
+ <td class="nameColumn">
+ <a href="https://group/url" rel="noopener">
+ testName
+ </a>
+ </td>
+ <td></td>
+ <td class="deleteColumn">
+ <gr-button
+ aria-disabled="false"
+ class="deleteIncludedGroupButton"
+ data-index="0"
+ role="button"
+ tabindex="0"
+ >
+ Delete
+ </gr-button>
+ </td>
+ </tr>
+ <tr>
+ <td class="nameColumn">
+ <a href="https://test/site/group/url" rel="noopener">
+ testName2
+ </a>
+ </td>
+ <td></td>
+ <td class="deleteColumn">
+ <gr-button
+ aria-disabled="false"
+ class="deleteIncludedGroupButton"
+ data-index="1"
+ role="button"
+ tabindex="0"
+ >
+ Delete
+ </gr-button>
+ </td>
+ </tr>
+ <tr>
+ <td class="nameColumn">
+ <a href="https://test/site/group/url" rel="noopener">
+ testName3
+ </a>
+ </td>
+ <td></td>
+ <td class="deleteColumn">
+ <gr-button
+ aria-disabled="false"
+ class="deleteIncludedGroupButton"
+ data-index="2"
+ role="button"
+ tabindex="0"
+ >
+ Delete
+ </gr-button>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </fieldset>
+ </div>
</div>
</div>
- </div>
- <gr-overlay
- aria-hidden="true"
- id="overlay"
- style="outline: none; display: none;"
- tabindex="-1"
- with-backdrop=""
- >
- <gr-confirm-delete-item-dialog class="confirmDialog">
- </gr-confirm-delete-item-dialog>
- </gr-overlay>
- `);
+ <gr-overlay
+ aria-hidden="true"
+ id="overlay"
+ style="outline: none; display: none;"
+ tabindex="-1"
+ with-backdrop=""
+ >
+ <gr-confirm-delete-item-dialog class="confirmDialog">
+ </gr-confirm-delete-item-dialog>
+ </gr-overlay>
+ `
+ );
});
test('includedGroups', () => {
diff --git a/polygerrit-ui/app/elements/admin/gr-group/gr-group_test.ts b/polygerrit-ui/app/elements/admin/gr-group/gr-group_test.ts
index 9b74f60..a7bbaff 100644
--- a/polygerrit-ui/app/elements/admin/gr-group/gr-group_test.ts
+++ b/polygerrit-ui/app/elements/admin/gr-group/gr-group_test.ts
@@ -19,8 +19,7 @@
import {GrButton} from '../../shared/gr-button/gr-button';
import {GrCopyClipboard} from '../../shared/gr-copy-clipboard/gr-copy-clipboard';
import {GrSelect} from '../../shared/gr-select/gr-select';
-
-const basicFixture = fixtureFromElement('gr-group');
+import {fixture, html} from '@open-wc/testing';
suite('gr-group tests', () => {
let element: GrGroup;
@@ -40,114 +39,116 @@
};
setup(async () => {
- element = basicFixture.instantiate();
- await element.updateComplete;
+ element = await fixture(html`<gr-group></gr-group>`);
groupStub = stubRestApi('getGroupConfig').returns(Promise.resolve(group));
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div class="gr-form-styles main read-only">
- <div class="loading" id="loading">Loading...</div>
- <div class="loading" id="loadedContent">
- <h1 class="heading-1" id="Title"></h1>
- <h2 class="heading-2" id="configurations">General</h2>
- <div id="form">
- <fieldset>
- <h3 class="heading-3" id="groupUUID">Group UUID</h3>
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div class="gr-form-styles main read-only">
+ <div class="loading" id="loading">Loading...</div>
+ <div class="loading" id="loadedContent">
+ <h1 class="heading-1" id="Title"></h1>
+ <h2 class="heading-2" id="configurations">General</h2>
+ <div id="form">
<fieldset>
- <gr-copy-clipboard id="uuid"> </gr-copy-clipboard>
- </fieldset>
- <h3 class="heading-3" id="groupName">Group Name</h3>
- <fieldset>
- <span class="value">
- <gr-autocomplete disabled="" id="groupNameInput">
- </gr-autocomplete>
- </span>
- <span class="value">
- <gr-button
- aria-disabled="true"
- disabled=""
- id="inputUpdateNameBtn"
- role="button"
- tabindex="-1"
- >
- Rename Group
- </gr-button>
- </span>
- </fieldset>
- <h3 class="heading-3" id="groupOwner">Owners</h3>
- <fieldset>
- <span class="value">
- <gr-autocomplete disabled="" id="groupOwnerInput">
- </gr-autocomplete>
- </span>
- <span class="value">
- <gr-button
- aria-disabled="true"
- disabled=""
- id="inputUpdateOwnerBtn"
- role="button"
- tabindex="-1"
- >
- Change Owners
- </gr-button>
- </span>
- </fieldset>
- <h3 class="heading-3">Description</h3>
- <fieldset>
- <div>
- <gr-textarea
- autocomplete="on"
- class="description monospace"
- disabled=""
- monospace=""
- rows="4"
- >
- </gr-textarea>
- </div>
- <span class="value">
- <gr-button
- aria-disabled="true"
- disabled=""
- role="button"
- tabindex="-1"
- >
- Save Description
- </gr-button>
- </span>
- </fieldset>
- <h3 class="heading-3" id="options">Group Options</h3>
- <fieldset>
- <section>
- <span class="title">
- Make group visible to all registered users
+ <h3 class="heading-3" id="groupUUID">Group UUID</h3>
+ <fieldset>
+ <gr-copy-clipboard id="uuid"> </gr-copy-clipboard>
+ </fieldset>
+ <h3 class="heading-3" id="groupName">Group Name</h3>
+ <fieldset>
+ <span class="value">
+ <gr-autocomplete disabled="" id="groupNameInput">
+ </gr-autocomplete>
</span>
<span class="value">
- <gr-select id="visibleToAll">
- <select disabled="">
- <option value="false">False</option>
- <option value="true">True</option>
- </select>
- </gr-select>
+ <gr-button
+ aria-disabled="true"
+ disabled=""
+ id="inputUpdateNameBtn"
+ role="button"
+ tabindex="-1"
+ >
+ Rename Group
+ </gr-button>
</span>
- </section>
- <span class="value">
- <gr-button
- aria-disabled="true"
- disabled=""
- role="button"
- tabindex="-1"
- >
- Save Group Options
- </gr-button>
- </span>
+ </fieldset>
+ <h3 class="heading-3" id="groupOwner">Owners</h3>
+ <fieldset>
+ <span class="value">
+ <gr-autocomplete disabled="" id="groupOwnerInput">
+ </gr-autocomplete>
+ </span>
+ <span class="value">
+ <gr-button
+ aria-disabled="true"
+ disabled=""
+ id="inputUpdateOwnerBtn"
+ role="button"
+ tabindex="-1"
+ >
+ Change Owners
+ </gr-button>
+ </span>
+ </fieldset>
+ <h3 class="heading-3">Description</h3>
+ <fieldset>
+ <div>
+ <gr-textarea
+ autocomplete="on"
+ class="description monospace"
+ disabled=""
+ monospace=""
+ rows="4"
+ >
+ </gr-textarea>
+ </div>
+ <span class="value">
+ <gr-button
+ aria-disabled="true"
+ disabled=""
+ role="button"
+ tabindex="-1"
+ >
+ Save Description
+ </gr-button>
+ </span>
+ </fieldset>
+ <h3 class="heading-3" id="options">Group Options</h3>
+ <fieldset>
+ <section>
+ <span class="title">
+ Make group visible to all registered users
+ </span>
+ <span class="value">
+ <gr-select id="visibleToAll">
+ <select disabled="">
+ <option value="false">False</option>
+ <option value="true">True</option>
+ </select>
+ </gr-select>
+ </span>
+ </section>
+ <span class="value">
+ <gr-button
+ aria-disabled="true"
+ disabled=""
+ role="button"
+ tabindex="-1"
+ >
+ Save Group Options
+ </gr-button>
+ </span>
+ </fieldset>
</fieldset>
- </fieldset>
+ </div>
</div>
</div>
- </div>
- `);
+ `
+ );
});
test('loading displays before group config is loaded', () => {
diff --git a/polygerrit-ui/app/elements/admin/gr-permission/gr-permission_test.ts b/polygerrit-ui/app/elements/admin/gr-permission/gr-permission_test.ts
index 3e4e7a9..b60cb1b 100644
--- a/polygerrit-ui/app/elements/admin/gr-permission/gr-permission_test.ts
+++ b/polygerrit-ui/app/elements/admin/gr-permission/gr-permission_test.ts
@@ -17,14 +17,13 @@
import {queryAndAssert} from '../../../test/test-utils';
import {GrRuleEditor} from '../gr-rule-editor/gr-rule-editor';
import {GrButton} from '../../shared/gr-button/gr-button';
-
-const basicFixture = fixtureFromElement('gr-permission');
+import {fixture, html} from '@open-wc/testing';
suite('gr-permission tests', () => {
let element: GrPermission;
- setup(() => {
- element = basicFixture.instantiate();
+ setup(async () => {
+ element = await fixture(html`<gr-permission></gr-permission>`);
stubRestApi('getSuggestedGroups').returns(
Promise.resolve({
Administrators: {
@@ -318,58 +317,64 @@
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <section class="gr-form-styles" id="permission">
- <div id="mainContainer">
- <div class="header">
- <span class="title"> Priority </span>
- <div class="right">
- <paper-toggle-button
- aria-disabled="true"
- aria-pressed="false"
- disabled=""
- id="exclusiveToggle"
- role="button"
- style="pointer-events: none; touch-action: none;"
- tabindex="-1"
- toggles=""
- >
- </paper-toggle-button>
- Not Exclusive
- <gr-button
- aria-disabled="false"
- id="removeBtn"
- link=""
- role="button"
- tabindex="0"
- >
- Remove
- </gr-button>
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <section class="gr-form-styles" id="permission">
+ <div id="mainContainer">
+ <div class="header">
+ <span class="title"> Priority </span>
+ <div class="right">
+ <paper-toggle-button
+ aria-disabled="true"
+ aria-pressed="false"
+ disabled=""
+ id="exclusiveToggle"
+ role="button"
+ style="pointer-events: none; touch-action: none;"
+ tabindex="-1"
+ toggles=""
+ >
+ </paper-toggle-button>
+ Not Exclusive
+ <gr-button
+ aria-disabled="false"
+ id="removeBtn"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Remove
+ </gr-button>
+ </div>
+ </div>
+ <div class="rules">
+ <gr-rule-editor> </gr-rule-editor>
+ <gr-rule-editor> </gr-rule-editor>
+ <div id="addRule">
+ <gr-autocomplete
+ id="groupAutocomplete"
+ placeholder="Add group"
+ >
+ </gr-autocomplete>
+ </div>
</div>
</div>
- <div class="rules">
- <gr-rule-editor> </gr-rule-editor>
- <gr-rule-editor> </gr-rule-editor>
- <div id="addRule">
- <gr-autocomplete id="groupAutocomplete" placeholder="Add group">
- </gr-autocomplete>
- </div>
+ <div id="deletedContainer">
+ <span> Priority was deleted </span>
+ <gr-button
+ aria-disabled="false"
+ id="undoRemoveBtn"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Undo
+ </gr-button>
</div>
- </div>
- <div id="deletedContainer">
- <span> Priority was deleted </span>
- <gr-button
- aria-disabled="false"
- id="undoRemoveBtn"
- link=""
- role="button"
- tabindex="0"
- >
- Undo
- </gr-button>
- </div>
- </section>
- `);
+ </section>
+ `
+ );
});
test('adding a rule', async () => {
diff --git a/polygerrit-ui/app/elements/admin/gr-plugin-config-array-editor/gr-plugin-config-array-editor_test.ts b/polygerrit-ui/app/elements/admin/gr-plugin-config-array-editor/gr-plugin-config-array-editor_test.ts
index 4786aff..4db4774 100644
--- a/polygerrit-ui/app/elements/admin/gr-plugin-config-array-editor/gr-plugin-config-array-editor_test.ts
+++ b/polygerrit-ui/app/elements/admin/gr-plugin-config-array-editor/gr-plugin-config-array-editor_test.ts
@@ -10,7 +10,7 @@
import * as MockInteractions from '@polymer/iron-test-helpers/mock-interactions';
import {queryAll, queryAndAssert} from '../../../test/test-utils.js';
import {GrButton} from '../../shared/gr-button/gr-button.js';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
suite('gr-plugin-config-array-editor tests', () => {
let element: GrPluginConfigArrayEditor;
@@ -31,26 +31,29 @@
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div class="gr-form-styles wrapper">
- <div class="placeholder row">None configured.</div>
- <div class="row">
- <iron-input>
- <input id="input" />
- </iron-input>
- <gr-button
- aria-disabled="true"
- disabled=""
- id="addButton"
- link=""
- role="button"
- tabindex="-1"
- >
- Add
- </gr-button>
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div class="gr-form-styles wrapper">
+ <div class="placeholder row">None configured.</div>
+ <div class="row">
+ <iron-input>
+ <input id="input" />
+ </iron-input>
+ <gr-button
+ aria-disabled="true"
+ disabled=""
+ id="addButton"
+ link=""
+ role="button"
+ tabindex="-1"
+ >
+ Add
+ </gr-button>
+ </div>
</div>
- </div>
- `);
+ `
+ );
});
suite('adding', () => {
diff --git a/polygerrit-ui/app/elements/admin/gr-plugin-list/gr-plugin-list_test.ts b/polygerrit-ui/app/elements/admin/gr-plugin-list/gr-plugin-list_test.ts
index c2f53e1..7ac65f8 100644
--- a/polygerrit-ui/app/elements/admin/gr-plugin-list/gr-plugin-list_test.ts
+++ b/polygerrit-ui/app/elements/admin/gr-plugin-list/gr-plugin-list_test.ts
@@ -19,8 +19,7 @@
import {GerritView} from '../../../services/router/router-model';
import {PageErrorEvent} from '../../../types/events';
import {SHOWN_ITEMS_COUNT} from '../../../constants/constants';
-
-const basicFixture = fixtureFromElement('gr-plugin-list');
+import {fixture, html} from '@open-wc/testing';
function pluginGenerator(counter: number) {
const plugin: PluginInfo = {
@@ -63,8 +62,7 @@
const value: AppElementAdminParams = {view: GerritView.ADMIN, adminView: ''};
setup(async () => {
- element = basicFixture.instantiate();
- await element.updateComplete;
+ element = await fixture(html`<gr-plugin-list></gr-plugin-list>`);
});
suite('list with plugins', async () => {
@@ -77,222 +75,225 @@
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <gr-list-view>
- <table class="genericList" id="list">
- <tbody>
- <tr class="headerRow">
- <th class="name topHeader">Plugin Name</th>
- <th class="topHeader version">Version</th>
- <th class="apiVersion topHeader">API Version</th>
- <th class="status topHeader">Status</th>
- </tr>
- </tbody>
- <tbody>
- <tr class="table">
- <td class="name">
- <a href="/plugins/test0/"> test0 </a>
- </td>
- <td class="version">version-0</td>
- <td class="apiVersion">api-version-0</td>
- <td class="status">Enabled</td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/plugins/test1/"> test1 </a>
- </td>
- <td class="version">version-1</td>
- <td class="apiVersion">api-version-1</td>
- <td class="status">Enabled</td>
- </tr>
- <tr class="table">
- <td class="name">test2</td>
- <td class="version">version-2</td>
- <td class="apiVersion">api-version-2</td>
- <td class="status">Enabled</td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/plugins/test3/"> test3 </a>
- </td>
- <td class="version">version-3</td>
- <td class="apiVersion">api-version-3</td>
- <td class="status">Enabled</td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/plugins/test4/"> test4 </a>
- </td>
- <td class="version">version-4</td>
- <td class="apiVersion">
- <span class="placeholder"> -- </span>
- </td>
- <td class="status">Enabled</td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/plugins/test5/"> test5 </a>
- </td>
- <td class="version">version-5</td>
- <td class="apiVersion">api-version-5</td>
- <td class="status">Enabled</td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/plugins/test6/"> test6 </a>
- </td>
- <td class="version">version-6</td>
- <td class="apiVersion">api-version-6</td>
- <td class="status">Enabled</td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/plugins/test7/"> test7 </a>
- </td>
- <td class="version">version-7</td>
- <td class="apiVersion">api-version-7</td>
- <td class="status">Enabled</td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/plugins/test8/"> test8 </a>
- </td>
- <td class="version">version-8</td>
- <td class="apiVersion">api-version-8</td>
- <td class="status">Enabled</td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/plugins/test9/"> test9 </a>
- </td>
- <td class="version">version-9</td>
- <td class="apiVersion">api-version-9</td>
- <td class="status">Enabled</td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/plugins/test10/"> test10 </a>
- </td>
- <td class="version">version-10</td>
- <td class="apiVersion">api-version-10</td>
- <td class="status">Enabled</td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/plugins/test11/"> test11 </a>
- </td>
- <td class="version">version-11</td>
- <td class="apiVersion">api-version-11</td>
- <td class="status">Enabled</td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/plugins/test12/"> test12 </a>
- </td>
- <td class="version">version-12</td>
- <td class="apiVersion">api-version-12</td>
- <td class="status">Enabled</td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/plugins/test13/"> test13 </a>
- </td>
- <td class="version">version-13</td>
- <td class="apiVersion">api-version-13</td>
- <td class="status">Enabled</td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/plugins/test14/"> test14 </a>
- </td>
- <td class="version">version-14</td>
- <td class="apiVersion">api-version-14</td>
- <td class="status">Enabled</td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/plugins/test15/"> test15 </a>
- </td>
- <td class="version">version-15</td>
- <td class="apiVersion">api-version-15</td>
- <td class="status">Enabled</td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/plugins/test16/"> test16 </a>
- </td>
- <td class="version">version-16</td>
- <td class="apiVersion">api-version-16</td>
- <td class="status">Enabled</td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/plugins/test17/"> test17 </a>
- </td>
- <td class="version">version-17</td>
- <td class="apiVersion">api-version-17</td>
- <td class="status">Enabled</td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/plugins/test18/"> test18 </a>
- </td>
- <td class="version">version-18</td>
- <td class="apiVersion">api-version-18</td>
- <td class="status">Enabled</td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/plugins/test19/"> test19 </a>
- </td>
- <td class="version">version-19</td>
- <td class="apiVersion">api-version-19</td>
- <td class="status">Enabled</td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/plugins/test20/"> test20 </a>
- </td>
- <td class="version">version-20</td>
- <td class="apiVersion">api-version-20</td>
- <td class="status">Enabled</td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/plugins/test21/"> test21 </a>
- </td>
- <td class="version">version-21</td>
- <td class="apiVersion">api-version-21</td>
- <td class="status">Enabled</td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/plugins/test22/"> test22 </a>
- </td>
- <td class="version">version-22</td>
- <td class="apiVersion">api-version-22</td>
- <td class="status">Enabled</td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/plugins/test23/"> test23 </a>
- </td>
- <td class="version">version-23</td>
- <td class="apiVersion">api-version-23</td>
- <td class="status">Enabled</td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/plugins/test24/"> test24 </a>
- </td>
- <td class="version">version-24</td>
- <td class="apiVersion">api-version-24</td>
- <td class="status">Enabled</td>
- </tr>
- </tbody>
- </table>
- </gr-list-view>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <gr-list-view>
+ <table class="genericList" id="list">
+ <tbody>
+ <tr class="headerRow">
+ <th class="name topHeader">Plugin Name</th>
+ <th class="topHeader version">Version</th>
+ <th class="apiVersion topHeader">API Version</th>
+ <th class="status topHeader">Status</th>
+ </tr>
+ </tbody>
+ <tbody>
+ <tr class="table">
+ <td class="name">
+ <a href="/plugins/test0/"> test0 </a>
+ </td>
+ <td class="version">version-0</td>
+ <td class="apiVersion">api-version-0</td>
+ <td class="status">Enabled</td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/plugins/test1/"> test1 </a>
+ </td>
+ <td class="version">version-1</td>
+ <td class="apiVersion">api-version-1</td>
+ <td class="status">Enabled</td>
+ </tr>
+ <tr class="table">
+ <td class="name">test2</td>
+ <td class="version">version-2</td>
+ <td class="apiVersion">api-version-2</td>
+ <td class="status">Enabled</td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/plugins/test3/"> test3 </a>
+ </td>
+ <td class="version">version-3</td>
+ <td class="apiVersion">api-version-3</td>
+ <td class="status">Enabled</td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/plugins/test4/"> test4 </a>
+ </td>
+ <td class="version">version-4</td>
+ <td class="apiVersion">
+ <span class="placeholder"> -- </span>
+ </td>
+ <td class="status">Enabled</td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/plugins/test5/"> test5 </a>
+ </td>
+ <td class="version">version-5</td>
+ <td class="apiVersion">api-version-5</td>
+ <td class="status">Enabled</td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/plugins/test6/"> test6 </a>
+ </td>
+ <td class="version">version-6</td>
+ <td class="apiVersion">api-version-6</td>
+ <td class="status">Enabled</td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/plugins/test7/"> test7 </a>
+ </td>
+ <td class="version">version-7</td>
+ <td class="apiVersion">api-version-7</td>
+ <td class="status">Enabled</td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/plugins/test8/"> test8 </a>
+ </td>
+ <td class="version">version-8</td>
+ <td class="apiVersion">api-version-8</td>
+ <td class="status">Enabled</td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/plugins/test9/"> test9 </a>
+ </td>
+ <td class="version">version-9</td>
+ <td class="apiVersion">api-version-9</td>
+ <td class="status">Enabled</td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/plugins/test10/"> test10 </a>
+ </td>
+ <td class="version">version-10</td>
+ <td class="apiVersion">api-version-10</td>
+ <td class="status">Enabled</td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/plugins/test11/"> test11 </a>
+ </td>
+ <td class="version">version-11</td>
+ <td class="apiVersion">api-version-11</td>
+ <td class="status">Enabled</td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/plugins/test12/"> test12 </a>
+ </td>
+ <td class="version">version-12</td>
+ <td class="apiVersion">api-version-12</td>
+ <td class="status">Enabled</td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/plugins/test13/"> test13 </a>
+ </td>
+ <td class="version">version-13</td>
+ <td class="apiVersion">api-version-13</td>
+ <td class="status">Enabled</td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/plugins/test14/"> test14 </a>
+ </td>
+ <td class="version">version-14</td>
+ <td class="apiVersion">api-version-14</td>
+ <td class="status">Enabled</td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/plugins/test15/"> test15 </a>
+ </td>
+ <td class="version">version-15</td>
+ <td class="apiVersion">api-version-15</td>
+ <td class="status">Enabled</td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/plugins/test16/"> test16 </a>
+ </td>
+ <td class="version">version-16</td>
+ <td class="apiVersion">api-version-16</td>
+ <td class="status">Enabled</td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/plugins/test17/"> test17 </a>
+ </td>
+ <td class="version">version-17</td>
+ <td class="apiVersion">api-version-17</td>
+ <td class="status">Enabled</td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/plugins/test18/"> test18 </a>
+ </td>
+ <td class="version">version-18</td>
+ <td class="apiVersion">api-version-18</td>
+ <td class="status">Enabled</td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/plugins/test19/"> test19 </a>
+ </td>
+ <td class="version">version-19</td>
+ <td class="apiVersion">api-version-19</td>
+ <td class="status">Enabled</td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/plugins/test20/"> test20 </a>
+ </td>
+ <td class="version">version-20</td>
+ <td class="apiVersion">api-version-20</td>
+ <td class="status">Enabled</td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/plugins/test21/"> test21 </a>
+ </td>
+ <td class="version">version-21</td>
+ <td class="apiVersion">api-version-21</td>
+ <td class="status">Enabled</td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/plugins/test22/"> test22 </a>
+ </td>
+ <td class="version">version-22</td>
+ <td class="apiVersion">api-version-22</td>
+ <td class="status">Enabled</td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/plugins/test23/"> test23 </a>
+ </td>
+ <td class="version">version-23</td>
+ <td class="apiVersion">api-version-23</td>
+ <td class="status">Enabled</td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/plugins/test24/"> test24 </a>
+ </td>
+ <td class="version">version-24</td>
+ <td class="apiVersion">api-version-24</td>
+ <td class="status">Enabled</td>
+ </tr>
+ </tbody>
+ </table>
+ </gr-list-view>
+ `
+ );
});
test('plugin in the list is formatted correctly', async () => {
diff --git a/polygerrit-ui/app/elements/admin/gr-repo-access/gr-repo-access_test.ts b/polygerrit-ui/app/elements/admin/gr-repo-access/gr-repo-access_test.ts
index 62ed6da..7b5c3da 100644
--- a/polygerrit-ui/app/elements/admin/gr-repo-access/gr-repo-access_test.ts
+++ b/polygerrit-ui/app/elements/admin/gr-repo-access/gr-repo-access_test.ts
@@ -31,7 +31,7 @@
import {GrAccessSection} from '../gr-access-section/gr-access-section';
import {GrPermission} from '../gr-permission/gr-permission';
import {createChange} from '../../../test/test-data-generators';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
suite('gr-repo-access tests', () => {
let element: GrRepoAccess;
@@ -127,59 +127,62 @@
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div class="main">
- <div id="loading">Loading...</div>
- <div id="loadedContent">
- <h3 class="heading-3" id="inheritsFrom">
- <span class="rightsText"> Rights Inherit From </span>
- <a href="" id="inheritFromName" rel="noopener"> </a>
- <gr-autocomplete id="editInheritFromInput"> </gr-autocomplete>
- </h3>
- <div class="weblinks">History:</div>
- <div class="referenceContainer">
- <gr-button
- aria-disabled="false"
- id="addReferenceBtn"
- role="button"
- tabindex="0"
- >
- Add Reference
- </gr-button>
- </div>
- <div>
- <gr-button
- aria-disabled="false"
- id="editBtn"
- role="button"
- tabindex="0"
- >
- Edit
- </gr-button>
- <gr-button
- aria-disabled="false"
- class="invisible"
- id="saveBtn"
- primary=""
- role="button"
- tabindex="0"
- >
- Save
- </gr-button>
- <gr-button
- aria-disabled="false"
- class="invisible"
- id="saveReviewBtn"
- primary=""
- role="button"
- tabindex="0"
- >
- Save for review
- </gr-button>
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div class="main">
+ <div id="loading">Loading...</div>
+ <div id="loadedContent">
+ <h3 class="heading-3" id="inheritsFrom">
+ <span class="rightsText"> Rights Inherit From </span>
+ <a href="" id="inheritFromName" rel="noopener"> </a>
+ <gr-autocomplete id="editInheritFromInput"> </gr-autocomplete>
+ </h3>
+ <div class="weblinks">History:</div>
+ <div class="referenceContainer">
+ <gr-button
+ aria-disabled="false"
+ id="addReferenceBtn"
+ role="button"
+ tabindex="0"
+ >
+ Add Reference
+ </gr-button>
+ </div>
+ <div>
+ <gr-button
+ aria-disabled="false"
+ id="editBtn"
+ role="button"
+ tabindex="0"
+ >
+ Edit
+ </gr-button>
+ <gr-button
+ aria-disabled="false"
+ class="invisible"
+ id="saveBtn"
+ primary=""
+ role="button"
+ tabindex="0"
+ >
+ Save
+ </gr-button>
+ <gr-button
+ aria-disabled="false"
+ class="invisible"
+ id="saveReviewBtn"
+ primary=""
+ role="button"
+ tabindex="0"
+ >
+ Save for review
+ </gr-button>
+ </div>
</div>
</div>
- </div>
- `);
+ `
+ );
});
test('_repoChanged called when repo name changes', async () => {
diff --git a/polygerrit-ui/app/elements/admin/gr-repo-commands/gr-repo-commands_test.ts b/polygerrit-ui/app/elements/admin/gr-repo-commands/gr-repo-commands_test.ts
index 321ee06..539c610 100644
--- a/polygerrit-ui/app/elements/admin/gr-repo-commands/gr-repo-commands_test.ts
+++ b/polygerrit-ui/app/elements/admin/gr-repo-commands/gr-repo-commands_test.ts
@@ -19,16 +19,14 @@
import {PageErrorEvent} from '../../../types/events';
import {RepoName} from '../../../types/common';
import {GrButton} from '../../shared/gr-button/gr-button';
-
-const basicFixture = fixtureFromElement('gr-repo-commands');
+import {fixture, html} from '@open-wc/testing';
suite('gr-repo-commands tests', () => {
let element: GrRepoCommands;
let repoStub: sinon.SinonStub;
setup(async () => {
- element = basicFixture.instantiate();
- await element.updateComplete;
+ element = await fixture(html`<gr-repo-commands></gr-repo-commands>`);
// Note that this probably does not achieve what it is supposed to, because
// getProjectConfig() is called as soon as the element is attached, so
// stubbing it here has not effect anymore.
@@ -38,54 +36,57 @@
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div class="gr-form-styles main read-only">
- <h1 class="heading-1" id="Title">Repository Commands</h1>
- <div class="loading" id="loading">Loading...</div>
- <div class="loading" id="loadedContent">
- <h2 class="heading-2" id="options">Command</h2>
- <div id="form">
- <h3 class="heading-3">Create change</h3>
- <gr-button aria-disabled="false" role="button" tabindex="0">
- Create change
- </gr-button>
- <h3 class="heading-3">Edit repo config</h3>
- <gr-button
- aria-disabled="false"
- id="editRepoConfig"
- role="button"
- tabindex="0"
- >
- Edit repo config
- </gr-button>
- <gr-endpoint-decorator name="repo-command">
- <gr-endpoint-param name="config"> </gr-endpoint-param>
- <gr-endpoint-param name="repoName"> </gr-endpoint-param>
- </gr-endpoint-decorator>
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div class="gr-form-styles main read-only">
+ <h1 class="heading-1" id="Title">Repository Commands</h1>
+ <div class="loading" id="loading">Loading...</div>
+ <div class="loading" id="loadedContent">
+ <h2 class="heading-2" id="options">Command</h2>
+ <div id="form">
+ <h3 class="heading-3">Create change</h3>
+ <gr-button aria-disabled="false" role="button" tabindex="0">
+ Create change
+ </gr-button>
+ <h3 class="heading-3">Edit repo config</h3>
+ <gr-button
+ aria-disabled="false"
+ id="editRepoConfig"
+ role="button"
+ tabindex="0"
+ >
+ Edit repo config
+ </gr-button>
+ <gr-endpoint-decorator name="repo-command">
+ <gr-endpoint-param name="config"> </gr-endpoint-param>
+ <gr-endpoint-param name="repoName"> </gr-endpoint-param>
+ </gr-endpoint-decorator>
+ </div>
</div>
</div>
- </div>
- <gr-overlay
- aria-hidden="true"
- id="createChangeOverlay"
- style="outline: none; display: none;"
- tabindex="-1"
- with-backdrop=""
- >
- <gr-dialog
- confirm-label="Create"
- disabled=""
- id="createChangeDialog"
- role="dialog"
+ <gr-overlay
+ aria-hidden="true"
+ id="createChangeOverlay"
+ style="outline: none; display: none;"
+ tabindex="-1"
+ with-backdrop=""
>
- <div class="header" slot="header">Create Change</div>
- <div class="main" slot="main">
- <gr-create-change-dialog id="createNewChangeModal">
- </gr-create-change-dialog>
- </div>
- </gr-dialog>
- </gr-overlay>
- `);
+ <gr-dialog
+ confirm-label="Create"
+ disabled=""
+ id="createChangeDialog"
+ role="dialog"
+ >
+ <div class="header" slot="header">Create Change</div>
+ <div class="main" slot="main">
+ <gr-create-change-dialog id="createNewChangeModal">
+ </gr-create-change-dialog>
+ </div>
+ </gr-dialog>
+ </gr-overlay>
+ `
+ );
});
suite('create new change dialog', () => {
diff --git a/polygerrit-ui/app/elements/admin/gr-repo-dashboards/gr-repo-dashboards_test.ts b/polygerrit-ui/app/elements/admin/gr-repo-dashboards/gr-repo-dashboards_test.ts
index 0426c8f..4cd6ba5 100644
--- a/polygerrit-ui/app/elements/admin/gr-repo-dashboards/gr-repo-dashboards_test.ts
+++ b/polygerrit-ui/app/elements/admin/gr-repo-dashboards/gr-repo-dashboards_test.ts
@@ -15,15 +15,13 @@
} from '../../../test/test-utils';
import {DashboardId, DashboardInfo, RepoName} from '../../../types/common';
import {PageErrorEvent} from '../../../types/events.js';
-
-const basicFixture = fixtureFromElement('gr-repo-dashboards');
+import {fixture, html} from '@open-wc/testing';
suite('gr-repo-dashboards tests', () => {
let element: GrRepoDashboards;
setup(async () => {
- element = basicFixture.instantiate();
- await flush();
+ element = await fixture(html`<gr-repo-dashboards></gr-repo-dashboards>`);
});
suite('dashboard table', () => {
@@ -82,23 +80,26 @@
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <table class="genericList loading" id="list">
- <tbody>
- <tr class="headerRow">
- <th class="topHeader">Dashboard name</th>
- <th class="topHeader">Dashboard title</th>
- <th class="topHeader">Dashboard description</th>
- <th class="topHeader">Inherited from</th>
- <th class="topHeader">Default</th>
- </tr>
- <tr id="loadingContainer">
- <td>Loading...</td>
- </tr>
- </tbody>
- <tbody id="dashboards"></tbody>
- </table>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <table class="genericList loading" id="list">
+ <tbody>
+ <tr class="headerRow">
+ <th class="topHeader">Dashboard name</th>
+ <th class="topHeader">Dashboard title</th>
+ <th class="topHeader">Dashboard description</th>
+ <th class="topHeader">Inherited from</th>
+ <th class="topHeader">Default</th>
+ </tr>
+ <tr id="loadingContainer">
+ <td>Loading...</td>
+ </tr>
+ </tbody>
+ <tbody id="dashboards"></tbody>
+ </table>
+ `
+ );
});
test('loading, sections, and ordering', async () => {
diff --git a/polygerrit-ui/app/elements/admin/gr-repo-detail-list/gr-repo-detail-list_test.ts b/polygerrit-ui/app/elements/admin/gr-repo-detail-list/gr-repo-detail-list_test.ts
index 972b0d6..8cc4517 100644
--- a/polygerrit-ui/app/elements/admin/gr-repo-detail-list/gr-repo-detail-list_test.ts
+++ b/polygerrit-ui/app/elements/admin/gr-repo-detail-list/gr-repo-detail-list_test.ts
@@ -36,8 +36,7 @@
import {GrListView} from '../../shared/gr-list-view/gr-list-view';
import {SHOWN_ITEMS_COUNT} from '../../../constants/constants';
import {RepoDetailView} from '../../../utils/router-util';
-
-const basicFixture = fixtureFromElement('gr-repo-detail-list');
+import {fixture, html} from '@open-wc/testing';
function branchGenerator(counter: number) {
return {
@@ -95,8 +94,9 @@
let branches: BranchInfo[];
setup(async () => {
- element = basicFixture.instantiate();
- await element.updateComplete;
+ element = await fixture(
+ html`<gr-repo-detail-list></gr-repo-detail-list>`
+ );
element.detailType = RepoDetailView.BRANCHES;
sinon.stub(page, 'show');
});
@@ -121,1942 +121,1945 @@
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <gr-list-view>
- <table class="genericList gr-form-styles" id="list">
- <tbody>
- <tr class="headerRow">
- <th class="name topHeader">Name</th>
- <th class="revision topHeader">Revision</th>
- <th class="hideItem message topHeader">Message</th>
- <th class="hideItem tagger topHeader">Tagger</th>
- <th class="repositoryBrowser topHeader">
- Repository Browser
- </th>
- <th class="delete topHeader"></th>
- </tr>
- <tr class="loadingMsg" id="loading">
- <td>Loading...</td>
- </tr>
- </tbody>
- <tbody>
- <tr class="table">
- <td class="branches name">
- <a> HEAD </a>
- </td>
- <td class="branches revision">
- <span class="revisionNoEditing"> master </span>
- <span class="revisionEdit">
- <span class="revisionWithEditing"> master </span>
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <gr-list-view>
+ <table class="genericList gr-form-styles" id="list">
+ <tbody>
+ <tr class="headerRow">
+ <th class="name topHeader">Name</th>
+ <th class="revision topHeader">Revision</th>
+ <th class="hideItem message topHeader">Message</th>
+ <th class="hideItem tagger topHeader">Tagger</th>
+ <th class="repositoryBrowser topHeader">
+ Repository Browser
+ </th>
+ <th class="delete topHeader"></th>
+ </tr>
+ <tr class="loadingMsg" id="loading">
+ <td>Loading...</td>
+ </tr>
+ </tbody>
+ <tbody>
+ <tr class="table">
+ <td class="branches name">
+ <a> HEAD </a>
+ </td>
+ <td class="branches revision">
+ <span class="revisionNoEditing"> master </span>
+ <span class="revisionEdit">
+ <span class="revisionWithEditing"> master </span>
+ <gr-button
+ aria-disabled="false"
+ class="editBtn"
+ data-index="0"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ edit
+ </gr-button>
+ <iron-input class="editItem">
+ <input />
+ </iron-input>
+ <gr-button
+ aria-disabled="false"
+ class="cancelBtn editItem"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Cancel
+ </gr-button>
+ <gr-button
+ aria-disabled="true"
+ class="editItem saveBtn"
+ data-index="0"
+ disabled=""
+ link=""
+ role="button"
+ tabindex="-1"
+ >
+ Save
+ </gr-button>
+ </span>
+ </td>
+ <td class="hideItem message"></td>
+ <td class="hideItem tagger"></td>
+ <td class="repositoryBrowser"></td>
+ <td class="delete">
<gr-button
aria-disabled="false"
- class="editBtn"
+ class="deleteButton"
data-index="0"
link=""
role="button"
tabindex="0"
>
- edit
+ Delete
</gr-button>
- <iron-input class="editItem">
- <input />
- </iron-input>
- <gr-button
- aria-disabled="false"
- class="cancelBtn editItem"
- link=""
- role="button"
- tabindex="0"
+ </td>
+ </tr>
+ <tr class="table">
+ <td class="branches name">
+ <a
+ href="https://git.example.org/branch/test;refs/heads/test0"
>
- Cancel
- </gr-button>
- <gr-button
- aria-disabled="true"
- class="editItem saveBtn"
- data-index="0"
- disabled=""
- link=""
- role="button"
- tabindex="-1"
- >
- Save
- </gr-button>
- </span>
- </td>
- <td class="hideItem message"></td>
- <td class="hideItem tagger"></td>
- <td class="repositoryBrowser"></td>
- <td class="delete">
- <gr-button
- aria-disabled="false"
- class="deleteButton"
- data-index="0"
- link=""
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- <tr class="table">
- <td class="branches name">
- <a
- href="https://git.example.org/branch/test;refs/heads/test0"
- >
- test0
- </a>
- </td>
- <td class="branches revision">
- <span class="revisionNoEditing">
- 9c9d08a438e55e52f33b608415e6dddd9b18550d
- </span>
- <span class="revisionEdit">
- <span class="revisionWithEditing">
+ test0
+ </a>
+ </td>
+ <td class="branches revision">
+ <span class="revisionNoEditing">
9c9d08a438e55e52f33b608415e6dddd9b18550d
</span>
+ <span class="revisionEdit">
+ <span class="revisionWithEditing">
+ 9c9d08a438e55e52f33b608415e6dddd9b18550d
+ </span>
+ <gr-button
+ aria-disabled="false"
+ class="editBtn"
+ data-index="1"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ edit
+ </gr-button>
+ <iron-input class="editItem">
+ <input />
+ </iron-input>
+ <gr-button
+ aria-disabled="false"
+ class="cancelBtn editItem"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Cancel
+ </gr-button>
+ <gr-button
+ aria-disabled="true"
+ class="editItem saveBtn"
+ data-index="1"
+ disabled=""
+ link=""
+ role="button"
+ tabindex="-1"
+ >
+ Save
+ </gr-button>
+ </span>
+ </td>
+ <td class="hideItem message"></td>
+ <td class="hideItem tagger"></td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://git.example.org/branch/test;refs/heads/test0"
+ rel="noopener"
+ target="_blank"
+ >
+ (diffusion)
+ </a>
+ </td>
+ <td class="delete">
<gr-button
aria-disabled="false"
- class="editBtn"
+ class="deleteButton"
data-index="1"
link=""
role="button"
tabindex="0"
>
- edit
+ Delete
</gr-button>
- <iron-input class="editItem">
- <input />
- </iron-input>
- <gr-button
- aria-disabled="false"
- class="cancelBtn editItem"
- link=""
- role="button"
- tabindex="0"
+ </td>
+ </tr>
+ <tr class="table">
+ <td class="branches name">
+ <a
+ href="https://git.example.org/branch/test;refs/heads/test1"
>
- Cancel
- </gr-button>
- <gr-button
- aria-disabled="true"
- class="editItem saveBtn"
- data-index="1"
- disabled=""
- link=""
- role="button"
- tabindex="-1"
- >
- Save
- </gr-button>
- </span>
- </td>
- <td class="hideItem message"></td>
- <td class="hideItem tagger"></td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://git.example.org/branch/test;refs/heads/test0"
- rel="noopener"
- target="_blank"
- >
- (diffusion)
- </a>
- </td>
- <td class="delete">
- <gr-button
- aria-disabled="false"
- class="deleteButton"
- data-index="1"
- link=""
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- <tr class="table">
- <td class="branches name">
- <a
- href="https://git.example.org/branch/test;refs/heads/test1"
- >
- test1
- </a>
- </td>
- <td class="branches revision">
- <span class="revisionNoEditing">
- 9c9d08a438e55e52f33b608415e6dddd9b18550d
- </span>
- <span class="revisionEdit">
- <span class="revisionWithEditing">
+ test1
+ </a>
+ </td>
+ <td class="branches revision">
+ <span class="revisionNoEditing">
9c9d08a438e55e52f33b608415e6dddd9b18550d
</span>
+ <span class="revisionEdit">
+ <span class="revisionWithEditing">
+ 9c9d08a438e55e52f33b608415e6dddd9b18550d
+ </span>
+ <gr-button
+ aria-disabled="false"
+ class="editBtn"
+ data-index="2"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ edit
+ </gr-button>
+ <iron-input class="editItem">
+ <input />
+ </iron-input>
+ <gr-button
+ aria-disabled="false"
+ class="cancelBtn editItem"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Cancel
+ </gr-button>
+ <gr-button
+ aria-disabled="true"
+ class="editItem saveBtn"
+ data-index="2"
+ disabled=""
+ link=""
+ role="button"
+ tabindex="-1"
+ >
+ Save
+ </gr-button>
+ </span>
+ </td>
+ <td class="hideItem message"></td>
+ <td class="hideItem tagger"></td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://git.example.org/branch/test;refs/heads/test1"
+ rel="noopener"
+ target="_blank"
+ >
+ (diffusion)
+ </a>
+ </td>
+ <td class="delete">
<gr-button
aria-disabled="false"
- class="editBtn"
+ class="deleteButton"
data-index="2"
link=""
role="button"
tabindex="0"
>
- edit
+ Delete
</gr-button>
- <iron-input class="editItem">
- <input />
- </iron-input>
- <gr-button
- aria-disabled="false"
- class="cancelBtn editItem"
- link=""
- role="button"
- tabindex="0"
+ </td>
+ </tr>
+ <tr class="table">
+ <td class="branches name">
+ <a
+ href="https://git.example.org/branch/test;refs/heads/test2"
>
- Cancel
- </gr-button>
- <gr-button
- aria-disabled="true"
- class="editItem saveBtn"
- data-index="2"
- disabled=""
- link=""
- role="button"
- tabindex="-1"
- >
- Save
- </gr-button>
- </span>
- </td>
- <td class="hideItem message"></td>
- <td class="hideItem tagger"></td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://git.example.org/branch/test;refs/heads/test1"
- rel="noopener"
- target="_blank"
- >
- (diffusion)
- </a>
- </td>
- <td class="delete">
- <gr-button
- aria-disabled="false"
- class="deleteButton"
- data-index="2"
- link=""
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- <tr class="table">
- <td class="branches name">
- <a
- href="https://git.example.org/branch/test;refs/heads/test2"
- >
- test2
- </a>
- </td>
- <td class="branches revision">
- <span class="revisionNoEditing">
- 9c9d08a438e55e52f33b608415e6dddd9b18550d
- </span>
- <span class="revisionEdit">
- <span class="revisionWithEditing">
+ test2
+ </a>
+ </td>
+ <td class="branches revision">
+ <span class="revisionNoEditing">
9c9d08a438e55e52f33b608415e6dddd9b18550d
</span>
+ <span class="revisionEdit">
+ <span class="revisionWithEditing">
+ 9c9d08a438e55e52f33b608415e6dddd9b18550d
+ </span>
+ <gr-button
+ aria-disabled="false"
+ class="editBtn"
+ data-index="3"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ edit
+ </gr-button>
+ <iron-input class="editItem">
+ <input />
+ </iron-input>
+ <gr-button
+ aria-disabled="false"
+ class="cancelBtn editItem"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Cancel
+ </gr-button>
+ <gr-button
+ aria-disabled="true"
+ class="editItem saveBtn"
+ data-index="3"
+ disabled=""
+ link=""
+ role="button"
+ tabindex="-1"
+ >
+ Save
+ </gr-button>
+ </span>
+ </td>
+ <td class="hideItem message"></td>
+ <td class="hideItem tagger"></td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://git.example.org/branch/test;refs/heads/test2"
+ rel="noopener"
+ target="_blank"
+ >
+ (diffusion)
+ </a>
+ </td>
+ <td class="delete">
<gr-button
aria-disabled="false"
- class="editBtn"
+ class="deleteButton"
data-index="3"
link=""
role="button"
tabindex="0"
>
- edit
+ Delete
</gr-button>
- <iron-input class="editItem">
- <input />
- </iron-input>
- <gr-button
- aria-disabled="false"
- class="cancelBtn editItem"
- link=""
- role="button"
- tabindex="0"
+ </td>
+ </tr>
+ <tr class="table">
+ <td class="branches name">
+ <a
+ href="https://git.example.org/branch/test;refs/heads/test3"
>
- Cancel
- </gr-button>
- <gr-button
- aria-disabled="true"
- class="editItem saveBtn"
- data-index="3"
- disabled=""
- link=""
- role="button"
- tabindex="-1"
- >
- Save
- </gr-button>
- </span>
- </td>
- <td class="hideItem message"></td>
- <td class="hideItem tagger"></td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://git.example.org/branch/test;refs/heads/test2"
- rel="noopener"
- target="_blank"
- >
- (diffusion)
- </a>
- </td>
- <td class="delete">
- <gr-button
- aria-disabled="false"
- class="deleteButton"
- data-index="3"
- link=""
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- <tr class="table">
- <td class="branches name">
- <a
- href="https://git.example.org/branch/test;refs/heads/test3"
- >
- test3
- </a>
- </td>
- <td class="branches revision">
- <span class="revisionNoEditing">
- 9c9d08a438e55e52f33b608415e6dddd9b18550d
- </span>
- <span class="revisionEdit">
- <span class="revisionWithEditing">
+ test3
+ </a>
+ </td>
+ <td class="branches revision">
+ <span class="revisionNoEditing">
9c9d08a438e55e52f33b608415e6dddd9b18550d
</span>
+ <span class="revisionEdit">
+ <span class="revisionWithEditing">
+ 9c9d08a438e55e52f33b608415e6dddd9b18550d
+ </span>
+ <gr-button
+ aria-disabled="false"
+ class="editBtn"
+ data-index="4"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ edit
+ </gr-button>
+ <iron-input class="editItem">
+ <input />
+ </iron-input>
+ <gr-button
+ aria-disabled="false"
+ class="cancelBtn editItem"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Cancel
+ </gr-button>
+ <gr-button
+ aria-disabled="true"
+ class="editItem saveBtn"
+ data-index="4"
+ disabled=""
+ link=""
+ role="button"
+ tabindex="-1"
+ >
+ Save
+ </gr-button>
+ </span>
+ </td>
+ <td class="hideItem message"></td>
+ <td class="hideItem tagger"></td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://git.example.org/branch/test;refs/heads/test3"
+ rel="noopener"
+ target="_blank"
+ >
+ (diffusion)
+ </a>
+ </td>
+ <td class="delete">
<gr-button
aria-disabled="false"
- class="editBtn"
+ class="deleteButton"
data-index="4"
link=""
role="button"
tabindex="0"
>
- edit
+ Delete
</gr-button>
- <iron-input class="editItem">
- <input />
- </iron-input>
- <gr-button
- aria-disabled="false"
- class="cancelBtn editItem"
- link=""
- role="button"
- tabindex="0"
+ </td>
+ </tr>
+ <tr class="table">
+ <td class="branches name">
+ <a
+ href="https://git.example.org/branch/test;refs/heads/test4"
>
- Cancel
- </gr-button>
- <gr-button
- aria-disabled="true"
- class="editItem saveBtn"
- data-index="4"
- disabled=""
- link=""
- role="button"
- tabindex="-1"
- >
- Save
- </gr-button>
- </span>
- </td>
- <td class="hideItem message"></td>
- <td class="hideItem tagger"></td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://git.example.org/branch/test;refs/heads/test3"
- rel="noopener"
- target="_blank"
- >
- (diffusion)
- </a>
- </td>
- <td class="delete">
- <gr-button
- aria-disabled="false"
- class="deleteButton"
- data-index="4"
- link=""
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- <tr class="table">
- <td class="branches name">
- <a
- href="https://git.example.org/branch/test;refs/heads/test4"
- >
- test4
- </a>
- </td>
- <td class="branches revision">
- <span class="revisionNoEditing">
- 9c9d08a438e55e52f33b608415e6dddd9b18550d
- </span>
- <span class="revisionEdit">
- <span class="revisionWithEditing">
+ test4
+ </a>
+ </td>
+ <td class="branches revision">
+ <span class="revisionNoEditing">
9c9d08a438e55e52f33b608415e6dddd9b18550d
</span>
+ <span class="revisionEdit">
+ <span class="revisionWithEditing">
+ 9c9d08a438e55e52f33b608415e6dddd9b18550d
+ </span>
+ <gr-button
+ aria-disabled="false"
+ class="editBtn"
+ data-index="5"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ edit
+ </gr-button>
+ <iron-input class="editItem">
+ <input />
+ </iron-input>
+ <gr-button
+ aria-disabled="false"
+ class="cancelBtn editItem"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Cancel
+ </gr-button>
+ <gr-button
+ aria-disabled="true"
+ class="editItem saveBtn"
+ data-index="5"
+ disabled=""
+ link=""
+ role="button"
+ tabindex="-1"
+ >
+ Save
+ </gr-button>
+ </span>
+ </td>
+ <td class="hideItem message"></td>
+ <td class="hideItem tagger"></td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://git.example.org/branch/test;refs/heads/test4"
+ rel="noopener"
+ target="_blank"
+ >
+ (diffusion)
+ </a>
+ </td>
+ <td class="delete">
<gr-button
aria-disabled="false"
- class="editBtn"
+ class="deleteButton"
data-index="5"
link=""
role="button"
tabindex="0"
>
- edit
+ Delete
</gr-button>
- <iron-input class="editItem">
- <input />
- </iron-input>
- <gr-button
- aria-disabled="false"
- class="cancelBtn editItem"
- link=""
- role="button"
- tabindex="0"
+ </td>
+ </tr>
+ <tr class="table">
+ <td class="branches name">
+ <a
+ href="https://git.example.org/branch/test;refs/heads/test5"
>
- Cancel
- </gr-button>
- <gr-button
- aria-disabled="true"
- class="editItem saveBtn"
- data-index="5"
- disabled=""
- link=""
- role="button"
- tabindex="-1"
- >
- Save
- </gr-button>
- </span>
- </td>
- <td class="hideItem message"></td>
- <td class="hideItem tagger"></td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://git.example.org/branch/test;refs/heads/test4"
- rel="noopener"
- target="_blank"
- >
- (diffusion)
- </a>
- </td>
- <td class="delete">
- <gr-button
- aria-disabled="false"
- class="deleteButton"
- data-index="5"
- link=""
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- <tr class="table">
- <td class="branches name">
- <a
- href="https://git.example.org/branch/test;refs/heads/test5"
- >
- test5
- </a>
- </td>
- <td class="branches revision">
- <span class="revisionNoEditing">
- 9c9d08a438e55e52f33b608415e6dddd9b18550d
- </span>
- <span class="revisionEdit">
- <span class="revisionWithEditing">
+ test5
+ </a>
+ </td>
+ <td class="branches revision">
+ <span class="revisionNoEditing">
9c9d08a438e55e52f33b608415e6dddd9b18550d
</span>
+ <span class="revisionEdit">
+ <span class="revisionWithEditing">
+ 9c9d08a438e55e52f33b608415e6dddd9b18550d
+ </span>
+ <gr-button
+ aria-disabled="false"
+ class="editBtn"
+ data-index="6"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ edit
+ </gr-button>
+ <iron-input class="editItem">
+ <input />
+ </iron-input>
+ <gr-button
+ aria-disabled="false"
+ class="cancelBtn editItem"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Cancel
+ </gr-button>
+ <gr-button
+ aria-disabled="true"
+ class="editItem saveBtn"
+ data-index="6"
+ disabled=""
+ link=""
+ role="button"
+ tabindex="-1"
+ >
+ Save
+ </gr-button>
+ </span>
+ </td>
+ <td class="hideItem message"></td>
+ <td class="hideItem tagger"></td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://git.example.org/branch/test;refs/heads/test5"
+ rel="noopener"
+ target="_blank"
+ >
+ (diffusion)
+ </a>
+ </td>
+ <td class="delete">
<gr-button
aria-disabled="false"
- class="editBtn"
+ class="deleteButton"
data-index="6"
link=""
role="button"
tabindex="0"
>
- edit
+ Delete
</gr-button>
- <iron-input class="editItem">
- <input />
- </iron-input>
- <gr-button
- aria-disabled="false"
- class="cancelBtn editItem"
- link=""
- role="button"
- tabindex="0"
+ </td>
+ </tr>
+ <tr class="table">
+ <td class="branches name">
+ <a
+ href="https://git.example.org/branch/test;refs/heads/test6"
>
- Cancel
- </gr-button>
- <gr-button
- aria-disabled="true"
- class="editItem saveBtn"
- data-index="6"
- disabled=""
- link=""
- role="button"
- tabindex="-1"
- >
- Save
- </gr-button>
- </span>
- </td>
- <td class="hideItem message"></td>
- <td class="hideItem tagger"></td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://git.example.org/branch/test;refs/heads/test5"
- rel="noopener"
- target="_blank"
- >
- (diffusion)
- </a>
- </td>
- <td class="delete">
- <gr-button
- aria-disabled="false"
- class="deleteButton"
- data-index="6"
- link=""
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- <tr class="table">
- <td class="branches name">
- <a
- href="https://git.example.org/branch/test;refs/heads/test6"
- >
- test6
- </a>
- </td>
- <td class="branches revision">
- <span class="revisionNoEditing">
- 9c9d08a438e55e52f33b608415e6dddd9b18550d
- </span>
- <span class="revisionEdit">
- <span class="revisionWithEditing">
+ test6
+ </a>
+ </td>
+ <td class="branches revision">
+ <span class="revisionNoEditing">
9c9d08a438e55e52f33b608415e6dddd9b18550d
</span>
+ <span class="revisionEdit">
+ <span class="revisionWithEditing">
+ 9c9d08a438e55e52f33b608415e6dddd9b18550d
+ </span>
+ <gr-button
+ aria-disabled="false"
+ class="editBtn"
+ data-index="7"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ edit
+ </gr-button>
+ <iron-input class="editItem">
+ <input />
+ </iron-input>
+ <gr-button
+ aria-disabled="false"
+ class="cancelBtn editItem"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Cancel
+ </gr-button>
+ <gr-button
+ aria-disabled="true"
+ class="editItem saveBtn"
+ data-index="7"
+ disabled=""
+ link=""
+ role="button"
+ tabindex="-1"
+ >
+ Save
+ </gr-button>
+ </span>
+ </td>
+ <td class="hideItem message"></td>
+ <td class="hideItem tagger"></td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://git.example.org/branch/test;refs/heads/test6"
+ rel="noopener"
+ target="_blank"
+ >
+ (diffusion)
+ </a>
+ </td>
+ <td class="delete">
<gr-button
aria-disabled="false"
- class="editBtn"
+ class="deleteButton"
data-index="7"
link=""
role="button"
tabindex="0"
>
- edit
+ Delete
</gr-button>
- <iron-input class="editItem">
- <input />
- </iron-input>
- <gr-button
- aria-disabled="false"
- class="cancelBtn editItem"
- link=""
- role="button"
- tabindex="0"
+ </td>
+ </tr>
+ <tr class="table">
+ <td class="branches name">
+ <a
+ href="https://git.example.org/branch/test;refs/heads/test7"
>
- Cancel
- </gr-button>
- <gr-button
- aria-disabled="true"
- class="editItem saveBtn"
- data-index="7"
- disabled=""
- link=""
- role="button"
- tabindex="-1"
- >
- Save
- </gr-button>
- </span>
- </td>
- <td class="hideItem message"></td>
- <td class="hideItem tagger"></td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://git.example.org/branch/test;refs/heads/test6"
- rel="noopener"
- target="_blank"
- >
- (diffusion)
- </a>
- </td>
- <td class="delete">
- <gr-button
- aria-disabled="false"
- class="deleteButton"
- data-index="7"
- link=""
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- <tr class="table">
- <td class="branches name">
- <a
- href="https://git.example.org/branch/test;refs/heads/test7"
- >
- test7
- </a>
- </td>
- <td class="branches revision">
- <span class="revisionNoEditing">
- 9c9d08a438e55e52f33b608415e6dddd9b18550d
- </span>
- <span class="revisionEdit">
- <span class="revisionWithEditing">
+ test7
+ </a>
+ </td>
+ <td class="branches revision">
+ <span class="revisionNoEditing">
9c9d08a438e55e52f33b608415e6dddd9b18550d
</span>
+ <span class="revisionEdit">
+ <span class="revisionWithEditing">
+ 9c9d08a438e55e52f33b608415e6dddd9b18550d
+ </span>
+ <gr-button
+ aria-disabled="false"
+ class="editBtn"
+ data-index="8"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ edit
+ </gr-button>
+ <iron-input class="editItem">
+ <input />
+ </iron-input>
+ <gr-button
+ aria-disabled="false"
+ class="cancelBtn editItem"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Cancel
+ </gr-button>
+ <gr-button
+ aria-disabled="true"
+ class="editItem saveBtn"
+ data-index="8"
+ disabled=""
+ link=""
+ role="button"
+ tabindex="-1"
+ >
+ Save
+ </gr-button>
+ </span>
+ </td>
+ <td class="hideItem message"></td>
+ <td class="hideItem tagger"></td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://git.example.org/branch/test;refs/heads/test7"
+ rel="noopener"
+ target="_blank"
+ >
+ (diffusion)
+ </a>
+ </td>
+ <td class="delete">
<gr-button
aria-disabled="false"
- class="editBtn"
+ class="deleteButton"
data-index="8"
link=""
role="button"
tabindex="0"
>
- edit
+ Delete
</gr-button>
- <iron-input class="editItem">
- <input />
- </iron-input>
- <gr-button
- aria-disabled="false"
- class="cancelBtn editItem"
- link=""
- role="button"
- tabindex="0"
+ </td>
+ </tr>
+ <tr class="table">
+ <td class="branches name">
+ <a
+ href="https://git.example.org/branch/test;refs/heads/test8"
>
- Cancel
- </gr-button>
- <gr-button
- aria-disabled="true"
- class="editItem saveBtn"
- data-index="8"
- disabled=""
- link=""
- role="button"
- tabindex="-1"
- >
- Save
- </gr-button>
- </span>
- </td>
- <td class="hideItem message"></td>
- <td class="hideItem tagger"></td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://git.example.org/branch/test;refs/heads/test7"
- rel="noopener"
- target="_blank"
- >
- (diffusion)
- </a>
- </td>
- <td class="delete">
- <gr-button
- aria-disabled="false"
- class="deleteButton"
- data-index="8"
- link=""
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- <tr class="table">
- <td class="branches name">
- <a
- href="https://git.example.org/branch/test;refs/heads/test8"
- >
- test8
- </a>
- </td>
- <td class="branches revision">
- <span class="revisionNoEditing">
- 9c9d08a438e55e52f33b608415e6dddd9b18550d
- </span>
- <span class="revisionEdit">
- <span class="revisionWithEditing">
+ test8
+ </a>
+ </td>
+ <td class="branches revision">
+ <span class="revisionNoEditing">
9c9d08a438e55e52f33b608415e6dddd9b18550d
</span>
+ <span class="revisionEdit">
+ <span class="revisionWithEditing">
+ 9c9d08a438e55e52f33b608415e6dddd9b18550d
+ </span>
+ <gr-button
+ aria-disabled="false"
+ class="editBtn"
+ data-index="9"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ edit
+ </gr-button>
+ <iron-input class="editItem">
+ <input />
+ </iron-input>
+ <gr-button
+ aria-disabled="false"
+ class="cancelBtn editItem"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Cancel
+ </gr-button>
+ <gr-button
+ aria-disabled="true"
+ class="editItem saveBtn"
+ data-index="9"
+ disabled=""
+ link=""
+ role="button"
+ tabindex="-1"
+ >
+ Save
+ </gr-button>
+ </span>
+ </td>
+ <td class="hideItem message"></td>
+ <td class="hideItem tagger"></td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://git.example.org/branch/test;refs/heads/test8"
+ rel="noopener"
+ target="_blank"
+ >
+ (diffusion)
+ </a>
+ </td>
+ <td class="delete">
<gr-button
aria-disabled="false"
- class="editBtn"
+ class="deleteButton"
data-index="9"
link=""
role="button"
tabindex="0"
>
- edit
+ Delete
</gr-button>
- <iron-input class="editItem">
- <input />
- </iron-input>
- <gr-button
- aria-disabled="false"
- class="cancelBtn editItem"
- link=""
- role="button"
- tabindex="0"
+ </td>
+ </tr>
+ <tr class="table">
+ <td class="branches name">
+ <a
+ href="https://git.example.org/branch/test;refs/heads/test9"
>
- Cancel
- </gr-button>
- <gr-button
- aria-disabled="true"
- class="editItem saveBtn"
- data-index="9"
- disabled=""
- link=""
- role="button"
- tabindex="-1"
- >
- Save
- </gr-button>
- </span>
- </td>
- <td class="hideItem message"></td>
- <td class="hideItem tagger"></td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://git.example.org/branch/test;refs/heads/test8"
- rel="noopener"
- target="_blank"
- >
- (diffusion)
- </a>
- </td>
- <td class="delete">
- <gr-button
- aria-disabled="false"
- class="deleteButton"
- data-index="9"
- link=""
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- <tr class="table">
- <td class="branches name">
- <a
- href="https://git.example.org/branch/test;refs/heads/test9"
- >
- test9
- </a>
- </td>
- <td class="branches revision">
- <span class="revisionNoEditing">
- 9c9d08a438e55e52f33b608415e6dddd9b18550d
- </span>
- <span class="revisionEdit">
- <span class="revisionWithEditing">
+ test9
+ </a>
+ </td>
+ <td class="branches revision">
+ <span class="revisionNoEditing">
9c9d08a438e55e52f33b608415e6dddd9b18550d
</span>
+ <span class="revisionEdit">
+ <span class="revisionWithEditing">
+ 9c9d08a438e55e52f33b608415e6dddd9b18550d
+ </span>
+ <gr-button
+ aria-disabled="false"
+ class="editBtn"
+ data-index="10"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ edit
+ </gr-button>
+ <iron-input class="editItem">
+ <input />
+ </iron-input>
+ <gr-button
+ aria-disabled="false"
+ class="cancelBtn editItem"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Cancel
+ </gr-button>
+ <gr-button
+ aria-disabled="true"
+ class="editItem saveBtn"
+ data-index="10"
+ disabled=""
+ link=""
+ role="button"
+ tabindex="-1"
+ >
+ Save
+ </gr-button>
+ </span>
+ </td>
+ <td class="hideItem message"></td>
+ <td class="hideItem tagger"></td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://git.example.org/branch/test;refs/heads/test9"
+ rel="noopener"
+ target="_blank"
+ >
+ (diffusion)
+ </a>
+ </td>
+ <td class="delete">
<gr-button
aria-disabled="false"
- class="editBtn"
+ class="deleteButton"
data-index="10"
link=""
role="button"
tabindex="0"
>
- edit
+ Delete
</gr-button>
- <iron-input class="editItem">
- <input />
- </iron-input>
- <gr-button
- aria-disabled="false"
- class="cancelBtn editItem"
- link=""
- role="button"
- tabindex="0"
+ </td>
+ </tr>
+ <tr class="table">
+ <td class="branches name">
+ <a
+ href="https://git.example.org/branch/test;refs/heads/test10"
>
- Cancel
- </gr-button>
- <gr-button
- aria-disabled="true"
- class="editItem saveBtn"
- data-index="10"
- disabled=""
- link=""
- role="button"
- tabindex="-1"
- >
- Save
- </gr-button>
- </span>
- </td>
- <td class="hideItem message"></td>
- <td class="hideItem tagger"></td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://git.example.org/branch/test;refs/heads/test9"
- rel="noopener"
- target="_blank"
- >
- (diffusion)
- </a>
- </td>
- <td class="delete">
- <gr-button
- aria-disabled="false"
- class="deleteButton"
- data-index="10"
- link=""
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- <tr class="table">
- <td class="branches name">
- <a
- href="https://git.example.org/branch/test;refs/heads/test10"
- >
- test10
- </a>
- </td>
- <td class="branches revision">
- <span class="revisionNoEditing">
- 9c9d08a438e55e52f33b608415e6dddd9b18550d
- </span>
- <span class="revisionEdit">
- <span class="revisionWithEditing">
+ test10
+ </a>
+ </td>
+ <td class="branches revision">
+ <span class="revisionNoEditing">
9c9d08a438e55e52f33b608415e6dddd9b18550d
</span>
+ <span class="revisionEdit">
+ <span class="revisionWithEditing">
+ 9c9d08a438e55e52f33b608415e6dddd9b18550d
+ </span>
+ <gr-button
+ aria-disabled="false"
+ class="editBtn"
+ data-index="11"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ edit
+ </gr-button>
+ <iron-input class="editItem">
+ <input />
+ </iron-input>
+ <gr-button
+ aria-disabled="false"
+ class="cancelBtn editItem"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Cancel
+ </gr-button>
+ <gr-button
+ aria-disabled="true"
+ class="editItem saveBtn"
+ data-index="11"
+ disabled=""
+ link=""
+ role="button"
+ tabindex="-1"
+ >
+ Save
+ </gr-button>
+ </span>
+ </td>
+ <td class="hideItem message"></td>
+ <td class="hideItem tagger"></td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://git.example.org/branch/test;refs/heads/test10"
+ rel="noopener"
+ target="_blank"
+ >
+ (diffusion)
+ </a>
+ </td>
+ <td class="delete">
<gr-button
aria-disabled="false"
- class="editBtn"
+ class="deleteButton"
data-index="11"
link=""
role="button"
tabindex="0"
>
- edit
+ Delete
</gr-button>
- <iron-input class="editItem">
- <input />
- </iron-input>
- <gr-button
- aria-disabled="false"
- class="cancelBtn editItem"
- link=""
- role="button"
- tabindex="0"
+ </td>
+ </tr>
+ <tr class="table">
+ <td class="branches name">
+ <a
+ href="https://git.example.org/branch/test;refs/heads/test11"
>
- Cancel
- </gr-button>
- <gr-button
- aria-disabled="true"
- class="editItem saveBtn"
- data-index="11"
- disabled=""
- link=""
- role="button"
- tabindex="-1"
- >
- Save
- </gr-button>
- </span>
- </td>
- <td class="hideItem message"></td>
- <td class="hideItem tagger"></td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://git.example.org/branch/test;refs/heads/test10"
- rel="noopener"
- target="_blank"
- >
- (diffusion)
- </a>
- </td>
- <td class="delete">
- <gr-button
- aria-disabled="false"
- class="deleteButton"
- data-index="11"
- link=""
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- <tr class="table">
- <td class="branches name">
- <a
- href="https://git.example.org/branch/test;refs/heads/test11"
- >
- test11
- </a>
- </td>
- <td class="branches revision">
- <span class="revisionNoEditing">
- 9c9d08a438e55e52f33b608415e6dddd9b18550d
- </span>
- <span class="revisionEdit">
- <span class="revisionWithEditing">
+ test11
+ </a>
+ </td>
+ <td class="branches revision">
+ <span class="revisionNoEditing">
9c9d08a438e55e52f33b608415e6dddd9b18550d
</span>
+ <span class="revisionEdit">
+ <span class="revisionWithEditing">
+ 9c9d08a438e55e52f33b608415e6dddd9b18550d
+ </span>
+ <gr-button
+ aria-disabled="false"
+ class="editBtn"
+ data-index="12"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ edit
+ </gr-button>
+ <iron-input class="editItem">
+ <input />
+ </iron-input>
+ <gr-button
+ aria-disabled="false"
+ class="cancelBtn editItem"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Cancel
+ </gr-button>
+ <gr-button
+ aria-disabled="true"
+ class="editItem saveBtn"
+ data-index="12"
+ disabled=""
+ link=""
+ role="button"
+ tabindex="-1"
+ >
+ Save
+ </gr-button>
+ </span>
+ </td>
+ <td class="hideItem message"></td>
+ <td class="hideItem tagger"></td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://git.example.org/branch/test;refs/heads/test11"
+ rel="noopener"
+ target="_blank"
+ >
+ (diffusion)
+ </a>
+ </td>
+ <td class="delete">
<gr-button
aria-disabled="false"
- class="editBtn"
+ class="deleteButton"
data-index="12"
link=""
role="button"
tabindex="0"
>
- edit
+ Delete
</gr-button>
- <iron-input class="editItem">
- <input />
- </iron-input>
- <gr-button
- aria-disabled="false"
- class="cancelBtn editItem"
- link=""
- role="button"
- tabindex="0"
+ </td>
+ </tr>
+ <tr class="table">
+ <td class="branches name">
+ <a
+ href="https://git.example.org/branch/test;refs/heads/test12"
>
- Cancel
- </gr-button>
- <gr-button
- aria-disabled="true"
- class="editItem saveBtn"
- data-index="12"
- disabled=""
- link=""
- role="button"
- tabindex="-1"
- >
- Save
- </gr-button>
- </span>
- </td>
- <td class="hideItem message"></td>
- <td class="hideItem tagger"></td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://git.example.org/branch/test;refs/heads/test11"
- rel="noopener"
- target="_blank"
- >
- (diffusion)
- </a>
- </td>
- <td class="delete">
- <gr-button
- aria-disabled="false"
- class="deleteButton"
- data-index="12"
- link=""
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- <tr class="table">
- <td class="branches name">
- <a
- href="https://git.example.org/branch/test;refs/heads/test12"
- >
- test12
- </a>
- </td>
- <td class="branches revision">
- <span class="revisionNoEditing">
- 9c9d08a438e55e52f33b608415e6dddd9b18550d
- </span>
- <span class="revisionEdit">
- <span class="revisionWithEditing">
+ test12
+ </a>
+ </td>
+ <td class="branches revision">
+ <span class="revisionNoEditing">
9c9d08a438e55e52f33b608415e6dddd9b18550d
</span>
+ <span class="revisionEdit">
+ <span class="revisionWithEditing">
+ 9c9d08a438e55e52f33b608415e6dddd9b18550d
+ </span>
+ <gr-button
+ aria-disabled="false"
+ class="editBtn"
+ data-index="13"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ edit
+ </gr-button>
+ <iron-input class="editItem">
+ <input />
+ </iron-input>
+ <gr-button
+ aria-disabled="false"
+ class="cancelBtn editItem"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Cancel
+ </gr-button>
+ <gr-button
+ aria-disabled="true"
+ class="editItem saveBtn"
+ data-index="13"
+ disabled=""
+ link=""
+ role="button"
+ tabindex="-1"
+ >
+ Save
+ </gr-button>
+ </span>
+ </td>
+ <td class="hideItem message"></td>
+ <td class="hideItem tagger"></td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://git.example.org/branch/test;refs/heads/test12"
+ rel="noopener"
+ target="_blank"
+ >
+ (diffusion)
+ </a>
+ </td>
+ <td class="delete">
<gr-button
aria-disabled="false"
- class="editBtn"
+ class="deleteButton"
data-index="13"
link=""
role="button"
tabindex="0"
>
- edit
+ Delete
</gr-button>
- <iron-input class="editItem">
- <input />
- </iron-input>
- <gr-button
- aria-disabled="false"
- class="cancelBtn editItem"
- link=""
- role="button"
- tabindex="0"
+ </td>
+ </tr>
+ <tr class="table">
+ <td class="branches name">
+ <a
+ href="https://git.example.org/branch/test;refs/heads/test13"
>
- Cancel
- </gr-button>
- <gr-button
- aria-disabled="true"
- class="editItem saveBtn"
- data-index="13"
- disabled=""
- link=""
- role="button"
- tabindex="-1"
- >
- Save
- </gr-button>
- </span>
- </td>
- <td class="hideItem message"></td>
- <td class="hideItem tagger"></td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://git.example.org/branch/test;refs/heads/test12"
- rel="noopener"
- target="_blank"
- >
- (diffusion)
- </a>
- </td>
- <td class="delete">
- <gr-button
- aria-disabled="false"
- class="deleteButton"
- data-index="13"
- link=""
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- <tr class="table">
- <td class="branches name">
- <a
- href="https://git.example.org/branch/test;refs/heads/test13"
- >
- test13
- </a>
- </td>
- <td class="branches revision">
- <span class="revisionNoEditing">
- 9c9d08a438e55e52f33b608415e6dddd9b18550d
- </span>
- <span class="revisionEdit">
- <span class="revisionWithEditing">
+ test13
+ </a>
+ </td>
+ <td class="branches revision">
+ <span class="revisionNoEditing">
9c9d08a438e55e52f33b608415e6dddd9b18550d
</span>
+ <span class="revisionEdit">
+ <span class="revisionWithEditing">
+ 9c9d08a438e55e52f33b608415e6dddd9b18550d
+ </span>
+ <gr-button
+ aria-disabled="false"
+ class="editBtn"
+ data-index="14"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ edit
+ </gr-button>
+ <iron-input class="editItem">
+ <input />
+ </iron-input>
+ <gr-button
+ aria-disabled="false"
+ class="cancelBtn editItem"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Cancel
+ </gr-button>
+ <gr-button
+ aria-disabled="true"
+ class="editItem saveBtn"
+ data-index="14"
+ disabled=""
+ link=""
+ role="button"
+ tabindex="-1"
+ >
+ Save
+ </gr-button>
+ </span>
+ </td>
+ <td class="hideItem message"></td>
+ <td class="hideItem tagger"></td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://git.example.org/branch/test;refs/heads/test13"
+ rel="noopener"
+ target="_blank"
+ >
+ (diffusion)
+ </a>
+ </td>
+ <td class="delete">
<gr-button
aria-disabled="false"
- class="editBtn"
+ class="deleteButton"
data-index="14"
link=""
role="button"
tabindex="0"
>
- edit
+ Delete
</gr-button>
- <iron-input class="editItem">
- <input />
- </iron-input>
- <gr-button
- aria-disabled="false"
- class="cancelBtn editItem"
- link=""
- role="button"
- tabindex="0"
+ </td>
+ </tr>
+ <tr class="table">
+ <td class="branches name">
+ <a
+ href="https://git.example.org/branch/test;refs/heads/test14"
>
- Cancel
- </gr-button>
- <gr-button
- aria-disabled="true"
- class="editItem saveBtn"
- data-index="14"
- disabled=""
- link=""
- role="button"
- tabindex="-1"
- >
- Save
- </gr-button>
- </span>
- </td>
- <td class="hideItem message"></td>
- <td class="hideItem tagger"></td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://git.example.org/branch/test;refs/heads/test13"
- rel="noopener"
- target="_blank"
- >
- (diffusion)
- </a>
- </td>
- <td class="delete">
- <gr-button
- aria-disabled="false"
- class="deleteButton"
- data-index="14"
- link=""
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- <tr class="table">
- <td class="branches name">
- <a
- href="https://git.example.org/branch/test;refs/heads/test14"
- >
- test14
- </a>
- </td>
- <td class="branches revision">
- <span class="revisionNoEditing">
- 9c9d08a438e55e52f33b608415e6dddd9b18550d
- </span>
- <span class="revisionEdit">
- <span class="revisionWithEditing">
+ test14
+ </a>
+ </td>
+ <td class="branches revision">
+ <span class="revisionNoEditing">
9c9d08a438e55e52f33b608415e6dddd9b18550d
</span>
+ <span class="revisionEdit">
+ <span class="revisionWithEditing">
+ 9c9d08a438e55e52f33b608415e6dddd9b18550d
+ </span>
+ <gr-button
+ aria-disabled="false"
+ class="editBtn"
+ data-index="15"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ edit
+ </gr-button>
+ <iron-input class="editItem">
+ <input />
+ </iron-input>
+ <gr-button
+ aria-disabled="false"
+ class="cancelBtn editItem"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Cancel
+ </gr-button>
+ <gr-button
+ aria-disabled="true"
+ class="editItem saveBtn"
+ data-index="15"
+ disabled=""
+ link=""
+ role="button"
+ tabindex="-1"
+ >
+ Save
+ </gr-button>
+ </span>
+ </td>
+ <td class="hideItem message"></td>
+ <td class="hideItem tagger"></td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://git.example.org/branch/test;refs/heads/test14"
+ rel="noopener"
+ target="_blank"
+ >
+ (diffusion)
+ </a>
+ </td>
+ <td class="delete">
<gr-button
aria-disabled="false"
- class="editBtn"
+ class="deleteButton"
data-index="15"
link=""
role="button"
tabindex="0"
>
- edit
+ Delete
</gr-button>
- <iron-input class="editItem">
- <input />
- </iron-input>
- <gr-button
- aria-disabled="false"
- class="cancelBtn editItem"
- link=""
- role="button"
- tabindex="0"
+ </td>
+ </tr>
+ <tr class="table">
+ <td class="branches name">
+ <a
+ href="https://git.example.org/branch/test;refs/heads/test15"
>
- Cancel
- </gr-button>
- <gr-button
- aria-disabled="true"
- class="editItem saveBtn"
- data-index="15"
- disabled=""
- link=""
- role="button"
- tabindex="-1"
- >
- Save
- </gr-button>
- </span>
- </td>
- <td class="hideItem message"></td>
- <td class="hideItem tagger"></td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://git.example.org/branch/test;refs/heads/test14"
- rel="noopener"
- target="_blank"
- >
- (diffusion)
- </a>
- </td>
- <td class="delete">
- <gr-button
- aria-disabled="false"
- class="deleteButton"
- data-index="15"
- link=""
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- <tr class="table">
- <td class="branches name">
- <a
- href="https://git.example.org/branch/test;refs/heads/test15"
- >
- test15
- </a>
- </td>
- <td class="branches revision">
- <span class="revisionNoEditing">
- 9c9d08a438e55e52f33b608415e6dddd9b18550d
- </span>
- <span class="revisionEdit">
- <span class="revisionWithEditing">
+ test15
+ </a>
+ </td>
+ <td class="branches revision">
+ <span class="revisionNoEditing">
9c9d08a438e55e52f33b608415e6dddd9b18550d
</span>
+ <span class="revisionEdit">
+ <span class="revisionWithEditing">
+ 9c9d08a438e55e52f33b608415e6dddd9b18550d
+ </span>
+ <gr-button
+ aria-disabled="false"
+ class="editBtn"
+ data-index="16"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ edit
+ </gr-button>
+ <iron-input class="editItem">
+ <input />
+ </iron-input>
+ <gr-button
+ aria-disabled="false"
+ class="cancelBtn editItem"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Cancel
+ </gr-button>
+ <gr-button
+ aria-disabled="true"
+ class="editItem saveBtn"
+ data-index="16"
+ disabled=""
+ link=""
+ role="button"
+ tabindex="-1"
+ >
+ Save
+ </gr-button>
+ </span>
+ </td>
+ <td class="hideItem message"></td>
+ <td class="hideItem tagger"></td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://git.example.org/branch/test;refs/heads/test15"
+ rel="noopener"
+ target="_blank"
+ >
+ (diffusion)
+ </a>
+ </td>
+ <td class="delete">
<gr-button
aria-disabled="false"
- class="editBtn"
+ class="deleteButton"
data-index="16"
link=""
role="button"
tabindex="0"
>
- edit
+ Delete
</gr-button>
- <iron-input class="editItem">
- <input />
- </iron-input>
- <gr-button
- aria-disabled="false"
- class="cancelBtn editItem"
- link=""
- role="button"
- tabindex="0"
+ </td>
+ </tr>
+ <tr class="table">
+ <td class="branches name">
+ <a
+ href="https://git.example.org/branch/test;refs/heads/test16"
>
- Cancel
- </gr-button>
- <gr-button
- aria-disabled="true"
- class="editItem saveBtn"
- data-index="16"
- disabled=""
- link=""
- role="button"
- tabindex="-1"
- >
- Save
- </gr-button>
- </span>
- </td>
- <td class="hideItem message"></td>
- <td class="hideItem tagger"></td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://git.example.org/branch/test;refs/heads/test15"
- rel="noopener"
- target="_blank"
- >
- (diffusion)
- </a>
- </td>
- <td class="delete">
- <gr-button
- aria-disabled="false"
- class="deleteButton"
- data-index="16"
- link=""
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- <tr class="table">
- <td class="branches name">
- <a
- href="https://git.example.org/branch/test;refs/heads/test16"
- >
- test16
- </a>
- </td>
- <td class="branches revision">
- <span class="revisionNoEditing">
- 9c9d08a438e55e52f33b608415e6dddd9b18550d
- </span>
- <span class="revisionEdit">
- <span class="revisionWithEditing">
+ test16
+ </a>
+ </td>
+ <td class="branches revision">
+ <span class="revisionNoEditing">
9c9d08a438e55e52f33b608415e6dddd9b18550d
</span>
+ <span class="revisionEdit">
+ <span class="revisionWithEditing">
+ 9c9d08a438e55e52f33b608415e6dddd9b18550d
+ </span>
+ <gr-button
+ aria-disabled="false"
+ class="editBtn"
+ data-index="17"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ edit
+ </gr-button>
+ <iron-input class="editItem">
+ <input />
+ </iron-input>
+ <gr-button
+ aria-disabled="false"
+ class="cancelBtn editItem"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Cancel
+ </gr-button>
+ <gr-button
+ aria-disabled="true"
+ class="editItem saveBtn"
+ data-index="17"
+ disabled=""
+ link=""
+ role="button"
+ tabindex="-1"
+ >
+ Save
+ </gr-button>
+ </span>
+ </td>
+ <td class="hideItem message"></td>
+ <td class="hideItem tagger"></td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://git.example.org/branch/test;refs/heads/test16"
+ rel="noopener"
+ target="_blank"
+ >
+ (diffusion)
+ </a>
+ </td>
+ <td class="delete">
<gr-button
aria-disabled="false"
- class="editBtn"
+ class="deleteButton"
data-index="17"
link=""
role="button"
tabindex="0"
>
- edit
+ Delete
</gr-button>
- <iron-input class="editItem">
- <input />
- </iron-input>
- <gr-button
- aria-disabled="false"
- class="cancelBtn editItem"
- link=""
- role="button"
- tabindex="0"
+ </td>
+ </tr>
+ <tr class="table">
+ <td class="branches name">
+ <a
+ href="https://git.example.org/branch/test;refs/heads/test17"
>
- Cancel
- </gr-button>
- <gr-button
- aria-disabled="true"
- class="editItem saveBtn"
- data-index="17"
- disabled=""
- link=""
- role="button"
- tabindex="-1"
- >
- Save
- </gr-button>
- </span>
- </td>
- <td class="hideItem message"></td>
- <td class="hideItem tagger"></td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://git.example.org/branch/test;refs/heads/test16"
- rel="noopener"
- target="_blank"
- >
- (diffusion)
- </a>
- </td>
- <td class="delete">
- <gr-button
- aria-disabled="false"
- class="deleteButton"
- data-index="17"
- link=""
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- <tr class="table">
- <td class="branches name">
- <a
- href="https://git.example.org/branch/test;refs/heads/test17"
- >
- test17
- </a>
- </td>
- <td class="branches revision">
- <span class="revisionNoEditing">
- 9c9d08a438e55e52f33b608415e6dddd9b18550d
- </span>
- <span class="revisionEdit">
- <span class="revisionWithEditing">
+ test17
+ </a>
+ </td>
+ <td class="branches revision">
+ <span class="revisionNoEditing">
9c9d08a438e55e52f33b608415e6dddd9b18550d
</span>
+ <span class="revisionEdit">
+ <span class="revisionWithEditing">
+ 9c9d08a438e55e52f33b608415e6dddd9b18550d
+ </span>
+ <gr-button
+ aria-disabled="false"
+ class="editBtn"
+ data-index="18"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ edit
+ </gr-button>
+ <iron-input class="editItem">
+ <input />
+ </iron-input>
+ <gr-button
+ aria-disabled="false"
+ class="cancelBtn editItem"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Cancel
+ </gr-button>
+ <gr-button
+ aria-disabled="true"
+ class="editItem saveBtn"
+ data-index="18"
+ disabled=""
+ link=""
+ role="button"
+ tabindex="-1"
+ >
+ Save
+ </gr-button>
+ </span>
+ </td>
+ <td class="hideItem message"></td>
+ <td class="hideItem tagger"></td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://git.example.org/branch/test;refs/heads/test17"
+ rel="noopener"
+ target="_blank"
+ >
+ (diffusion)
+ </a>
+ </td>
+ <td class="delete">
<gr-button
aria-disabled="false"
- class="editBtn"
+ class="deleteButton"
data-index="18"
link=""
role="button"
tabindex="0"
>
- edit
+ Delete
</gr-button>
- <iron-input class="editItem">
- <input />
- </iron-input>
- <gr-button
- aria-disabled="false"
- class="cancelBtn editItem"
- link=""
- role="button"
- tabindex="0"
+ </td>
+ </tr>
+ <tr class="table">
+ <td class="branches name">
+ <a
+ href="https://git.example.org/branch/test;refs/heads/test18"
>
- Cancel
- </gr-button>
- <gr-button
- aria-disabled="true"
- class="editItem saveBtn"
- data-index="18"
- disabled=""
- link=""
- role="button"
- tabindex="-1"
- >
- Save
- </gr-button>
- </span>
- </td>
- <td class="hideItem message"></td>
- <td class="hideItem tagger"></td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://git.example.org/branch/test;refs/heads/test17"
- rel="noopener"
- target="_blank"
- >
- (diffusion)
- </a>
- </td>
- <td class="delete">
- <gr-button
- aria-disabled="false"
- class="deleteButton"
- data-index="18"
- link=""
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- <tr class="table">
- <td class="branches name">
- <a
- href="https://git.example.org/branch/test;refs/heads/test18"
- >
- test18
- </a>
- </td>
- <td class="branches revision">
- <span class="revisionNoEditing">
- 9c9d08a438e55e52f33b608415e6dddd9b18550d
- </span>
- <span class="revisionEdit">
- <span class="revisionWithEditing">
+ test18
+ </a>
+ </td>
+ <td class="branches revision">
+ <span class="revisionNoEditing">
9c9d08a438e55e52f33b608415e6dddd9b18550d
</span>
+ <span class="revisionEdit">
+ <span class="revisionWithEditing">
+ 9c9d08a438e55e52f33b608415e6dddd9b18550d
+ </span>
+ <gr-button
+ aria-disabled="false"
+ class="editBtn"
+ data-index="19"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ edit
+ </gr-button>
+ <iron-input class="editItem">
+ <input />
+ </iron-input>
+ <gr-button
+ aria-disabled="false"
+ class="cancelBtn editItem"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Cancel
+ </gr-button>
+ <gr-button
+ aria-disabled="true"
+ class="editItem saveBtn"
+ data-index="19"
+ disabled=""
+ link=""
+ role="button"
+ tabindex="-1"
+ >
+ Save
+ </gr-button>
+ </span>
+ </td>
+ <td class="hideItem message"></td>
+ <td class="hideItem tagger"></td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://git.example.org/branch/test;refs/heads/test18"
+ rel="noopener"
+ target="_blank"
+ >
+ (diffusion)
+ </a>
+ </td>
+ <td class="delete">
<gr-button
aria-disabled="false"
- class="editBtn"
+ class="deleteButton"
data-index="19"
link=""
role="button"
tabindex="0"
>
- edit
+ Delete
</gr-button>
- <iron-input class="editItem">
- <input />
- </iron-input>
- <gr-button
- aria-disabled="false"
- class="cancelBtn editItem"
- link=""
- role="button"
- tabindex="0"
+ </td>
+ </tr>
+ <tr class="table">
+ <td class="branches name">
+ <a
+ href="https://git.example.org/branch/test;refs/heads/test19"
>
- Cancel
- </gr-button>
- <gr-button
- aria-disabled="true"
- class="editItem saveBtn"
- data-index="19"
- disabled=""
- link=""
- role="button"
- tabindex="-1"
- >
- Save
- </gr-button>
- </span>
- </td>
- <td class="hideItem message"></td>
- <td class="hideItem tagger"></td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://git.example.org/branch/test;refs/heads/test18"
- rel="noopener"
- target="_blank"
- >
- (diffusion)
- </a>
- </td>
- <td class="delete">
- <gr-button
- aria-disabled="false"
- class="deleteButton"
- data-index="19"
- link=""
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- <tr class="table">
- <td class="branches name">
- <a
- href="https://git.example.org/branch/test;refs/heads/test19"
- >
- test19
- </a>
- </td>
- <td class="branches revision">
- <span class="revisionNoEditing">
- 9c9d08a438e55e52f33b608415e6dddd9b18550d
- </span>
- <span class="revisionEdit">
- <span class="revisionWithEditing">
+ test19
+ </a>
+ </td>
+ <td class="branches revision">
+ <span class="revisionNoEditing">
9c9d08a438e55e52f33b608415e6dddd9b18550d
</span>
+ <span class="revisionEdit">
+ <span class="revisionWithEditing">
+ 9c9d08a438e55e52f33b608415e6dddd9b18550d
+ </span>
+ <gr-button
+ aria-disabled="false"
+ class="editBtn"
+ data-index="20"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ edit
+ </gr-button>
+ <iron-input class="editItem">
+ <input />
+ </iron-input>
+ <gr-button
+ aria-disabled="false"
+ class="cancelBtn editItem"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Cancel
+ </gr-button>
+ <gr-button
+ aria-disabled="true"
+ class="editItem saveBtn"
+ data-index="20"
+ disabled=""
+ link=""
+ role="button"
+ tabindex="-1"
+ >
+ Save
+ </gr-button>
+ </span>
+ </td>
+ <td class="hideItem message"></td>
+ <td class="hideItem tagger"></td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://git.example.org/branch/test;refs/heads/test19"
+ rel="noopener"
+ target="_blank"
+ >
+ (diffusion)
+ </a>
+ </td>
+ <td class="delete">
<gr-button
aria-disabled="false"
- class="editBtn"
+ class="deleteButton"
data-index="20"
link=""
role="button"
tabindex="0"
>
- edit
+ Delete
</gr-button>
- <iron-input class="editItem">
- <input />
- </iron-input>
- <gr-button
- aria-disabled="false"
- class="cancelBtn editItem"
- link=""
- role="button"
- tabindex="0"
+ </td>
+ </tr>
+ <tr class="table">
+ <td class="branches name">
+ <a
+ href="https://git.example.org/branch/test;refs/heads/test20"
>
- Cancel
- </gr-button>
- <gr-button
- aria-disabled="true"
- class="editItem saveBtn"
- data-index="20"
- disabled=""
- link=""
- role="button"
- tabindex="-1"
- >
- Save
- </gr-button>
- </span>
- </td>
- <td class="hideItem message"></td>
- <td class="hideItem tagger"></td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://git.example.org/branch/test;refs/heads/test19"
- rel="noopener"
- target="_blank"
- >
- (diffusion)
- </a>
- </td>
- <td class="delete">
- <gr-button
- aria-disabled="false"
- class="deleteButton"
- data-index="20"
- link=""
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- <tr class="table">
- <td class="branches name">
- <a
- href="https://git.example.org/branch/test;refs/heads/test20"
- >
- test20
- </a>
- </td>
- <td class="branches revision">
- <span class="revisionNoEditing">
- 9c9d08a438e55e52f33b608415e6dddd9b18550d
- </span>
- <span class="revisionEdit">
- <span class="revisionWithEditing">
+ test20
+ </a>
+ </td>
+ <td class="branches revision">
+ <span class="revisionNoEditing">
9c9d08a438e55e52f33b608415e6dddd9b18550d
</span>
+ <span class="revisionEdit">
+ <span class="revisionWithEditing">
+ 9c9d08a438e55e52f33b608415e6dddd9b18550d
+ </span>
+ <gr-button
+ aria-disabled="false"
+ class="editBtn"
+ data-index="21"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ edit
+ </gr-button>
+ <iron-input class="editItem">
+ <input />
+ </iron-input>
+ <gr-button
+ aria-disabled="false"
+ class="cancelBtn editItem"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Cancel
+ </gr-button>
+ <gr-button
+ aria-disabled="true"
+ class="editItem saveBtn"
+ data-index="21"
+ disabled=""
+ link=""
+ role="button"
+ tabindex="-1"
+ >
+ Save
+ </gr-button>
+ </span>
+ </td>
+ <td class="hideItem message"></td>
+ <td class="hideItem tagger"></td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://git.example.org/branch/test;refs/heads/test20"
+ rel="noopener"
+ target="_blank"
+ >
+ (diffusion)
+ </a>
+ </td>
+ <td class="delete">
<gr-button
aria-disabled="false"
- class="editBtn"
+ class="deleteButton"
data-index="21"
link=""
role="button"
tabindex="0"
>
- edit
+ Delete
</gr-button>
- <iron-input class="editItem">
- <input />
- </iron-input>
- <gr-button
- aria-disabled="false"
- class="cancelBtn editItem"
- link=""
- role="button"
- tabindex="0"
+ </td>
+ </tr>
+ <tr class="table">
+ <td class="branches name">
+ <a
+ href="https://git.example.org/branch/test;refs/heads/test21"
>
- Cancel
- </gr-button>
- <gr-button
- aria-disabled="true"
- class="editItem saveBtn"
- data-index="21"
- disabled=""
- link=""
- role="button"
- tabindex="-1"
- >
- Save
- </gr-button>
- </span>
- </td>
- <td class="hideItem message"></td>
- <td class="hideItem tagger"></td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://git.example.org/branch/test;refs/heads/test20"
- rel="noopener"
- target="_blank"
- >
- (diffusion)
- </a>
- </td>
- <td class="delete">
- <gr-button
- aria-disabled="false"
- class="deleteButton"
- data-index="21"
- link=""
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- <tr class="table">
- <td class="branches name">
- <a
- href="https://git.example.org/branch/test;refs/heads/test21"
- >
- test21
- </a>
- </td>
- <td class="branches revision">
- <span class="revisionNoEditing">
- 9c9d08a438e55e52f33b608415e6dddd9b18550d
- </span>
- <span class="revisionEdit">
- <span class="revisionWithEditing">
+ test21
+ </a>
+ </td>
+ <td class="branches revision">
+ <span class="revisionNoEditing">
9c9d08a438e55e52f33b608415e6dddd9b18550d
</span>
+ <span class="revisionEdit">
+ <span class="revisionWithEditing">
+ 9c9d08a438e55e52f33b608415e6dddd9b18550d
+ </span>
+ <gr-button
+ aria-disabled="false"
+ class="editBtn"
+ data-index="22"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ edit
+ </gr-button>
+ <iron-input class="editItem">
+ <input />
+ </iron-input>
+ <gr-button
+ aria-disabled="false"
+ class="cancelBtn editItem"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Cancel
+ </gr-button>
+ <gr-button
+ aria-disabled="true"
+ class="editItem saveBtn"
+ data-index="22"
+ disabled=""
+ link=""
+ role="button"
+ tabindex="-1"
+ >
+ Save
+ </gr-button>
+ </span>
+ </td>
+ <td class="hideItem message"></td>
+ <td class="hideItem tagger"></td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://git.example.org/branch/test;refs/heads/test21"
+ rel="noopener"
+ target="_blank"
+ >
+ (diffusion)
+ </a>
+ </td>
+ <td class="delete">
<gr-button
aria-disabled="false"
- class="editBtn"
+ class="deleteButton"
data-index="22"
link=""
role="button"
tabindex="0"
>
- edit
+ Delete
</gr-button>
- <iron-input class="editItem">
- <input />
- </iron-input>
- <gr-button
- aria-disabled="false"
- class="cancelBtn editItem"
- link=""
- role="button"
- tabindex="0"
+ </td>
+ </tr>
+ <tr class="table">
+ <td class="branches name">
+ <a
+ href="https://git.example.org/branch/test;refs/heads/test22"
>
- Cancel
- </gr-button>
- <gr-button
- aria-disabled="true"
- class="editItem saveBtn"
- data-index="22"
- disabled=""
- link=""
- role="button"
- tabindex="-1"
- >
- Save
- </gr-button>
- </span>
- </td>
- <td class="hideItem message"></td>
- <td class="hideItem tagger"></td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://git.example.org/branch/test;refs/heads/test21"
- rel="noopener"
- target="_blank"
- >
- (diffusion)
- </a>
- </td>
- <td class="delete">
- <gr-button
- aria-disabled="false"
- class="deleteButton"
- data-index="22"
- link=""
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- <tr class="table">
- <td class="branches name">
- <a
- href="https://git.example.org/branch/test;refs/heads/test22"
- >
- test22
- </a>
- </td>
- <td class="branches revision">
- <span class="revisionNoEditing">
- 9c9d08a438e55e52f33b608415e6dddd9b18550d
- </span>
- <span class="revisionEdit">
- <span class="revisionWithEditing">
+ test22
+ </a>
+ </td>
+ <td class="branches revision">
+ <span class="revisionNoEditing">
9c9d08a438e55e52f33b608415e6dddd9b18550d
</span>
+ <span class="revisionEdit">
+ <span class="revisionWithEditing">
+ 9c9d08a438e55e52f33b608415e6dddd9b18550d
+ </span>
+ <gr-button
+ aria-disabled="false"
+ class="editBtn"
+ data-index="23"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ edit
+ </gr-button>
+ <iron-input class="editItem">
+ <input />
+ </iron-input>
+ <gr-button
+ aria-disabled="false"
+ class="cancelBtn editItem"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Cancel
+ </gr-button>
+ <gr-button
+ aria-disabled="true"
+ class="editItem saveBtn"
+ data-index="23"
+ disabled=""
+ link=""
+ role="button"
+ tabindex="-1"
+ >
+ Save
+ </gr-button>
+ </span>
+ </td>
+ <td class="hideItem message"></td>
+ <td class="hideItem tagger"></td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://git.example.org/branch/test;refs/heads/test22"
+ rel="noopener"
+ target="_blank"
+ >
+ (diffusion)
+ </a>
+ </td>
+ <td class="delete">
<gr-button
aria-disabled="false"
- class="editBtn"
+ class="deleteButton"
data-index="23"
link=""
role="button"
tabindex="0"
>
- edit
+ Delete
</gr-button>
- <iron-input class="editItem">
- <input />
- </iron-input>
- <gr-button
- aria-disabled="false"
- class="cancelBtn editItem"
- link=""
- role="button"
- tabindex="0"
+ </td>
+ </tr>
+ <tr class="table">
+ <td class="branches name">
+ <a
+ href="https://git.example.org/branch/test;refs/heads/test23"
>
- Cancel
- </gr-button>
- <gr-button
- aria-disabled="true"
- class="editItem saveBtn"
- data-index="23"
- disabled=""
- link=""
- role="button"
- tabindex="-1"
- >
- Save
- </gr-button>
- </span>
- </td>
- <td class="hideItem message"></td>
- <td class="hideItem tagger"></td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://git.example.org/branch/test;refs/heads/test22"
- rel="noopener"
- target="_blank"
- >
- (diffusion)
- </a>
- </td>
- <td class="delete">
- <gr-button
- aria-disabled="false"
- class="deleteButton"
- data-index="23"
- link=""
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- <tr class="table">
- <td class="branches name">
- <a
- href="https://git.example.org/branch/test;refs/heads/test23"
- >
- test23
- </a>
- </td>
- <td class="branches revision">
- <span class="revisionNoEditing">
- 9c9d08a438e55e52f33b608415e6dddd9b18550d
- </span>
- <span class="revisionEdit">
- <span class="revisionWithEditing">
+ test23
+ </a>
+ </td>
+ <td class="branches revision">
+ <span class="revisionNoEditing">
9c9d08a438e55e52f33b608415e6dddd9b18550d
</span>
+ <span class="revisionEdit">
+ <span class="revisionWithEditing">
+ 9c9d08a438e55e52f33b608415e6dddd9b18550d
+ </span>
+ <gr-button
+ aria-disabled="false"
+ class="editBtn"
+ data-index="24"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ edit
+ </gr-button>
+ <iron-input class="editItem">
+ <input />
+ </iron-input>
+ <gr-button
+ aria-disabled="false"
+ class="cancelBtn editItem"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Cancel
+ </gr-button>
+ <gr-button
+ aria-disabled="true"
+ class="editItem saveBtn"
+ data-index="24"
+ disabled=""
+ link=""
+ role="button"
+ tabindex="-1"
+ >
+ Save
+ </gr-button>
+ </span>
+ </td>
+ <td class="hideItem message"></td>
+ <td class="hideItem tagger"></td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://git.example.org/branch/test;refs/heads/test23"
+ rel="noopener"
+ target="_blank"
+ >
+ (diffusion)
+ </a>
+ </td>
+ <td class="delete">
<gr-button
aria-disabled="false"
- class="editBtn"
+ class="deleteButton"
data-index="24"
link=""
role="button"
tabindex="0"
>
- edit
+ Delete
</gr-button>
- <iron-input class="editItem">
- <input />
- </iron-input>
- <gr-button
- aria-disabled="false"
- class="cancelBtn editItem"
- link=""
- role="button"
- tabindex="0"
- >
- Cancel
- </gr-button>
- <gr-button
- aria-disabled="true"
- class="editItem saveBtn"
- data-index="24"
- disabled=""
- link=""
- role="button"
- tabindex="-1"
- >
- Save
- </gr-button>
- </span>
- </td>
- <td class="hideItem message"></td>
- <td class="hideItem tagger"></td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://git.example.org/branch/test;refs/heads/test23"
- rel="noopener"
- target="_blank"
- >
- (diffusion)
- </a>
- </td>
- <td class="delete">
- <gr-button
- aria-disabled="false"
- class="deleteButton"
- data-index="24"
- link=""
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- </tbody>
- </table>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ <gr-overlay
+ aria-hidden="true"
+ id="overlay"
+ style="outline: none; display: none;"
+ tabindex="-1"
+ with-backdrop=""
+ >
+ <gr-confirm-delete-item-dialog class="confirmDialog">
+ </gr-confirm-delete-item-dialog>
+ </gr-overlay>
+ </gr-list-view>
<gr-overlay
aria-hidden="true"
- id="overlay"
+ id="createOverlay"
style="outline: none; display: none;"
tabindex="-1"
with-backdrop=""
>
- <gr-confirm-delete-item-dialog class="confirmDialog">
- </gr-confirm-delete-item-dialog>
+ <gr-dialog
+ confirm-label="Create"
+ disabled=""
+ id="createDialog"
+ role="dialog"
+ >
+ <div class="header" slot="header">Create Branch</div>
+ <div class="main" slot="main">
+ <gr-create-pointer-dialog id="createNewModal">
+ </gr-create-pointer-dialog>
+ </div>
+ </gr-dialog>
</gr-overlay>
- </gr-list-view>
- <gr-overlay
- aria-hidden="true"
- id="createOverlay"
- style="outline: none; display: none;"
- tabindex="-1"
- with-backdrop=""
- >
- <gr-dialog
- confirm-label="Create"
- disabled=""
- id="createDialog"
- role="dialog"
- >
- <div class="header" slot="header">Create Branch</div>
- <div class="main" slot="main">
- <gr-create-pointer-dialog id="createNewModal">
- </gr-create-pointer-dialog>
- </div>
- </gr-dialog>
- </gr-overlay>
- `);
+ `
+ );
});
test('test for branch in the list', () => {
@@ -2346,8 +2349,9 @@
let tags: TagInfo[];
setup(async () => {
- element = basicFixture.instantiate();
- await element.updateComplete;
+ element = await fixture(
+ html`<gr-repo-detail-list></gr-repo-detail-list>`
+ );
element.detailType = RepoDetailView.TAGS;
sinon.stub(page, 'show');
});
diff --git a/polygerrit-ui/app/elements/admin/gr-repo-list/gr-repo-list_test.ts b/polygerrit-ui/app/elements/admin/gr-repo-list/gr-repo-list_test.ts
index a58538c..0a8f251 100644
--- a/polygerrit-ui/app/elements/admin/gr-repo-list/gr-repo-list_test.ts
+++ b/polygerrit-ui/app/elements/admin/gr-repo-list/gr-repo-list_test.ts
@@ -23,8 +23,7 @@
import {GrOverlay} from '../../shared/gr-overlay/gr-overlay';
import {GrDialog} from '../../shared/gr-dialog/gr-dialog';
import {GrListView} from '../../shared/gr-list-view/gr-list-view';
-
-const basicFixture = fixtureFromElement('gr-repo-list');
+import {fixture, html} from '@open-wc/testing';
function createRepo(name: string, counter: number) {
return {
@@ -54,8 +53,7 @@
setup(async () => {
sinon.stub(page, 'show');
- element = basicFixture.instantiate();
- await element.updateComplete;
+ element = await fixture(html`<gr-repo-list></gr-repo-list>`);
});
suite('list with repos', () => {
@@ -67,547 +65,552 @@
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <gr-list-view>
- <table class="genericList" id="list">
- <tbody>
- <tr class="headerRow">
- <th class="name topHeader">Repository Name</th>
- <th class="repositoryBrowser topHeader">Repository Browser</th>
- <th class="changesLink topHeader">Changes</th>
- <th class="readOnly topHeader">Read only</th>
- <th class="description topHeader">Repository Description</th>
- </tr>
- <tr class="loadingMsg" id="loading">
- <td>Loading...</td>
- </tr>
- </tbody>
- <tbody>
- <tr class="table">
- <td class="name">
- <a href="/admin/repos/test"> test </a>
- </td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://phabricator.example.org/r/project/test0"
- rel="noopener"
- target="_blank"
- >
- diffusion
- </a>
- </td>
- <td class="changesLink">
- <a href=""> view all </a>
- </td>
- <td class="readOnly"></td>
- <td class="description"></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/admin/repos/test"> test </a>
- </td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://phabricator.example.org/r/project/test1"
- rel="noopener"
- target="_blank"
- >
- diffusion
- </a>
- </td>
- <td class="changesLink">
- <a href=""> view all </a>
- </td>
- <td class="readOnly"></td>
- <td class="description"></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/admin/repos/test"> test </a>
- </td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://phabricator.example.org/r/project/test2"
- rel="noopener"
- target="_blank"
- >
- diffusion
- </a>
- </td>
- <td class="changesLink">
- <a href=""> view all </a>
- </td>
- <td class="readOnly"></td>
- <td class="description"></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/admin/repos/test"> test </a>
- </td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://phabricator.example.org/r/project/test3"
- rel="noopener"
- target="_blank"
- >
- diffusion
- </a>
- </td>
- <td class="changesLink">
- <a href=""> view all </a>
- </td>
- <td class="readOnly"></td>
- <td class="description"></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/admin/repos/test"> test </a>
- </td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://phabricator.example.org/r/project/test4"
- rel="noopener"
- target="_blank"
- >
- diffusion
- </a>
- </td>
- <td class="changesLink">
- <a href=""> view all </a>
- </td>
- <td class="readOnly"></td>
- <td class="description"></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/admin/repos/test"> test </a>
- </td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://phabricator.example.org/r/project/test5"
- rel="noopener"
- target="_blank"
- >
- diffusion
- </a>
- </td>
- <td class="changesLink">
- <a href=""> view all </a>
- </td>
- <td class="readOnly"></td>
- <td class="description"></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/admin/repos/test"> test </a>
- </td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://phabricator.example.org/r/project/test6"
- rel="noopener"
- target="_blank"
- >
- diffusion
- </a>
- </td>
- <td class="changesLink">
- <a href=""> view all </a>
- </td>
- <td class="readOnly"></td>
- <td class="description"></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/admin/repos/test"> test </a>
- </td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://phabricator.example.org/r/project/test7"
- rel="noopener"
- target="_blank"
- >
- diffusion
- </a>
- </td>
- <td class="changesLink">
- <a href=""> view all </a>
- </td>
- <td class="readOnly"></td>
- <td class="description"></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/admin/repos/test"> test </a>
- </td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://phabricator.example.org/r/project/test8"
- rel="noopener"
- target="_blank"
- >
- diffusion
- </a>
- </td>
- <td class="changesLink">
- <a href=""> view all </a>
- </td>
- <td class="readOnly"></td>
- <td class="description"></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/admin/repos/test"> test </a>
- </td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://phabricator.example.org/r/project/test9"
- rel="noopener"
- target="_blank"
- >
- diffusion
- </a>
- </td>
- <td class="changesLink">
- <a href=""> view all </a>
- </td>
- <td class="readOnly"></td>
- <td class="description"></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/admin/repos/test"> test </a>
- </td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://phabricator.example.org/r/project/test10"
- rel="noopener"
- target="_blank"
- >
- diffusion
- </a>
- </td>
- <td class="changesLink">
- <a href=""> view all </a>
- </td>
- <td class="readOnly"></td>
- <td class="description"></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/admin/repos/test"> test </a>
- </td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://phabricator.example.org/r/project/test11"
- rel="noopener"
- target="_blank"
- >
- diffusion
- </a>
- </td>
- <td class="changesLink">
- <a href=""> view all </a>
- </td>
- <td class="readOnly"></td>
- <td class="description"></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/admin/repos/test"> test </a>
- </td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://phabricator.example.org/r/project/test12"
- rel="noopener"
- target="_blank"
- >
- diffusion
- </a>
- </td>
- <td class="changesLink">
- <a href=""> view all </a>
- </td>
- <td class="readOnly"></td>
- <td class="description"></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/admin/repos/test"> test </a>
- </td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://phabricator.example.org/r/project/test13"
- rel="noopener"
- target="_blank"
- >
- diffusion
- </a>
- </td>
- <td class="changesLink">
- <a href=""> view all </a>
- </td>
- <td class="readOnly"></td>
- <td class="description"></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/admin/repos/test"> test </a>
- </td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://phabricator.example.org/r/project/test14"
- rel="noopener"
- target="_blank"
- >
- diffusion
- </a>
- </td>
- <td class="changesLink">
- <a href=""> view all </a>
- </td>
- <td class="readOnly"></td>
- <td class="description"></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/admin/repos/test"> test </a>
- </td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://phabricator.example.org/r/project/test15"
- rel="noopener"
- target="_blank"
- >
- diffusion
- </a>
- </td>
- <td class="changesLink">
- <a href=""> view all </a>
- </td>
- <td class="readOnly"></td>
- <td class="description"></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/admin/repos/test"> test </a>
- </td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://phabricator.example.org/r/project/test16"
- rel="noopener"
- target="_blank"
- >
- diffusion
- </a>
- </td>
- <td class="changesLink">
- <a href=""> view all </a>
- </td>
- <td class="readOnly"></td>
- <td class="description"></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/admin/repos/test"> test </a>
- </td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://phabricator.example.org/r/project/test17"
- rel="noopener"
- target="_blank"
- >
- diffusion
- </a>
- </td>
- <td class="changesLink">
- <a href=""> view all </a>
- </td>
- <td class="readOnly"></td>
- <td class="description"></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/admin/repos/test"> test </a>
- </td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://phabricator.example.org/r/project/test18"
- rel="noopener"
- target="_blank"
- >
- diffusion
- </a>
- </td>
- <td class="changesLink">
- <a href=""> view all </a>
- </td>
- <td class="readOnly"></td>
- <td class="description"></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/admin/repos/test"> test </a>
- </td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://phabricator.example.org/r/project/test19"
- rel="noopener"
- target="_blank"
- >
- diffusion
- </a>
- </td>
- <td class="changesLink">
- <a href=""> view all </a>
- </td>
- <td class="readOnly"></td>
- <td class="description"></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/admin/repos/test"> test </a>
- </td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://phabricator.example.org/r/project/test20"
- rel="noopener"
- target="_blank"
- >
- diffusion
- </a>
- </td>
- <td class="changesLink">
- <a href=""> view all </a>
- </td>
- <td class="readOnly"></td>
- <td class="description"></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/admin/repos/test"> test </a>
- </td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://phabricator.example.org/r/project/test21"
- rel="noopener"
- target="_blank"
- >
- diffusion
- </a>
- </td>
- <td class="changesLink">
- <a href=""> view all </a>
- </td>
- <td class="readOnly"></td>
- <td class="description"></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/admin/repos/test"> test </a>
- </td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://phabricator.example.org/r/project/test22"
- rel="noopener"
- target="_blank"
- >
- diffusion
- </a>
- </td>
- <td class="changesLink">
- <a href=""> view all </a>
- </td>
- <td class="readOnly"></td>
- <td class="description"></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/admin/repos/test"> test </a>
- </td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://phabricator.example.org/r/project/test23"
- rel="noopener"
- target="_blank"
- >
- diffusion
- </a>
- </td>
- <td class="changesLink">
- <a href=""> view all </a>
- </td>
- <td class="readOnly"></td>
- <td class="description"></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/admin/repos/test"> test </a>
- </td>
- <td class="repositoryBrowser">
- <a
- class="webLink"
- href="https://phabricator.example.org/r/project/test24"
- rel="noopener"
- target="_blank"
- >
- diffusion
- </a>
- </td>
- <td class="changesLink">
- <a href=""> view all </a>
- </td>
- <td class="readOnly"></td>
- <td class="description"></td>
- </tr>
- </tbody>
- </table>
- </gr-list-view>
- <gr-overlay
- aria-hidden="true"
- id="createOverlay"
- style="outline: none; display: none;"
- tabindex="-1"
- with-backdrop=""
- >
- <gr-dialog
- class="confirmDialog"
- confirm-label="Create"
- disabled=""
- id="createDialog"
- role="dialog"
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <gr-list-view>
+ <table class="genericList" id="list">
+ <tbody>
+ <tr class="headerRow">
+ <th class="name topHeader">Repository Name</th>
+ <th class="repositoryBrowser topHeader">
+ Repository Browser
+ </th>
+ <th class="changesLink topHeader">Changes</th>
+ <th class="readOnly topHeader">Read only</th>
+ <th class="description topHeader">Repository Description</th>
+ </tr>
+ <tr class="loadingMsg" id="loading">
+ <td>Loading...</td>
+ </tr>
+ </tbody>
+ <tbody>
+ <tr class="table">
+ <td class="name">
+ <a href="/admin/repos/test"> test </a>
+ </td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://phabricator.example.org/r/project/test0"
+ rel="noopener"
+ target="_blank"
+ >
+ diffusion
+ </a>
+ </td>
+ <td class="changesLink">
+ <a href=""> view all </a>
+ </td>
+ <td class="readOnly"></td>
+ <td class="description"></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/admin/repos/test"> test </a>
+ </td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://phabricator.example.org/r/project/test1"
+ rel="noopener"
+ target="_blank"
+ >
+ diffusion
+ </a>
+ </td>
+ <td class="changesLink">
+ <a href=""> view all </a>
+ </td>
+ <td class="readOnly"></td>
+ <td class="description"></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/admin/repos/test"> test </a>
+ </td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://phabricator.example.org/r/project/test2"
+ rel="noopener"
+ target="_blank"
+ >
+ diffusion
+ </a>
+ </td>
+ <td class="changesLink">
+ <a href=""> view all </a>
+ </td>
+ <td class="readOnly"></td>
+ <td class="description"></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/admin/repos/test"> test </a>
+ </td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://phabricator.example.org/r/project/test3"
+ rel="noopener"
+ target="_blank"
+ >
+ diffusion
+ </a>
+ </td>
+ <td class="changesLink">
+ <a href=""> view all </a>
+ </td>
+ <td class="readOnly"></td>
+ <td class="description"></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/admin/repos/test"> test </a>
+ </td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://phabricator.example.org/r/project/test4"
+ rel="noopener"
+ target="_blank"
+ >
+ diffusion
+ </a>
+ </td>
+ <td class="changesLink">
+ <a href=""> view all </a>
+ </td>
+ <td class="readOnly"></td>
+ <td class="description"></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/admin/repos/test"> test </a>
+ </td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://phabricator.example.org/r/project/test5"
+ rel="noopener"
+ target="_blank"
+ >
+ diffusion
+ </a>
+ </td>
+ <td class="changesLink">
+ <a href=""> view all </a>
+ </td>
+ <td class="readOnly"></td>
+ <td class="description"></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/admin/repos/test"> test </a>
+ </td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://phabricator.example.org/r/project/test6"
+ rel="noopener"
+ target="_blank"
+ >
+ diffusion
+ </a>
+ </td>
+ <td class="changesLink">
+ <a href=""> view all </a>
+ </td>
+ <td class="readOnly"></td>
+ <td class="description"></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/admin/repos/test"> test </a>
+ </td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://phabricator.example.org/r/project/test7"
+ rel="noopener"
+ target="_blank"
+ >
+ diffusion
+ </a>
+ </td>
+ <td class="changesLink">
+ <a href=""> view all </a>
+ </td>
+ <td class="readOnly"></td>
+ <td class="description"></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/admin/repos/test"> test </a>
+ </td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://phabricator.example.org/r/project/test8"
+ rel="noopener"
+ target="_blank"
+ >
+ diffusion
+ </a>
+ </td>
+ <td class="changesLink">
+ <a href=""> view all </a>
+ </td>
+ <td class="readOnly"></td>
+ <td class="description"></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/admin/repos/test"> test </a>
+ </td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://phabricator.example.org/r/project/test9"
+ rel="noopener"
+ target="_blank"
+ >
+ diffusion
+ </a>
+ </td>
+ <td class="changesLink">
+ <a href=""> view all </a>
+ </td>
+ <td class="readOnly"></td>
+ <td class="description"></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/admin/repos/test"> test </a>
+ </td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://phabricator.example.org/r/project/test10"
+ rel="noopener"
+ target="_blank"
+ >
+ diffusion
+ </a>
+ </td>
+ <td class="changesLink">
+ <a href=""> view all </a>
+ </td>
+ <td class="readOnly"></td>
+ <td class="description"></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/admin/repos/test"> test </a>
+ </td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://phabricator.example.org/r/project/test11"
+ rel="noopener"
+ target="_blank"
+ >
+ diffusion
+ </a>
+ </td>
+ <td class="changesLink">
+ <a href=""> view all </a>
+ </td>
+ <td class="readOnly"></td>
+ <td class="description"></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/admin/repos/test"> test </a>
+ </td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://phabricator.example.org/r/project/test12"
+ rel="noopener"
+ target="_blank"
+ >
+ diffusion
+ </a>
+ </td>
+ <td class="changesLink">
+ <a href=""> view all </a>
+ </td>
+ <td class="readOnly"></td>
+ <td class="description"></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/admin/repos/test"> test </a>
+ </td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://phabricator.example.org/r/project/test13"
+ rel="noopener"
+ target="_blank"
+ >
+ diffusion
+ </a>
+ </td>
+ <td class="changesLink">
+ <a href=""> view all </a>
+ </td>
+ <td class="readOnly"></td>
+ <td class="description"></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/admin/repos/test"> test </a>
+ </td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://phabricator.example.org/r/project/test14"
+ rel="noopener"
+ target="_blank"
+ >
+ diffusion
+ </a>
+ </td>
+ <td class="changesLink">
+ <a href=""> view all </a>
+ </td>
+ <td class="readOnly"></td>
+ <td class="description"></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/admin/repos/test"> test </a>
+ </td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://phabricator.example.org/r/project/test15"
+ rel="noopener"
+ target="_blank"
+ >
+ diffusion
+ </a>
+ </td>
+ <td class="changesLink">
+ <a href=""> view all </a>
+ </td>
+ <td class="readOnly"></td>
+ <td class="description"></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/admin/repos/test"> test </a>
+ </td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://phabricator.example.org/r/project/test16"
+ rel="noopener"
+ target="_blank"
+ >
+ diffusion
+ </a>
+ </td>
+ <td class="changesLink">
+ <a href=""> view all </a>
+ </td>
+ <td class="readOnly"></td>
+ <td class="description"></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/admin/repos/test"> test </a>
+ </td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://phabricator.example.org/r/project/test17"
+ rel="noopener"
+ target="_blank"
+ >
+ diffusion
+ </a>
+ </td>
+ <td class="changesLink">
+ <a href=""> view all </a>
+ </td>
+ <td class="readOnly"></td>
+ <td class="description"></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/admin/repos/test"> test </a>
+ </td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://phabricator.example.org/r/project/test18"
+ rel="noopener"
+ target="_blank"
+ >
+ diffusion
+ </a>
+ </td>
+ <td class="changesLink">
+ <a href=""> view all </a>
+ </td>
+ <td class="readOnly"></td>
+ <td class="description"></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/admin/repos/test"> test </a>
+ </td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://phabricator.example.org/r/project/test19"
+ rel="noopener"
+ target="_blank"
+ >
+ diffusion
+ </a>
+ </td>
+ <td class="changesLink">
+ <a href=""> view all </a>
+ </td>
+ <td class="readOnly"></td>
+ <td class="description"></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/admin/repos/test"> test </a>
+ </td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://phabricator.example.org/r/project/test20"
+ rel="noopener"
+ target="_blank"
+ >
+ diffusion
+ </a>
+ </td>
+ <td class="changesLink">
+ <a href=""> view all </a>
+ </td>
+ <td class="readOnly"></td>
+ <td class="description"></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/admin/repos/test"> test </a>
+ </td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://phabricator.example.org/r/project/test21"
+ rel="noopener"
+ target="_blank"
+ >
+ diffusion
+ </a>
+ </td>
+ <td class="changesLink">
+ <a href=""> view all </a>
+ </td>
+ <td class="readOnly"></td>
+ <td class="description"></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/admin/repos/test"> test </a>
+ </td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://phabricator.example.org/r/project/test22"
+ rel="noopener"
+ target="_blank"
+ >
+ diffusion
+ </a>
+ </td>
+ <td class="changesLink">
+ <a href=""> view all </a>
+ </td>
+ <td class="readOnly"></td>
+ <td class="description"></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/admin/repos/test"> test </a>
+ </td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://phabricator.example.org/r/project/test23"
+ rel="noopener"
+ target="_blank"
+ >
+ diffusion
+ </a>
+ </td>
+ <td class="changesLink">
+ <a href=""> view all </a>
+ </td>
+ <td class="readOnly"></td>
+ <td class="description"></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/admin/repos/test"> test </a>
+ </td>
+ <td class="repositoryBrowser">
+ <a
+ class="webLink"
+ href="https://phabricator.example.org/r/project/test24"
+ rel="noopener"
+ target="_blank"
+ >
+ diffusion
+ </a>
+ </td>
+ <td class="changesLink">
+ <a href=""> view all </a>
+ </td>
+ <td class="readOnly"></td>
+ <td class="description"></td>
+ </tr>
+ </tbody>
+ </table>
+ </gr-list-view>
+ <gr-overlay
+ aria-hidden="true"
+ id="createOverlay"
+ style="outline: none; display: none;"
+ tabindex="-1"
+ with-backdrop=""
>
- <div class="header" slot="header">Create Repository</div>
- <div class="main" slot="main">
- <gr-create-repo-dialog id="createNewModal">
- </gr-create-repo-dialog>
- </div>
- </gr-dialog>
- </gr-overlay>
- `);
+ <gr-dialog
+ class="confirmDialog"
+ confirm-label="Create"
+ disabled=""
+ id="createDialog"
+ role="dialog"
+ >
+ <div class="header" slot="header">Create Repository</div>
+ <div class="main" slot="main">
+ <gr-create-repo-dialog id="createNewModal">
+ </gr-create-repo-dialog>
+ </div>
+ </gr-dialog>
+ </gr-overlay>
+ `
+ );
});
test('test for test repo in the list', async () => {
diff --git a/polygerrit-ui/app/elements/admin/gr-repo-plugin-config/gr-repo-plugin-config_test.ts b/polygerrit-ui/app/elements/admin/gr-repo-plugin-config/gr-repo-plugin-config_test.ts
index 38f3e2e..38d1c4f 100644
--- a/polygerrit-ui/app/elements/admin/gr-repo-plugin-config/gr-repo-plugin-config_test.ts
+++ b/polygerrit-ui/app/elements/admin/gr-repo-plugin-config/gr-repo-plugin-config_test.ts
@@ -11,15 +11,15 @@
import {queryAndAssert} from '../../../test/test-utils';
import {GrPluginConfigArrayEditor} from '../gr-plugin-config-array-editor/gr-plugin-config-array-editor';
import {PaperToggleButtonElement} from '@polymer/paper-toggle-button/paper-toggle-button';
-
-const basicFixture = fixtureFromElement('gr-repo-plugin-config');
+import {fixture, html} from '@open-wc/testing';
suite('gr-repo-plugin-config tests', () => {
let element: GrRepoPluginConfig;
setup(async () => {
- element = basicFixture.instantiate();
- await element.updateComplete;
+ element = await fixture(
+ html`<gr-repo-plugin-config></gr-repo-plugin-config>`
+ );
});
test('render', async () => {
@@ -31,23 +31,26 @@
};
await element.updateComplete;
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div class="gr-form-styles">
- <fieldset>
- <h4>testName</h4>
- <section class="STRING section">
- <span class="title">
- <span> </span>
- </span>
- <span class="value">
- <iron-input data-option-key="plugin">
- <input data-option-key="plugin" disabled="" is="iron-input" />
- </iron-input>
- </span>
- </section>
- </fieldset>
- </div>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div class="gr-form-styles">
+ <fieldset>
+ <h4>testName</h4>
+ <section class="STRING section">
+ <span class="title">
+ <span> </span>
+ </span>
+ <span class="value">
+ <iron-input data-option-key="plugin">
+ <input data-option-key="plugin" disabled="" is="iron-input" />
+ </iron-input>
+ </span>
+ </section>
+ </fieldset>
+ </div>
+ `
+ );
});
test('_computePluginConfigOptions', () => {
diff --git a/polygerrit-ui/app/elements/admin/gr-repo/gr-repo_test.ts b/polygerrit-ui/app/elements/admin/gr-repo/gr-repo_test.ts
index c3e536d..6a10f78 100644
--- a/polygerrit-ui/app/elements/admin/gr-repo/gr-repo_test.ts
+++ b/polygerrit-ui/app/elements/admin/gr-repo/gr-repo_test.ts
@@ -44,8 +44,7 @@
import {GrSelect} from '../../shared/gr-select/gr-select';
import {GrTextarea} from '../../shared/gr-textarea/gr-textarea';
import {IronInputElement} from '@polymer/iron-input/iron-input';
-
-const basicFixture = fixtureFromElement('gr-repo');
+import {fixture, html} from '@open-wc/testing';
suite('gr-repo tests', () => {
let element: GrRepo;
@@ -155,14 +154,14 @@
repoStub = stubRestApi('getProjectConfig').returns(
Promise.resolve(repoConf)
);
- element = basicFixture.instantiate();
- await element.updateComplete;
+ element = await fixture(html`<gr-repo></gr-repo>`);
});
test('render', () => {
// prettier and shadowDom assert do not agree about span.title wrapping
- expect(element).shadowDom.to
- .equal(/* prettier-ignore */ /* HTML */ `
+ assert.shadowDom.equal(
+ element,
+ /* prettier-ignore */ /* HTML */ `
<div class="gr-form-styles main read-only">
<div class="info">
<h1 class="heading-1" id="Title"></h1>
@@ -399,7 +398,8 @@
</div>
</div>
</div>
- `);
+ `
+ );
});
test('_computePluginData', async () => {
diff --git a/polygerrit-ui/app/elements/admin/gr-rule-editor/gr-rule-editor_test.ts b/polygerrit-ui/app/elements/admin/gr-rule-editor/gr-rule-editor_test.ts
index 3a5a8a2..a459df8 100644
--- a/polygerrit-ui/app/elements/admin/gr-rule-editor/gr-rule-editor_test.ts
+++ b/polygerrit-ui/app/elements/admin/gr-rule-editor/gr-rule-editor_test.ts
@@ -11,7 +11,7 @@
import {GrButton} from '../../shared/gr-button/gr-button';
import {GrSelect} from '../../shared/gr-select/gr-select';
import * as MockInteractions from '@polymer/iron-test-helpers/mock-interactions';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import {EditablePermissionRuleInfo} from '../gr-repo-access/gr-repo-access-interfaces';
import {PermissionAction} from '../../../constants/constants';
@@ -27,44 +27,47 @@
suite('dom tests', () => {
test('default', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div class="gr-form-styles" id="mainContainer">
- <div id="options">
- <gr-select id="action">
- <select disabled="">
- <option value="ALLOW">ALLOW</option>
- <option value="DENY">DENY</option>
- <option value="BLOCK">BLOCK</option>
- </select>
- </gr-select>
- <a class="groupPath"> </a>
- <gr-select id="force">
- <select disabled=""></select>
- </gr-select>
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div class="gr-form-styles" id="mainContainer">
+ <div id="options">
+ <gr-select id="action">
+ <select disabled="">
+ <option value="ALLOW">ALLOW</option>
+ <option value="DENY">DENY</option>
+ <option value="BLOCK">BLOCK</option>
+ </select>
+ </gr-select>
+ <a class="groupPath"> </a>
+ <gr-select id="force">
+ <select disabled=""></select>
+ </gr-select>
+ </div>
+ <gr-button
+ aria-disabled="false"
+ id="removeBtn"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Remove
+ </gr-button>
</div>
- <gr-button
- aria-disabled="false"
- id="removeBtn"
- link=""
- role="button"
- tabindex="0"
- >
- Remove
- </gr-button>
- </div>
- <div class="gr-form-styles" id="deletedContainer">
- was deleted
- <gr-button
- aria-disabled="false"
- id="undoRemoveBtn"
- link=""
- role="button"
- tabindex="0"
- >
- Undo
- </gr-button>
- </div>
- `);
+ <div class="gr-form-styles" id="deletedContainer">
+ was deleted
+ <gr-button
+ aria-disabled="false"
+ id="undoRemoveBtn"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Undo
+ </gr-button>
+ </div>
+ `
+ );
});
test('push options', async () => {
@@ -80,26 +83,31 @@
.permission=${AccessPermissionId.PUSH}
></gr-rule-editor>
`);
- expect(queryAndAssert(element, '#options')).dom.to.equal(/* HTML */ `
- <div id="options">
- <gr-select id="action">
- <select>
- <option value="ALLOW">ALLOW</option>
- <option value="DENY">DENY</option>
- <option value="BLOCK">BLOCK</option>
- </select>
- </gr-select>
- <a class="groupPath"> </a>
- <gr-select class="force" id="force">
- <select>
- <option value="false">
- Allow pushing (but not force pushing)
- </option>
- <option value="true">Allow pushing with or without force</option>
- </select>
- </gr-select>
- </div>
- `);
+ assert.dom.equal(
+ queryAndAssert(element, '#options'),
+ /* HTML */ `
+ <div id="options">
+ <gr-select id="action">
+ <select>
+ <option value="ALLOW">ALLOW</option>
+ <option value="DENY">DENY</option>
+ <option value="BLOCK">BLOCK</option>
+ </select>
+ </gr-select>
+ <a class="groupPath"> </a>
+ <gr-select class="force" id="force">
+ <select>
+ <option value="false">
+ Allow pushing (but not force pushing)
+ </option>
+ <option value="true">
+ Allow pushing with or without force
+ </option>
+ </select>
+ </gr-select>
+ </div>
+ `
+ );
});
});
diff --git a/polygerrit-ui/app/elements/change-list/gr-change-list-action-bar/gr-change-list-action-bar_test.ts b/polygerrit-ui/app/elements/change-list/gr-change-list-action-bar/gr-change-list-action-bar_test.ts
index 73fd395..bfb30c6 100644
--- a/polygerrit-ui/app/elements/change-list/gr-change-list-action-bar/gr-change-list-action-bar_test.ts
+++ b/polygerrit-ui/app/elements/change-list/gr-change-list-action-bar/gr-change-list-action-bar_test.ts
@@ -3,7 +3,7 @@
* Copyright 2022 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import {
BulkActionsModel,
bulkActionsModelToken,
@@ -55,21 +55,24 @@
test('renders action bar', async () => {
await selectChange(change1);
- expect(element).shadowDom.to.equal(/* HTML */ `
- <td>
- <div class="container">
- <div class="selectionInfo">
- <span>1 change selected</span>
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <td>
+ <div class="container">
+ <div class="selectionInfo">
+ <span>1 change selected</span>
+ </div>
+ <div class="actionButtons">
+ <gr-change-list-bulk-vote-flow></gr-change-list-bulk-vote-flow>
+ <gr-change-list-topic-flow></gr-change-list-topic-flow>
+ <gr-change-list-hashtag-flow></gr-change-list-hashtag-flow>
+ <gr-change-list-reviewer-flow></gr-change-list-reviewer-flow>
+ </div>
</div>
- <div class="actionButtons">
- <gr-change-list-bulk-vote-flow></gr-change-list-bulk-vote-flow>
- <gr-change-list-topic-flow></gr-change-list-topic-flow>
- <gr-change-list-hashtag-flow></gr-change-list-hashtag-flow>
- <gr-change-list-reviewer-flow></gr-change-list-reviewer-flow>
- </div>
- </div>
- </td>
- `);
+ </td>
+ `
+ );
});
test('label reflects number of selected changes', async () => {
diff --git a/polygerrit-ui/app/elements/change-list/gr-change-list-bulk-abandon-flow/gr-change-list-bulk-abandon-flow_test.ts b/polygerrit-ui/app/elements/change-list/gr-change-list-bulk-abandon-flow/gr-change-list-bulk-abandon-flow_test.ts
index e8dc655..ded006e 100644
--- a/polygerrit-ui/app/elements/change-list/gr-change-list-bulk-abandon-flow/gr-change-list-bulk-abandon-flow_test.ts
+++ b/polygerrit-ui/app/elements/change-list/gr-change-list-bulk-abandon-flow/gr-change-list-bulk-abandon-flow_test.ts
@@ -19,7 +19,7 @@
LoadingState,
} from '../../../models/bulk-actions/bulk-actions-model';
import './gr-change-list-bulk-abandon-flow';
-import {fixture, waitUntil} from '@open-wc/testing-helpers';
+import {fixture, waitUntil} from '@open-wc/testing';
import {wrapInProvider} from '../../../models/di-provider-element';
import {html} from 'lit';
import {getAppContext} from '../../../services/app-context';
@@ -79,44 +79,47 @@
await selectChange(change1);
await element.updateComplete;
- expect(element).shadowDom.to.equal(/* HTML */ `
- <gr-button
- aria-disabled="false"
- flatten=""
- id="abandon"
- role="button"
- tabindex="0"
- >
- Abandon
- </gr-button>
- <gr-overlay
- aria-hidden="true"
- id="actionOverlay"
- style="outline: none; display: none;"
- tabindex="-1"
- with-backdrop=""
- >
- <gr-dialog role="dialog">
- <div slot="header">1 changes to abandon</div>
- <div slot="main">
- <table>
- <thead>
- <tr>
- <th>Subject</th>
- <th>Status</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>Change: Test subject</td>
- <td id="status">Status: NOT STARTED</td>
- </tr>
- </tbody>
- </table>
- </div>
- </gr-dialog>
- </gr-overlay>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <gr-button
+ aria-disabled="false"
+ flatten=""
+ id="abandon"
+ role="button"
+ tabindex="0"
+ >
+ Abandon
+ </gr-button>
+ <gr-overlay
+ aria-hidden="true"
+ id="actionOverlay"
+ style="outline: none; display: none;"
+ tabindex="-1"
+ with-backdrop=""
+ >
+ <gr-dialog role="dialog">
+ <div slot="header">1 changes to abandon</div>
+ <div slot="main">
+ <table>
+ <thead>
+ <tr>
+ <th>Subject</th>
+ <th>Status</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>Change: Test subject</td>
+ <td id="status">Status: NOT STARTED</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </gr-dialog>
+ </gr-overlay>
+ `
+ );
});
test('button state updates as changes are updated', async () => {
diff --git a/polygerrit-ui/app/elements/change-list/gr-change-list-bulk-vote-flow/gr-change-list-bulk-vote-flow.ts b/polygerrit-ui/app/elements/change-list/gr-change-list-bulk-vote-flow/gr-change-list-bulk-vote-flow.ts
index 44b2123..8a3c9e1 100644
--- a/polygerrit-ui/app/elements/change-list/gr-change-list-bulk-vote-flow/gr-change-list-bulk-vote-flow.ts
+++ b/polygerrit-ui/app/elements/change-list/gr-change-list-bulk-vote-flow/gr-change-list-bulk-vote-flow.ts
@@ -15,7 +15,6 @@
computeLabels,
computeOrderedLabelValues,
mergeLabelInfoMaps,
- getDefaultValue,
mergeLabelMaps,
Label,
StandardLabels,
@@ -377,14 +376,7 @@
: selectorEl.selectedValue;
if (selectedVal === undefined) continue;
-
- const defValNum = getDefaultValue(
- this.selectedChanges[0].labels,
- label.name
- );
- if (selectedVal !== defValNum) {
- labels[label.name] = selectedVal;
- }
+ labels[label.name] = selectedVal;
}
return labels;
}
diff --git a/polygerrit-ui/app/elements/change-list/gr-change-list-bulk-vote-flow/gr-change-list-bulk-vote-flow_test.ts b/polygerrit-ui/app/elements/change-list/gr-change-list-bulk-vote-flow/gr-change-list-bulk-vote-flow_test.ts
index 6f9e4a0..048751b 100644
--- a/polygerrit-ui/app/elements/change-list/gr-change-list-bulk-vote-flow/gr-change-list-bulk-vote-flow_test.ts
+++ b/polygerrit-ui/app/elements/change-list/gr-change-list-bulk-vote-flow/gr-change-list-bulk-vote-flow_test.ts
@@ -21,13 +21,14 @@
} from '../../../test/test-utils';
import {ChangeInfo, NumericChangeId, LabelInfo} from '../../../api/rest-api';
import {getAppContext} from '../../../services/app-context';
-import {fixture, waitUntil} from '@open-wc/testing-helpers';
+import {fixture, waitUntil} from '@open-wc/testing';
import {wrapInProvider} from '../../../models/di-provider-element';
import {html} from 'lit';
import {SinonStubbedMember} from 'sinon';
import {RestApiService} from '../../../services/gr-rest-api/gr-rest-api';
import {
createChange,
+ createDetailedLabelInfo,
createSubmitRequirementResultInfo,
} from '../../../test/test-data-generators';
import './gr-change-list-bulk-vote-flow';
@@ -134,7 +135,9 @@
);
await selectChange(change1);
await element.updateComplete;
- expect(element).shadowDom.to.equal(`<gr-button
+ assert.shadowDom.equal(
+ element,
+ `<gr-button
aria-disabled="false"
flatten=""
id="voteFlowButton"
@@ -193,7 +196,8 @@
</div>
</div>
</gr-dialog>
- </gr-overlay> `);
+ </gr-overlay> `
+ );
});
test('renders with errors', async () => {
@@ -222,7 +226,9 @@
ProgressStatus.FAILED
);
- expect(element).shadowDom.to.equal(`<gr-button
+ assert.shadowDom.equal(
+ element,
+ `<gr-button
aria-disabled="false"
flatten=""
id="voteFlowButton"
@@ -285,7 +291,8 @@
</div>
</div>
</gr-dialog>
- </gr-overlay> `);
+ </gr-overlay> `
+ );
});
test('button state updates as changes are updated', async () => {
@@ -332,18 +339,40 @@
});
test('progress updates as request is resolved', async () => {
- const changes: ChangeInfo[] = [{...change1}];
+ const change = {
+ ...change1,
+ labels: {
+ ...change1.labels,
+ C: {
+ ...createDetailedLabelInfo(),
+ all: [
+ {
+ ...element.account!,
+ value: -1,
+ },
+ ],
+ },
+ },
+ };
+ const changes: ChangeInfo[] = [{...change}];
getChangesStub.returns(Promise.resolve(changes));
model.sync(changes);
await waitUntilObserved(
model.loadingState$,
state => state === LoadingState.LOADED
);
- await selectChange(change1);
+ await selectChange(change);
await element.updateComplete;
const saveChangeReview = mockPromise<Response>();
stubRestApi('saveChangeReview').returns(saveChangeReview);
+ const stopsStub = sinon.stub(element.actionOverlay, 'setFocusStops');
+
+ queryAndAssert<GrButton>(element, '#voteFlowButton').click();
+ await waitUntil(() => stopsStub.called);
+
+ await element.updateComplete;
+
assert.isNotOk(
queryAndAssert<GrButton>(query(element, 'gr-dialog'), '#confirm').disabled
);
@@ -354,6 +383,7 @@
const scores = queryAll(element, 'gr-label-score-row');
queryAndAssert<GrButton>(scores[0], 'gr-button[data-value="+1"]').click();
queryAndAssert<GrButton>(scores[1], 'gr-button[data-value="-1"]').click();
+ queryAndAssert<GrButton>(scores[2], 'gr-button[data-value="0"]').click();
await element.updateComplete;
@@ -364,6 +394,7 @@
{
A: 1,
B: -1,
+ C: 0,
}
);
diff --git a/polygerrit-ui/app/elements/change-list/gr-change-list-column-requirement/gr-change-list-column-requirement_test.ts b/polygerrit-ui/app/elements/change-list/gr-change-list-column-requirement/gr-change-list-column-requirement_test.ts
index 1ca21a4..92d2de0 100644
--- a/polygerrit-ui/app/elements/change-list/gr-change-list-column-requirement/gr-change-list-column-requirement_test.ts
+++ b/polygerrit-ui/app/elements/change-list/gr-change-list-column-requirement/gr-change-list-column-requirement_test.ts
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
import '../../../test/common-test-setup-karma';
-import {fixture} from '@open-wc/testing-helpers';
+import {fixture} from '@open-wc/testing';
import {html} from 'lit';
import './gr-change-list-column-requirement';
import {GrChangeListColumnRequirement} from './gr-change-list-column-requirement';
@@ -54,7 +54,8 @@
>
</gr-change-list-column-requirement>`
);
- expect(element).shadowDom.to.equal(
+ assert.shadowDom.equal(
+ element,
/* HTML */
` <div class="container" title="Satisfied">
<gr-icon class="check_circle" filled icon="check_circle"></gr-icon>
@@ -97,14 +98,16 @@
>
</gr-change-list-column-requirement>`
);
- expect(element).shadowDom.to.equal(
+ assert.shadowDom.equal(
+ element,
/* HTML */
` <div class="container">
<gr-vote-chip tooltip-with-who-voted=""></gr-vote-chip>
</div>`
);
const voteChip = queryAndAssert(element, 'gr-vote-chip');
- expect(voteChip).shadowDom.to.equal(
+ assert.shadowDom.equal(
+ voteChip,
/* HTML */
` <gr-tooltip-content
class="container"
@@ -144,14 +147,16 @@
>
</gr-change-list-column-requirement>`
);
- expect(element).shadowDom.to.equal(
+ assert.shadowDom.equal(
+ element,
/* HTML */
` <div class="container">
<gr-vote-chip tooltip-with-who-voted=""></gr-vote-chip>
</div>`
);
const voteChip = queryAndAssert(element, 'gr-vote-chip');
- expect(voteChip).shadowDom.to.equal(
+ assert.shadowDom.equal(
+ voteChip,
/* HTML */
` <gr-tooltip-content
class="container"
diff --git a/polygerrit-ui/app/elements/change-list/gr-change-list-column-requirements-summary/gr-change-list-column-requirements-summary.ts b/polygerrit-ui/app/elements/change-list/gr-change-list-column-requirements-summary/gr-change-list-column-requirements-summary.ts
index 3e6a2b1..dc36ae5 100644
--- a/polygerrit-ui/app/elements/change-list/gr-change-list-column-requirements-summary/gr-change-list-column-requirements-summary.ts
+++ b/polygerrit-ui/app/elements/change-list/gr-change-list-column-requirements-summary/gr-change-list-column-requirements-summary.ts
@@ -35,7 +35,7 @@
margin-right: var(--spacing-xs);
}
gr-icon.commentIcon {
- color: var(--deemphasized-text-color);
+ color: var(--warning-foreground);
margin-left: var(--spacing-s);
}
span {
@@ -134,7 +134,7 @@
if (!this.change?.unresolved_comment_count) return;
return html`<gr-icon
class="commentIcon"
- icon="mode_comment"
+ icon="feedback"
filled
.title=${pluralize(
this.change?.unresolved_comment_count,
diff --git a/polygerrit-ui/app/elements/change-list/gr-change-list-column-requirements-summary/gr-change-list-column-requirements-summary_test.ts b/polygerrit-ui/app/elements/change-list/gr-change-list-column-requirements-summary/gr-change-list-column-requirements-summary_test.ts
index eecb009..e235fec 100644
--- a/polygerrit-ui/app/elements/change-list/gr-change-list-column-requirements-summary/gr-change-list-column-requirements-summary_test.ts
+++ b/polygerrit-ui/app/elements/change-list/gr-change-list-column-requirements-summary/gr-change-list-column-requirements-summary_test.ts
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
import '../../../test/common-test-setup-karma';
-import {fixture} from '@open-wc/testing-helpers';
+import {fixture} from '@open-wc/testing';
import {html} from 'lit';
import './gr-change-list-column-requirements-summary';
import {GrChangeListColumnRequirementsSummary} from './gr-change-list-column-requirements-summary';
@@ -57,16 +57,15 @@
html`<gr-change-list-column-requirements-summary .change=${change}>
</gr-change-list-column-requirements-summary>`
);
- expect(element).shadowDom.to.equal(/* HTML */ ` <span
- class="block"
- role="button"
- tabindex="0"
- >
- <gr-submit-requirement-dashboard-hovercard>
- </gr-submit-requirement-dashboard-hovercard>
- <gr-icon class="block" role="img" icon="block"></gr-icon>
- <span class="unsatisfied">1 missing</span>
- </span>`);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ ` <span class="block" role="button" tabindex="0">
+ <gr-submit-requirement-dashboard-hovercard>
+ </gr-submit-requirement-dashboard-hovercard>
+ <gr-icon class="block" role="img" icon="block"></gr-icon>
+ <span class="unsatisfied">1 missing</span>
+ </span>`
+ );
});
test('renders comment count', async () => {
@@ -78,21 +77,20 @@
html`<gr-change-list-column-requirements-summary .change=${change}>
</gr-change-list-column-requirements-summary>`
);
- expect(element).shadowDom.to.equal(/* HTML */ ` <span
- class="block"
- role="button"
- tabindex="0"
- >
- <gr-submit-requirement-dashboard-hovercard>
- </gr-submit-requirement-dashboard-hovercard>
- <gr-icon class="block" role="img" icon="block"></gr-icon>
- <span class="unsatisfied">1 missing</span>
- </span>
- <gr-icon
- class="commentIcon"
- filled
- icon="mode_comment"
- title="5 unresolved comments"
- ></gr-icon>`);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ ` <span class="block" role="button" tabindex="0">
+ <gr-submit-requirement-dashboard-hovercard>
+ </gr-submit-requirement-dashboard-hovercard>
+ <gr-icon class="block" role="img" icon="block"></gr-icon>
+ <span class="unsatisfied">1 missing</span>
+ </span>
+ <gr-icon
+ class="commentIcon"
+ filled
+ icon="feedback"
+ title="5 unresolved comments"
+ ></gr-icon>`
+ );
});
});
diff --git a/polygerrit-ui/app/elements/change-list/gr-change-list-hashtag-flow/gr-change-list-hashtag-flow_test.ts b/polygerrit-ui/app/elements/change-list/gr-change-list-hashtag-flow/gr-change-list-hashtag-flow_test.ts
index 9bf605d..2dad8ee 100644
--- a/polygerrit-ui/app/elements/change-list/gr-change-list-hashtag-flow/gr-change-list-hashtag-flow_test.ts
+++ b/polygerrit-ui/app/elements/change-list/gr-change-list-hashtag-flow/gr-change-list-hashtag-flow_test.ts
@@ -3,7 +3,7 @@
* Copyright 2022 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import {IronDropdownElement} from '@polymer/iron-dropdown';
import {SinonStubbedMember} from 'sinon';
import {
@@ -85,25 +85,28 @@
});
test('skips dropdown render when closed', async () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <gr-button
- id="start-flow"
- flatten=""
- down-arrow=""
- aria-disabled="false"
- role="button"
- tabindex="0"
- >Hashtag</gr-button
- >
- <iron-dropdown
- aria-disabled="false"
- aria-hidden="true"
- style="outline: none; display: none;"
- vertical-align="auto"
- horizontal-align="auto"
- >
- </iron-dropdown>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <gr-button
+ id="start-flow"
+ flatten=""
+ down-arrow=""
+ aria-disabled="false"
+ role="button"
+ tabindex="0"
+ >Hashtag</gr-button
+ >
+ <iron-dropdown
+ aria-disabled="false"
+ aria-hidden="true"
+ style="outline: none; display: none;"
+ vertical-align="auto"
+ horizontal-align="auto"
+ >
+ </iron-dropdown>
+ `
+ );
});
test('dropdown hidden before flow button clicked', async () => {
@@ -227,7 +230,8 @@
});
test('renders hashtags flow', () => {
- expect(element).shadowDom.to.equal(
+ assert.shadowDom.equal(
+ element,
/* HTML */ `
<gr-button
id="start-flow"
diff --git a/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item.ts b/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item.ts
index 71dd5e2..1e973bd 100644
--- a/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item.ts
+++ b/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item.ts
@@ -38,10 +38,11 @@
import {submitRequirementsStyles} from '../../../styles/gr-submit-requirements-styles';
import {ifDefined} from 'lit/directives/if-defined.js';
import {KnownExperimentId} from '../../../services/flags/flags';
-import {ColumnNames, WAITING} from '../../../constants/constants';
+import {ChangeStatus, ColumnNames, WAITING} from '../../../constants/constants';
import {bulkActionsModelToken} from '../../../models/bulk-actions/bulk-actions-model';
import {resolve} from '../../../models/dependency';
import {subscribe} from '../../lit/subscription-controller';
+import {classMap} from 'lit/directives/class-map.js';
enum ChangeSize {
XS = 10,
@@ -170,6 +171,10 @@
.container {
position: relative;
}
+ .strikethrough {
+ color: var(--deemphasized-text-color);
+ text-decoration: line-through;
+ }
.content {
overflow: hidden;
position: absolute;
@@ -359,7 +364,14 @@
@click=${this.handleChangeClick}
>
<div class="container">
- <div class="content">${this.change?.subject}</div>
+ <div
+ class=${classMap({
+ content: true,
+ strikethrough: this.change?.status === ChangeStatus.ABANDONED,
+ })}
+ >
+ ${this.change?.subject}
+ </div>
<div class="spacer">${this.change?.subject}</div>
<span> </span>
</div>
diff --git a/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item_test.ts b/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item_test.ts
index ed8c69f..0f7e8c3 100644
--- a/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item_test.ts
+++ b/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item_test.ts
@@ -3,7 +3,7 @@
* Copyright 2015 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
-import {fixture} from '@open-wc/testing-helpers';
+import {fixture} from '@open-wc/testing';
import {html} from 'lit';
import {
SubmitRequirementResultInfo,
@@ -368,37 +368,44 @@
// TODO: Check table elements. The shadowDom helper does not understand
// tables interacting with display: contents, even wrapping the element in a
// table, does not help.
- expect(element).shadowDom.to.equal(/* HTML */ `
- <gr-change-star></gr-change-star>
- <a href="">42</a>
- <a href="" title="Test subject">
- <div class="container">
- <div class="content">Test subject</div>
- <div class="spacer">Test subject</div>
- <span></span>
- </div>
- </a>
- <span class="placeholder"> -- </span>
- <gr-account-label
- deselected=""
- clickable=""
- highlightattention=""
- ></gr-account-label>
- <div></div>
- <span></span>
- <a class="fullRepo" href=""> test-project </a>
- <a class="truncatedRepo" href="" title="test-project"> test-project </a>
- <a href=""> test-branch </a>
- <gr-date-formatter withtooltip=""></gr-date-formatter>
- <gr-date-formatter withtooltip=""></gr-date-formatter>
- <gr-date-formatter forcerelative="" relativeoptionnoago="" withtooltip="">
- </gr-date-formatter>
- <gr-tooltip-content has-tooltip="" title="Size unknown">
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <gr-change-star></gr-change-star>
+ <a href="">42</a>
+ <a href="" title="Test subject">
+ <div class="container">
+ <div class="content">Test subject</div>
+ <div class="spacer">Test subject</div>
+ <span></span>
+ </div>
+ </a>
<span class="placeholder"> -- </span>
- </gr-tooltip-content>
- <gr-change-list-column-requirements-summary>
- </gr-change-list-column-requirements-summary>
- `);
+ <gr-account-label
+ deselected=""
+ clickable=""
+ highlightattention=""
+ ></gr-account-label>
+ <div></div>
+ <span></span>
+ <a class="fullRepo" href=""> test-project </a>
+ <a class="truncatedRepo" href="" title="test-project"> test-project </a>
+ <a href=""> test-branch </a>
+ <gr-date-formatter withtooltip=""></gr-date-formatter>
+ <gr-date-formatter withtooltip=""></gr-date-formatter>
+ <gr-date-formatter
+ forcerelative=""
+ relativeoptionnoago=""
+ withtooltip=""
+ >
+ </gr-date-formatter>
+ <gr-tooltip-content has-tooltip="" title="Size unknown">
+ <span class="placeholder"> -- </span>
+ </gr-tooltip-content>
+ <gr-change-list-column-requirements-summary>
+ </gr-change-list-column-requirements-summary>
+ `
+ );
});
test('renders requirement with new submit requirements', async () => {
@@ -430,8 +437,10 @@
).element as GrChangeListItem;
const requirement = queryAndAssert(element, '.requirement');
- expect(requirement).dom.to
- .equal(/* HTML */ ` <gr-change-list-column-requirement>
- </gr-change-list-column-requirement>`);
+ assert.dom.equal(
+ requirement,
+ /* HTML */ ` <gr-change-list-column-requirement>
+ </gr-change-list-column-requirement>`
+ );
});
});
diff --git a/polygerrit-ui/app/elements/change-list/gr-change-list-reviewer-flow/gr-change-list-reviewer-flow_test.ts b/polygerrit-ui/app/elements/change-list/gr-change-list-reviewer-flow/gr-change-list-reviewer-flow_test.ts
index ef48323..be0ea6e 100644
--- a/polygerrit-ui/app/elements/change-list/gr-change-list-reviewer-flow/gr-change-list-reviewer-flow_test.ts
+++ b/polygerrit-ui/app/elements/change-list/gr-change-list-reviewer-flow/gr-change-list-reviewer-flow_test.ts
@@ -3,7 +3,7 @@
* Copyright 2022 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import {SinonStubbedMember} from 'sinon';
import {
AccountInfo,
@@ -111,23 +111,26 @@
});
test('skips dialog render when closed', async () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <gr-button
- id="start-flow"
- flatten=""
- aria-disabled="false"
- role="button"
- tabindex="0"
- >add reviewer/cc</gr-button
- >
- <gr-overlay
- id="flow"
- aria-hidden="true"
- with-backdrop=""
- tabindex="-1"
- style="outline: none; display: none;"
- ></gr-overlay>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <gr-button
+ id="start-flow"
+ flatten=""
+ aria-disabled="false"
+ role="button"
+ tabindex="0"
+ >add reviewer/cc</gr-button
+ >
+ <gr-overlay
+ id="flow"
+ aria-hidden="true"
+ with-backdrop=""
+ tabindex="-1"
+ style="outline: none; display: none;"
+ ></gr-overlay>
+ `
+ );
});
test('flow button enabled when changes selected', async () => {
@@ -188,80 +191,99 @@
});
test('renders dialog when opened', async () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <gr-button
- id="start-flow"
- flatten=""
- aria-disabled="false"
- role="button"
- tabindex="0"
- >add reviewer/cc</gr-button
- >
- <gr-overlay
- id="flow"
- with-backdrop=""
- tabindex="-1"
- style="outline: none; display: none;"
- >
- <gr-dialog role="dialog">
- <div slot="header">Add reviewer / CC</div>
- <div slot="main">
- <div class="grid">
- <span>Reviewers</span>
- <gr-account-list id="reviewer-list"></gr-account-list>
- <gr-overlay
- aria-hidden="true"
- id="confirm-reviewer"
- style="outline: none; display: none;"
- >
- <div class="confirmation-text">
- Group
- <span class="groupName"></span>
- has
- <span class="groupSize"></span>
- members.
- <br />
- Are you sure you want to add them all?
- </div>
- <div class="confirmation-buttons">
- <gr-button aria-disabled="false" role="button" tabindex="0">
- Yes
- </gr-button>
- <gr-button aria-disabled="false" role="button" tabindex="0">
- No
- </gr-button>
- </div>
- </gr-overlay>
- <span>CC</span>
- <gr-account-list id="cc-list"></gr-account-list>
- <gr-overlay
- aria-hidden="true"
- id="confirm-cc"
- style="outline: none; display: none;"
- >
- <div class="confirmation-text">
- Group
- <span class="groupName"></span>
- has
- <span class="groupSize"></span>
- members.
- <br />
- Are you sure you want to add them all?
- </div>
- <div class="confirmation-buttons">
- <gr-button aria-disabled="false" role="button" tabindex="0">
- Yes
- </gr-button>
- <gr-button aria-disabled="false" role="button" tabindex="0">
- No
- </gr-button>
- </div>
- </gr-overlay>
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <gr-button
+ id="start-flow"
+ flatten=""
+ aria-disabled="false"
+ role="button"
+ tabindex="0"
+ >add reviewer/cc</gr-button
+ >
+ <gr-overlay
+ id="flow"
+ with-backdrop=""
+ tabindex="-1"
+ style="outline: none; display: none;"
+ >
+ <gr-dialog role="dialog">
+ <div slot="header">Add reviewer / CC</div>
+ <div slot="main">
+ <div class="grid">
+ <span>Reviewers</span>
+ <gr-account-list id="reviewer-list"></gr-account-list>
+ <gr-overlay
+ aria-hidden="true"
+ id="confirm-reviewer"
+ style="outline: none; display: none;"
+ >
+ <div class="confirmation-text">
+ Group
+ <span class="groupName"></span>
+ has
+ <span class="groupSize"></span>
+ members.
+ <br />
+ Are you sure you want to add them all?
+ </div>
+ <div class="confirmation-buttons">
+ <gr-button
+ aria-disabled="false"
+ role="button"
+ tabindex="0"
+ >
+ Yes
+ </gr-button>
+ <gr-button
+ aria-disabled="false"
+ role="button"
+ tabindex="0"
+ >
+ No
+ </gr-button>
+ </div>
+ </gr-overlay>
+ <span>CC</span>
+ <gr-account-list id="cc-list"></gr-account-list>
+ <gr-overlay
+ aria-hidden="true"
+ id="confirm-cc"
+ style="outline: none; display: none;"
+ >
+ <div class="confirmation-text">
+ Group
+ <span class="groupName"></span>
+ has
+ <span class="groupSize"></span>
+ members.
+ <br />
+ Are you sure you want to add them all?
+ </div>
+ <div class="confirmation-buttons">
+ <gr-button
+ aria-disabled="false"
+ role="button"
+ tabindex="0"
+ >
+ Yes
+ </gr-button>
+ <gr-button
+ aria-disabled="false"
+ role="button"
+ tabindex="0"
+ >
+ No
+ </gr-button>
+ </div>
+ </gr-overlay>
+ </div>
</div>
- </div>
- </gr-dialog>
- </gr-overlay>
- `);
+ </gr-dialog>
+ </gr-overlay>
+ `
+ );
});
test('only lists reviewers/CCs shared by all changes', async () => {
@@ -611,7 +633,8 @@
await element.updateComplete;
// prettier and shadowDom string don't agree on the long text in divs
- expect(element).shadowDom.to.equal(
+ assert.shadowDom.equal(
+ element,
/* prettier-ignore */
/* HTML */ `
<gr-button
@@ -723,7 +746,8 @@
await waitUntil(() => !!query(dialog, '.error'));
// prettier and shadowDom string don't agree on the long text in divs
- expect(element).shadowDom.to.equal(
+ assert.shadowDom.equal(
+ element,
/* prettier-ignore */
/* HTML */ `
<gr-button
diff --git a/polygerrit-ui/app/elements/change-list/gr-change-list-section/gr-change-list-section_test.ts b/polygerrit-ui/app/elements/change-list/gr-change-list-section/gr-change-list-section_test.ts
index d09c78f..684f37f 100644
--- a/polygerrit-ui/app/elements/change-list/gr-change-list-section/gr-change-list-section_test.ts
+++ b/polygerrit-ui/app/elements/change-list/gr-change-list-section/gr-change-list-section_test.ts
@@ -25,7 +25,7 @@
} from '../../../test/test-utils';
import {GrChangeListItem} from '../gr-change-list-item/gr-change-list-item';
import {ChangeListSection} from '../gr-change-list/gr-change-list';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import {ColumnNames} from '../../../constants/constants';
suite('gr-change-list section', () => {
@@ -63,8 +63,9 @@
// TODO: Check table elements. The shadowDom helper does not understand
// tables interacting with display: contents, even wrapping the element in a
// table, does not help.
- expect(element).shadowDom.to
- .equal(/* prettier-ignore */ /* HTML */ `
+ assert.shadowDom.equal(
+ element,
+ /* prettier-ignore */ /* HTML */ `
#
SubjectStatusOwnerReviewersCommentsRepoBranchUpdatedSize Status
<gr-change-list-item
@@ -79,7 +80,8 @@
tabindex="0"
>
</gr-change-list-item>
- `);
+ `
+ );
});
test('selection checkbox is only shown if experiment is enabled', async () => {
diff --git a/polygerrit-ui/app/elements/change-list/gr-change-list-topic-flow/gr-change-list-topic-flow_test.ts b/polygerrit-ui/app/elements/change-list/gr-change-list-topic-flow/gr-change-list-topic-flow_test.ts
index cc3bb51..434339f 100644
--- a/polygerrit-ui/app/elements/change-list/gr-change-list-topic-flow/gr-change-list-topic-flow_test.ts
+++ b/polygerrit-ui/app/elements/change-list/gr-change-list-topic-flow/gr-change-list-topic-flow_test.ts
@@ -3,7 +3,7 @@
* Copyright 2022 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import {IronDropdownElement} from '@polymer/iron-dropdown';
import {SinonStubbedMember} from 'sinon';
import {
@@ -94,25 +94,28 @@
});
test('skips dropdown render when closed', async () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <gr-button
- id="start-flow"
- flatten=""
- down-arrow=""
- aria-disabled="false"
- role="button"
- tabindex="0"
- >Topic</gr-button
- >
- <iron-dropdown
- aria-disabled="false"
- aria-hidden="true"
- style="outline: none; display: none;"
- vertical-align="auto"
- horizontal-align="auto"
- >
- </iron-dropdown>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <gr-button
+ id="start-flow"
+ flatten=""
+ down-arrow=""
+ aria-disabled="false"
+ role="button"
+ tabindex="0"
+ >Topic</gr-button
+ >
+ <iron-dropdown
+ aria-disabled="false"
+ aria-hidden="true"
+ style="outline: none; display: none;"
+ vertical-align="auto"
+ horizontal-align="auto"
+ >
+ </iron-dropdown>
+ `
+ );
});
test('dropdown hidden before flow button clicked', async () => {
@@ -218,7 +221,8 @@
});
test('renders existing-topics flow', () => {
- expect(element).shadowDom.to.equal(
+ assert.shadowDom.equal(
+ element,
/* HTML */ `
<gr-button
id="start-flow"
@@ -535,7 +539,8 @@
});
test('renders no-existing-topics flow', () => {
- expect(element).shadowDom.to.equal(
+ assert.shadowDom.equal(
+ element,
/* HTML */ `
<gr-button
id="start-flow"
diff --git a/polygerrit-ui/app/elements/change-list/gr-change-list-view/gr-change-list-view_test.ts b/polygerrit-ui/app/elements/change-list/gr-change-list-view/gr-change-list-view_test.ts
index 14fd2e8..3cc7f40 100644
--- a/polygerrit-ui/app/elements/change-list/gr-change-list-view/gr-change-list-view_test.ts
+++ b/polygerrit-ui/app/elements/change-list/gr-change-list-view/gr-change-list-view_test.ts
@@ -23,9 +23,8 @@
RepoName,
} from '../../../api/rest-api.js';
import {tap} from '@polymer/iron-test-helpers/mock-interactions';
-import {waitUntil} from '@open-wc/testing-helpers';
-
-const basicFixture = fixtureFromElement('gr-change-list-view');
+import {fixture, html, waitUntil} from '@open-wc/testing';
+import {GerritView} from '../../../services/router/router-model.js';
const CHANGE_ID = 'IcA3dAB3edAB9f60B8dcdA6ef71A75980e4B7127';
const COMMIT_HASH = '12345678';
@@ -38,8 +37,7 @@
stubRestApi('getChanges').returns(Promise.resolve([]));
stubRestApi('getAccountDetails').returns(Promise.resolve(undefined));
stubRestApi('getAccountStatus').returns(Promise.resolve(undefined));
- element = basicFixture.instantiate();
- await element.updateComplete;
+ element = await fixture(html`<gr-change-list-view></gr-change-list-view>`);
});
teardown(async () => {
@@ -54,18 +52,21 @@
element.loading = false;
await element.updateComplete;
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div class="loading" hidden="">Loading...</div>
- <div>
- <gr-change-list> </gr-change-list>
- <nav>
- Page
- <a href="" id="prevArrow">
- <gr-icon icon="chevron_left" aria-label="Older"></gr-icon>
- </a>
- </nav>
- </div>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div class="loading" hidden="">Loading...</div>
+ <div>
+ <gr-change-list> </gr-change-list>
+ <nav>
+ Page
+ <a href="" id="prevArrow">
+ <gr-icon icon="chevron_left" aria-label="Older"></gr-icon>
+ </a>
+ </nav>
+ </div>
+ `
+ );
});
suite('bulk actions', () => {
@@ -302,7 +303,7 @@
});
element.params = {
- view: GerritNav.View.SEARCH,
+ view: GerritView.SEARCH,
query: CHANGE_ID,
offset: '',
};
@@ -320,7 +321,7 @@
promise.resolve();
});
- element.params = {view: GerritNav.View.SEARCH, query: '1', offset: ''};
+ element.params = {view: GerritView.SEARCH, query: '1', offset: ''};
await promise;
});
@@ -336,7 +337,7 @@
});
element.params = {
- view: GerritNav.View.SEARCH,
+ view: GerritView.SEARCH,
query: COMMIT_HASH,
offset: '',
};
@@ -348,7 +349,7 @@
const stub = sinon.stub(GerritNav, 'navigateToChange');
element.params = {
- view: GerritNav.View.SEARCH,
+ view: GerritView.SEARCH,
query: CHANGE_ID,
offset: '',
};
@@ -362,7 +363,7 @@
const stub = sinon.stub(GerritNav, 'navigateToChange');
element.params = {
- view: GerritNav.View.SEARCH,
+ view: GerritView.SEARCH,
query: CHANGE_ID,
offset: '',
};
diff --git a/polygerrit-ui/app/elements/change-list/gr-change-list/gr-change-list_test.ts b/polygerrit-ui/app/elements/change-list/gr-change-list/gr-change-list_test.ts
index a29d36e..4f6e6d5 100644
--- a/polygerrit-ui/app/elements/change-list/gr-change-list/gr-change-list_test.ts
+++ b/polygerrit-ui/app/elements/change-list/gr-change-list/gr-change-list_test.ts
@@ -30,7 +30,7 @@
import {GrChangeListItem} from '../gr-change-list-item/gr-change-list-item';
import {GrChangeListSection} from '../gr-change-list-section/gr-change-list-section';
import {getAppContext} from '../../../services/app-context';
-import {fixture} from '@open-wc/testing-helpers';
+import {fixture} from '@open-wc/testing';
import {wrapInProvider} from '../../../models/di-provider-element';
import {
ShortcutsService,
@@ -38,13 +38,11 @@
} from '../../../services/shortcuts/shortcuts-service';
import {html} from 'lit';
-const basicFixture = fixtureFromElement('gr-change-list');
-
suite('gr-change-list basic tests', () => {
let element: GrChangeList;
- setup(() => {
- element = basicFixture.instantiate();
+ setup(async () => {
+ element = await fixture(html`<gr-change-list></gr-change-list>`);
});
test('renders', async () => {
@@ -63,15 +61,18 @@
{...createChange(), _number: 2 as NumericChangeId},
];
await element.updateComplete;
- expect(element).shadowDom.to.equal(/* HTML */ `
- <gr-change-list-section> </gr-change-list-section>
- <table id="changeList"></table>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <gr-change-list-section> </gr-change-list-section>
+ <table id="changeList"></table>
+ `
+ );
});
suite('test show change number not logged in', () => {
setup(async () => {
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-change-list></gr-change-list>`);
element.account = undefined;
element.preferences = undefined;
element.config = createServerInfo();
@@ -85,7 +86,7 @@
suite('test show change number preference enabled', () => {
setup(async () => {
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-change-list></gr-change-list>`);
element.preferences = {
legacycid_in_change_table: true,
time_format: TimeFormat.HHMM_12,
@@ -103,7 +104,7 @@
suite('test show change number preference disabled', () => {
setup(async () => {
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-change-list></gr-change-list>`);
// legacycid_in_change_table is not set when false.
element.preferences = {
time_format: TimeFormat.HHMM_12,
@@ -399,7 +400,7 @@
setup(async () => {
stubFlags('isEnabled').returns(true);
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-change-list></gr-change-list>`);
element.sections = [{results: [{...createChange()}]}];
element.account = {_account_id: 1001 as AccountId};
element.preferences = {
@@ -431,7 +432,7 @@
setup(async () => {
stubFlags('isEnabled').returns(true);
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-change-list></gr-change-list>`);
element.sections = [{results: [{...createChange()}]}];
element.account = {_account_id: 1001 as AccountId};
element.preferences = {
@@ -470,7 +471,7 @@
setup(async () => {
stubFlags('isEnabled').returns(true);
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-change-list></gr-change-list>`);
element.sections = [{results: [{...createChange()}]}];
element.account = {_account_id: 1001 as AccountId};
element.preferences = {
@@ -523,7 +524,7 @@
});
test('showStar and showNumber', async () => {
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-change-list></gr-change-list>`);
element.sections = [{results: [{...createChange()}], name: 'a'}];
element.account = {_account_id: 1001 as AccountId};
element.preferences = {
@@ -574,7 +575,7 @@
/* This would only exist if somebody manually updated the config
file. */
setup(async () => {
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-change-list></gr-change-list>`);
element.account = {_account_id: 1001 as AccountId};
element.preferences = {
legacycid_in_change_table: true,
@@ -591,7 +592,7 @@
test('Show new status with feature flag', async () => {
stubFlags('isEnabled').returns(true);
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-change-list></gr-change-list>`);
element.sections = [{results: [{...createChange()}]}];
element.account = {_account_id: 1001 as AccountId};
element.preferences = {
diff --git a/polygerrit-ui/app/elements/change-list/gr-create-change-help/gr-create-change-help_test.ts b/polygerrit-ui/app/elements/change-list/gr-create-change-help/gr-create-change-help_test.ts
index c214848..b896a33 100644
--- a/polygerrit-ui/app/elements/change-list/gr-create-change-help/gr-create-change-help_test.ts
+++ b/polygerrit-ui/app/elements/change-list/gr-create-change-help/gr-create-change-help_test.ts
@@ -9,15 +9,15 @@
import {mockPromise, queryAndAssert} from '../../../test/test-utils';
import {GrButton} from '../../shared/gr-button/gr-button';
import * as MockInteractions from '@polymer/iron-test-helpers/mock-interactions';
-
-const basicFixture = fixtureFromElement('gr-create-change-help');
+import {fixture, html} from '@open-wc/testing';
suite('gr-create-change-help tests', () => {
let element: GrCreateChangeHelp;
setup(async () => {
- element = basicFixture.instantiate();
- await flush();
+ element = await fixture(
+ html`<gr-create-change-help></gr-create-change-help>`
+ );
});
test('Create change tap', async () => {
@@ -28,24 +28,27 @@
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div id="graphic">
- <div id="circle">
- <gr-icon icon="empty_dashboard" id="icon"> </gr-icon>
+ assert.shadowDom.equal(
+ element,
+ /* prettier-ignore */ /* HTML */ `
+ <div id="graphic">
+ <div id="circle">
+ <gr-icon icon="empty_dashboard" id="icon"> </gr-icon>
+ </div>
+ <p>No outgoing changes yet</p>
</div>
- <p>No outgoing changes yet</p>
- </div>
- <div id="help">
- <h2 class="heading-3">Push your first change for code review</h2>
- <p>
- Pushing a change for review is easy, but a little different from other
+ <div id="help">
+ <h2 class="heading-3">Push your first change for code review</h2>
+ <p>
+ Pushing a change for review is easy, but a little different from other
git code review tools. Click on the \`Create Change' button and follow
the step by step instructions.
- </p>
- <gr-button aria-disabled="false" role="button" tabindex="0">
- Create Change
- </gr-button>
- </div>
- `);
+ </p>
+ <gr-button aria-disabled="false" role="button" tabindex="0">
+ Create Change
+ </gr-button>
+ </div>
+ `
+ );
});
});
diff --git a/polygerrit-ui/app/elements/change-list/gr-create-commands-dialog/gr-create-commands-dialog_test.ts b/polygerrit-ui/app/elements/change-list/gr-create-commands-dialog/gr-create-commands-dialog_test.ts
index 53f1f33..93c48b3 100644
--- a/polygerrit-ui/app/elements/change-list/gr-create-commands-dialog/gr-create-commands-dialog_test.ts
+++ b/polygerrit-ui/app/elements/change-list/gr-create-commands-dialog/gr-create-commands-dialog_test.ts
@@ -3,18 +3,18 @@
* Copyright 2018 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
+import {fixture, html} from '@open-wc/testing';
import '../../../test/common-test-setup-karma';
import './gr-create-commands-dialog';
import {GrCreateCommandsDialog} from './gr-create-commands-dialog';
-const basicFixture = fixtureFromElement('gr-create-commands-dialog');
-
suite('gr-create-commands-dialog tests', () => {
let element: GrCreateCommandsDialog;
setup(async () => {
- element = basicFixture.instantiate();
- await element.updateComplete;
+ element = await fixture(
+ html`<gr-create-commands-dialog></gr-create-commands-dialog>`
+ );
});
test('branch', () => {
@@ -24,8 +24,9 @@
test('render', () => {
// prettier and shadowDom assert don't agree about wrapping in the <p> tags
- expect(element).shadowDom.to
- .equal(/* prettier-ignore */ /* HTML */ `
+ assert.shadowDom.equal(
+ element,
+ /* prettier-ignore */ /* HTML */ `
<gr-overlay
aria-hidden="true"
id="commandsOverlay"
@@ -71,6 +72,7 @@
</div>
</gr-dialog>
</gr-overlay>
- `);
+ `
+ );
});
});
diff --git a/polygerrit-ui/app/elements/change-list/gr-create-destination-dialog/gr-create-destination-dialog_test.ts b/polygerrit-ui/app/elements/change-list/gr-create-destination-dialog/gr-create-destination-dialog_test.ts
index 4c06911..ed876db 100644
--- a/polygerrit-ui/app/elements/change-list/gr-create-destination-dialog/gr-create-destination-dialog_test.ts
+++ b/polygerrit-ui/app/elements/change-list/gr-create-destination-dialog/gr-create-destination-dialog_test.ts
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
import '../../../test/common-test-setup-karma';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import './gr-create-destination-dialog';
import {GrCreateDestinationDialog} from './gr-create-destination-dialog';
@@ -18,24 +18,27 @@
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <gr-overlay
- aria-hidden="true"
- id="createOverlay"
- style="outline: none; display: none;"
- tabindex="-1"
- with-backdrop=""
- >
- <gr-dialog confirm-label="View commands" disabled="" role="dialog">
- <div class="header" slot="header">Create change</div>
- <div class="main" slot="main">
- <gr-repo-branch-picker> </gr-repo-branch-picker>
- <p>
- If you haven't done so, you will need to clone the repository.
- </p>
- </div>
- </gr-dialog>
- </gr-overlay>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <gr-overlay
+ aria-hidden="true"
+ id="createOverlay"
+ style="outline: none; display: none;"
+ tabindex="-1"
+ with-backdrop=""
+ >
+ <gr-dialog confirm-label="View commands" disabled="" role="dialog">
+ <div class="header" slot="header">Create change</div>
+ <div class="main" slot="main">
+ <gr-repo-branch-picker> </gr-repo-branch-picker>
+ <p>
+ If you haven't done so, you will need to clone the repository.
+ </p>
+ </div>
+ </gr-dialog>
+ </gr-overlay>
+ `
+ );
});
});
diff --git a/polygerrit-ui/app/elements/change-list/gr-dashboard-view/gr-dashboard-view_test.ts b/polygerrit-ui/app/elements/change-list/gr-dashboard-view/gr-dashboard-view_test.ts
index ce2df31..bcc5367 100644
--- a/polygerrit-ui/app/elements/change-list/gr-dashboard-view/gr-dashboard-view_test.ts
+++ b/polygerrit-ui/app/elements/change-list/gr-dashboard-view/gr-dashboard-view_test.ts
@@ -34,7 +34,7 @@
import {GrDialog} from '../../shared/gr-dialog/gr-dialog';
import {GrCreateChangeHelp} from '../gr-create-change-help/gr-create-change-help';
import {PageErrorEvent} from '../../../types/events';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import {SinonStubbedMember} from 'sinon';
import {RestApiService} from '../../../services/gr-rest-api/gr-rest-api';
@@ -83,41 +83,44 @@
element.requestUpdate();
await element.updateComplete;
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div class="loading" hidden="">Loading...</div>
- <div>
- <h1 class="assistive-tech-only">Dashboard</h1>
- <gr-change-list showstar="">
- <div id="emptyOutgoing" slot="outgoing-slot">No changes</div>
- <div id="emptyYourTurn" slot="your-turn-slot">
- <span> No changes need your attention  ðŸŽ‰ </span>
- </div>
- </gr-change-list>
- </div>
- <gr-overlay
- aria-hidden="true"
- id="confirmDeleteOverlay"
- style="outline: none; display: none;"
- tabindex="-1"
- with-backdrop=""
- >
- <gr-dialog
- confirm-label="Delete"
- id="confirmDeleteDialog"
- role="dialog"
+ assert.shadowDom.equal(
+ element,
+ /* prettier-ignore */ /* HTML */ `
+ <div class="loading" hidden="">Loading...</div>
+ <div>
+ <h1 class="assistive-tech-only">Dashboard</h1>
+ <gr-change-list showstar="">
+ <div id="emptyOutgoing" slot="outgoing-slot">No changes</div>
+ <div id="emptyYourTurn" slot="your-turn-slot">
+ <span> No changes need your attention  ðŸŽ‰ </span>
+ </div>
+ </gr-change-list>
+ </div>
+ <gr-overlay
+ aria-hidden="true"
+ id="confirmDeleteOverlay"
+ style="outline: none; display: none;"
+ tabindex="-1"
+ with-backdrop=""
>
- <div class="header" slot="header">Delete comments</div>
- <div class="main" slot="main">
- Are you sure you want to delete all your draft comments in closed
+ <gr-dialog
+ confirm-label="Delete"
+ id="confirmDeleteDialog"
+ role="dialog"
+ >
+ <div class="header" slot="header">Delete comments</div>
+ <div class="main" slot="main">
+ Are you sure you want to delete all your draft comments in closed
changes? This action cannot be undone.
- </div>
- </gr-dialog>
- </gr-overlay>
- <gr-create-destination-dialog id="destinationDialog">
- </gr-create-destination-dialog>
- <gr-create-commands-dialog id="commandsDialog">
- </gr-create-commands-dialog>
- `);
+ </div>
+ </gr-dialog>
+ </gr-overlay>
+ <gr-create-destination-dialog id="destinationDialog">
+ </gr-create-destination-dialog>
+ <gr-create-commands-dialog id="commandsDialog">
+ </gr-create-commands-dialog>
+ `
+ );
});
suite('bulk actions', () => {
diff --git a/polygerrit-ui/app/elements/change-list/gr-repo-header/gr-repo-header_test.ts b/polygerrit-ui/app/elements/change-list/gr-repo-header/gr-repo-header_test.ts
index 7cbd785..d5f9877 100644
--- a/polygerrit-ui/app/elements/change-list/gr-repo-header/gr-repo-header_test.ts
+++ b/polygerrit-ui/app/elements/change-list/gr-repo-header/gr-repo-header_test.ts
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
import '../../../test/common-test-setup-karma';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import './gr-repo-header';
import {GrRepoHeader} from './gr-repo-header';
import {GerritNav} from '../../core/gr-navigation/gr-navigation';
@@ -21,19 +21,22 @@
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div class="info">
- <h1 class="heading-1">test</h1>
- <hr />
- <div>
- <span> Detail: </span>
- <a href=""> Repo settings </a>
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div class="info">
+ <h1 class="heading-1">test</h1>
+ <hr />
+ <div>
+ <span> Detail: </span>
+ <a href=""> Repo settings </a>
+ </div>
+ <div>
+ <span class="browse"> Browse: </span>
+ </div>
</div>
- <div>
- <span class="browse"> Browse: </span>
- </div>
- </div>
- `);
+ `
+ );
});
test('repoUrl reset once repo changed', async () => {
diff --git a/polygerrit-ui/app/elements/change-list/gr-user-header/gr-user-header_test.ts b/polygerrit-ui/app/elements/change-list/gr-user-header/gr-user-header_test.ts
index 1c1a074..3528d11 100644
--- a/polygerrit-ui/app/elements/change-list/gr-user-header/gr-user-header_test.ts
+++ b/polygerrit-ui/app/elements/change-list/gr-user-header/gr-user-header_test.ts
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
import '../../../test/common-test-setup-karma';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import './gr-user-header';
import {GrUserHeader} from './gr-user-header';
import {stubRestApi} from '../../../test/test-utils';
@@ -18,33 +18,36 @@
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <gr-avatar aria-label="Account avatar" hidden=""> </gr-avatar>
- <div class="info">
- <h1 class="heading-1"></h1>
- <hr />
- <div class="hide status">
- <span> Status: </span>
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <gr-avatar aria-label="Account avatar" hidden=""> </gr-avatar>
+ <div class="info">
+ <h1 class="heading-1"></h1>
+ <hr />
+ <div class="hide status">
+ <span> Status: </span>
+ </div>
+ <div>
+ <span> Email: </span>
+ <a href="mailto:"> </a>
+ </div>
+ <div>
+ <span> Joined: </span>
+ <gr-date-formatter datestr=""> </gr-date-formatter>
+ </div>
+ <gr-endpoint-decorator name="user-header">
+ <gr-endpoint-param name="accountDetails"> </gr-endpoint-param>
+ <gr-endpoint-param name="loggedIn"> </gr-endpoint-param>
+ </gr-endpoint-decorator>
</div>
- <div>
- <span> Email: </span>
- <a href="mailto:"> </a>
+ <div class="info">
+ <div class="dashboardLink hide">
+ <a href=""> View dashboard </a>
+ </div>
</div>
- <div>
- <span> Joined: </span>
- <gr-date-formatter datestr=""> </gr-date-formatter>
- </div>
- <gr-endpoint-decorator name="user-header">
- <gr-endpoint-param name="accountDetails"> </gr-endpoint-param>
- <gr-endpoint-param name="loggedIn"> </gr-endpoint-param>
- </gr-endpoint-decorator>
- </div>
- <div class="info">
- <div class="dashboardLink hide">
- <a href=""> View dashboard </a>
- </div>
- </div>
- `);
+ `
+ );
});
test('loads and clears account info', async () => {
diff --git a/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions_test.ts b/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions_test.ts
index 0a9d461..568afc5 100644
--- a/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions_test.ts
+++ b/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions_test.ts
@@ -49,7 +49,7 @@
import {GrDialog} from '../../shared/gr-dialog/gr-dialog';
import {UIActionInfo} from '../../shared/gr-js-api-interface/gr-change-actions-js-api';
import {getAppContext} from '../../../services/app-context';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import {GrConfirmCherrypickDialog} from '../gr-confirm-cherrypick-dialog/gr-confirm-cherrypick-dialog';
import {GrDropdown} from '../../shared/gr-dropdown/gr-dropdown';
import {GrOverlay} from '../../shared/gr-overlay/gr-overlay';
@@ -147,132 +147,140 @@
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div id="mainContent">
- <span hidden="" id="actionLoadingMessage"> </span>
- <section id="primaryActions">
- <gr-tooltip-content
- has-tooltip=""
- position-below=""
- title="Submit patch set 2 into master"
- >
- <gr-button
- aria-disabled="false"
- class="submit"
- data-action-key="submit"
- data-label="Submit"
- link=""
- role="button"
- tabindex="0"
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div id="mainContent">
+ <span hidden="" id="actionLoadingMessage"> </span>
+ <section id="primaryActions">
+ <gr-tooltip-content
+ has-tooltip=""
+ position-below=""
+ title="Submit patch set 2 into master"
>
- <gr-icon icon="done_all"></gr-icon>
- Submit
- </gr-button>
- </gr-tooltip-content>
- </section>
- <section id="secondaryActions">
- <gr-tooltip-content
- has-tooltip=""
- position-below=""
- title="Rebase onto tip of branch or parent change"
- >
- <gr-button
- aria-disabled="true"
- class="rebase"
- data-action-key="rebase"
- data-label="Rebase"
- disabled=""
- link=""
- role="button"
- tabindex="-1"
+ <gr-button
+ aria-disabled="false"
+ class="submit"
+ data-action-key="submit"
+ data-label="Submit"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ <gr-icon icon="done_all"></gr-icon>
+ Submit
+ </gr-button>
+ </gr-tooltip-content>
+ </section>
+ <section id="secondaryActions">
+ <gr-tooltip-content
+ has-tooltip=""
+ position-below=""
+ title="Rebase onto tip of branch or parent change"
>
- <gr-icon icon="rebase"> </gr-icon>
- Rebase
- </gr-button>
- </gr-tooltip-content>
- </section>
- <gr-button aria-disabled="false" hidden="" role="button" tabindex="0">
- Loading actions...
- </gr-button>
- <gr-dropdown id="moreActions" link="">
- <gr-icon icon="more_vert" aria-labelledby="moreMessage"></gr-icon>
- <span id="moreMessage"> More </span>
- </gr-dropdown>
- </div>
- <gr-overlay
- aria-hidden="true"
- id="overlay"
- style="outline: none; display: none;"
- tabindex="-1"
- with-backdrop=""
- >
- <gr-confirm-rebase-dialog class="confirmDialog" id="confirmRebase">
- </gr-confirm-rebase-dialog>
- <gr-confirm-cherrypick-dialog
- class="confirmDialog"
- id="confirmCherrypick"
+ <gr-button
+ aria-disabled="true"
+ class="rebase"
+ data-action-key="rebase"
+ data-label="Rebase"
+ disabled=""
+ link=""
+ role="button"
+ tabindex="-1"
+ >
+ <gr-icon icon="rebase"> </gr-icon>
+ Rebase
+ </gr-button>
+ </gr-tooltip-content>
+ </section>
+ <gr-button
+ aria-disabled="false"
+ hidden=""
+ role="button"
+ tabindex="0"
+ >
+ Loading actions...
+ </gr-button>
+ <gr-dropdown id="moreActions" link="">
+ <gr-icon icon="more_vert" aria-labelledby="moreMessage"></gr-icon>
+ <span id="moreMessage"> More </span>
+ </gr-dropdown>
+ </div>
+ <gr-overlay
+ aria-hidden="true"
+ id="overlay"
+ style="outline: none; display: none;"
+ tabindex="-1"
+ with-backdrop=""
>
- </gr-confirm-cherrypick-dialog>
- <gr-confirm-cherrypick-conflict-dialog
- class="confirmDialog"
- id="confirmCherrypickConflict"
- >
- </gr-confirm-cherrypick-conflict-dialog>
- <gr-confirm-move-dialog class="confirmDialog" id="confirmMove">
- </gr-confirm-move-dialog>
- <gr-confirm-revert-dialog
- class="confirmDialog"
- id="confirmRevertDialog"
- >
- </gr-confirm-revert-dialog>
- <gr-confirm-abandon-dialog
- class="confirmDialog"
- id="confirmAbandonDialog"
- >
- </gr-confirm-abandon-dialog>
- <gr-confirm-submit-dialog
- class="confirmDialog"
- id="confirmSubmitDialog"
- >
- </gr-confirm-submit-dialog>
- <gr-dialog
- class="confirmDialog"
- confirm-label="Create"
- id="createFollowUpDialog"
- role="dialog"
- >
- <div class="header" slot="header">Create Follow-Up Change</div>
- <div class="main" slot="main">
- <gr-create-change-dialog id="createFollowUpChange">
- </gr-create-change-dialog>
- </div>
- </gr-dialog>
- <gr-dialog
- class="confirmDialog"
- confirm-label="Delete"
- confirm-on-enter=""
- id="confirmDeleteDialog"
- role="dialog"
- >
- <div class="header" slot="header">Delete Change</div>
- <div class="main" slot="main">
- Do you really want to delete the change?
- </div>
- </gr-dialog>
- <gr-dialog
- class="confirmDialog"
- confirm-label="Delete"
- confirm-on-enter=""
- id="confirmDeleteEditDialog"
- role="dialog"
- >
- <div class="header" slot="header">Delete Change Edit</div>
- <div class="main" slot="main">
- Do you really want to delete the edit?
- </div>
- </gr-dialog>
- </gr-overlay>
- `);
+ <gr-confirm-rebase-dialog class="confirmDialog" id="confirmRebase">
+ </gr-confirm-rebase-dialog>
+ <gr-confirm-cherrypick-dialog
+ class="confirmDialog"
+ id="confirmCherrypick"
+ >
+ </gr-confirm-cherrypick-dialog>
+ <gr-confirm-cherrypick-conflict-dialog
+ class="confirmDialog"
+ id="confirmCherrypickConflict"
+ >
+ </gr-confirm-cherrypick-conflict-dialog>
+ <gr-confirm-move-dialog class="confirmDialog" id="confirmMove">
+ </gr-confirm-move-dialog>
+ <gr-confirm-revert-dialog
+ class="confirmDialog"
+ id="confirmRevertDialog"
+ >
+ </gr-confirm-revert-dialog>
+ <gr-confirm-abandon-dialog
+ class="confirmDialog"
+ id="confirmAbandonDialog"
+ >
+ </gr-confirm-abandon-dialog>
+ <gr-confirm-submit-dialog
+ class="confirmDialog"
+ id="confirmSubmitDialog"
+ >
+ </gr-confirm-submit-dialog>
+ <gr-dialog
+ class="confirmDialog"
+ confirm-label="Create"
+ id="createFollowUpDialog"
+ role="dialog"
+ >
+ <div class="header" slot="header">Create Follow-Up Change</div>
+ <div class="main" slot="main">
+ <gr-create-change-dialog id="createFollowUpChange">
+ </gr-create-change-dialog>
+ </div>
+ </gr-dialog>
+ <gr-dialog
+ class="confirmDialog"
+ confirm-label="Delete"
+ confirm-on-enter=""
+ id="confirmDeleteDialog"
+ role="dialog"
+ >
+ <div class="header" slot="header">Delete Change</div>
+ <div class="main" slot="main">
+ Do you really want to delete the change?
+ </div>
+ </gr-dialog>
+ <gr-dialog
+ class="confirmDialog"
+ confirm-label="Delete"
+ confirm-on-enter=""
+ id="confirmDeleteEditDialog"
+ role="dialog"
+ >
+ <div class="header" slot="header">Delete Change Edit</div>
+ <div class="main" slot="main">
+ Do you really want to delete the edit?
+ </div>
+ </gr-dialog>
+ </gr-overlay>
+ `
+ );
});
test('show-revision-actions event should fire', async () => {
diff --git a/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata.ts b/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata.ts
index 9d79fef..ee6b134 100644
--- a/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata.ts
+++ b/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata.ts
@@ -956,7 +956,7 @@
if (!change || !project) {
return '';
}
- return GerritNav.getUrlForChangeById(change, project, patchset);
+ return GerritNav.getUrlForChangeById(change, project, 'metadata', patchset);
}
private computeHashtagUrl(hashtag: Hashtag) {
diff --git a/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata_test.ts b/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata_test.ts
index 806a3b5..d6cffe9 100644
--- a/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata_test.ts
+++ b/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata_test.ts
@@ -57,8 +57,7 @@
import {GrButton} from '../../shared/gr-button/gr-button';
import {GrRouter} from '../../core/gr-router/gr-router';
import {nothing} from 'lit';
-
-const basicFixture = fixtureFromElement('gr-change-metadata');
+import {fixture, html} from '@open-wc/testing';
suite('gr-change-metadata tests', () => {
let element: GrChangeMetadata;
@@ -74,14 +73,16 @@
},
})
);
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-change-metadata></gr-change-metadata>`);
element.change = createParsedChange();
await element.updateComplete;
});
test('renders', async () => {
await element.updateComplete;
- expect(element).shadowDom.to.equal(/* HTML */ `<div>
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `<div>
<div class="metadata-header">
<h3 class="heading-3 metadata-title">Change Info</h3>
<gr-button
@@ -198,7 +199,8 @@
<gr-endpoint-param name="change"> </gr-endpoint-param>
<gr-endpoint-param name="revision"> </gr-endpoint-param>
</gr-endpoint-decorator>
- </div>`);
+ </div>`
+ );
});
test('computeMergedCommitInfo', () => {
@@ -997,7 +999,7 @@
suite('plugin endpoints', () => {
setup(async () => {
resetPlugins();
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-change-metadata></gr-change-metadata>`);
element.change = createParsedChange();
element.revision = createRevision();
await element.updateComplete;
diff --git a/polygerrit-ui/app/elements/change/gr-change-summary/gr-change-summary.ts b/polygerrit-ui/app/elements/change/gr-change-summary/gr-change-summary.ts
index 57097ee..bdaf918 100644
--- a/polygerrit-ui/app/elements/change/gr-change-summary/gr-change-summary.ts
+++ b/polygerrit-ui/app/elements/change/gr-change-summary/gr-change-summary.ts
@@ -19,7 +19,7 @@
ErrorMessages,
} from '../../../models/checks/checks-model';
import {Action, Category, RunStatus} from '../../../api/checks';
-import {fireShowPrimaryTab} from '../../../utils/event-util';
+import {fireShowTab} from '../../../utils/event-util';
import {
compareByWorstCategory,
getResultsOf,
@@ -42,7 +42,7 @@
import {AccountInfo} from '../../../types/common';
import {notUndefined} from '../../../types/types';
import {uniqueDefinedAvatar} from '../../../utils/account-util';
-import {PrimaryTab} from '../../../constants/constants';
+import {Tab} from '../../../constants/constants';
import {ChecksTabState, CommentTabState} from '../../../types/events';
import {spinnerStyles} from '../../../styles/gr-spinner-styles';
import {modifierPressed} from '../../../utils/dom-util';
@@ -525,7 +525,7 @@
checkName: state.checkName,
...roleDetails(this.getChangeModel().getChange(), this.selfAccount),
});
- fireShowPrimaryTab(this, PrimaryTab.CHECKS, false, {
+ fireShowTab(this, Tab.CHECKS, false, {
checksTab: state,
});
}
diff --git a/polygerrit-ui/app/elements/change/gr-change-summary/gr-change-summary_test.ts b/polygerrit-ui/app/elements/change/gr-change-summary/gr-change-summary_test.ts
index dc8135e..016b727 100644
--- a/polygerrit-ui/app/elements/change/gr-change-summary/gr-change-summary_test.ts
+++ b/polygerrit-ui/app/elements/change/gr-change-summary/gr-change-summary_test.ts
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
import '../../../test/common-test-setup-karma';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import {GrChangeSummary} from './gr-change-summary';
import {queryAndAssert} from '../../../utils/common-util';
import {fakeRun0} from '../../../models/checks/checks-fakes';
@@ -40,34 +40,37 @@
createCommentThread([{...createComment(), unresolved: true}]),
];
await element.updateComplete;
- expect(element).shadowDom.to.equal(/* HTML */ `<div>
- <table>
- <tbody>
- <tr>
- <td class="key">Comments</td>
- <td class="value">
- <gr-summary-chip
- category="drafts"
- icon="edit"
- styletype="warning"
- >
- 3 drafts
- </gr-summary-chip>
- <gr-summary-chip category="unresolved" styletype="warning">
- 1 unresolved
- </gr-summary-chip>
- <gr-summary-chip
- category="show all"
- icon="mark_chat_read"
- styletype="check"
- >
- 1 resolved
- </gr-summary-chip>
- </td>
- </tr>
- </tbody>
- </table>
- </div> `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `<div>
+ <table>
+ <tbody>
+ <tr>
+ <td class="key">Comments</td>
+ <td class="value">
+ <gr-summary-chip
+ category="drafts"
+ icon="edit"
+ styletype="warning"
+ >
+ 3 drafts
+ </gr-summary-chip>
+ <gr-summary-chip category="unresolved" styletype="warning">
+ 1 unresolved
+ </gr-summary-chip>
+ <gr-summary-chip
+ category="show all"
+ icon="mark_chat_read"
+ styletype="check"
+ >
+ 1 resolved
+ </gr-summary-chip>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div> `
+ );
});
test('renders checks summary message', async () => {
@@ -76,19 +79,22 @@
element.showChecksSummary = true;
await element.updateComplete;
const checksSummary = queryAndAssert(element, '.checksSummary');
- expect(checksSummary).dom.to.equal(/* HTML */ `
- <div class="checksSummary">
- <gr-checks-chip> </gr-checks-chip>
- <div class="info">
- <div class="left">
- <gr-icon icon="info" filled></gr-icon>
- </div>
- <div class="right">
- <div class="message" title="a message">a message</div>
+ assert.dom.equal(
+ checksSummary,
+ /* HTML */ `
+ <div class="checksSummary">
+ <gr-checks-chip> </gr-checks-chip>
+ <div class="info">
+ <div class="left">
+ <gr-icon icon="info" filled></gr-icon>
+ </div>
+ <div class="right">
+ <div class="message" title="a message">a message</div>
+ </div>
</div>
</div>
- </div>
- `);
+ `
+ );
});
test('renders mentions summary', async () => {
@@ -130,17 +136,20 @@
});
await element.updateComplete;
const mentionSummary = queryAndAssert(element, '.mentionSummary');
- // Only count occurences in unresolved threads
+ // Only count occurrences in unresolved threads
// Resolved threads are ignored hence mention chip count is 2
- expect(mentionSummary).dom.to.equal(/* HTML */ `
- <gr-summary-chip
- category="mentions"
- class="mentionSummary"
- icon="alternate_email"
- styletype="warning"
- >
- 2 mentions
- </gr-summary-chip>
- `);
+ assert.dom.equal(
+ mentionSummary,
+ /* HTML */ `
+ <gr-summary-chip
+ category="mentions"
+ class="mentionSummary"
+ icon="alternate_email"
+ styletype="warning"
+ >
+ 2 mentions
+ </gr-summary-chip>
+ `
+ );
});
});
diff --git a/polygerrit-ui/app/elements/change/gr-change-summary/gr-checks-chip.ts b/polygerrit-ui/app/elements/change/gr-change-summary/gr-checks-chip.ts
index eaa3188..2ab8ac3 100644
--- a/polygerrit-ui/app/elements/change/gr-change-summary/gr-checks-chip.ts
+++ b/polygerrit-ui/app/elements/change/gr-change-summary/gr-checks-chip.ts
@@ -162,14 +162,7 @@
if (!this.text) return;
if (!this.statusOrCategory) return;
const icon = iconFor(this.statusOrCategory);
- const label = labelFor(this.statusOrCategory);
- const count = Number(this.text);
- let ariaLabel = label;
- if (!isNaN(count)) {
- const type = isStatus(this.statusOrCategory) ? 'run' : 'result';
- const plural = count > 1 ? 's' : '';
- ariaLabel = `${this.text} ${label} ${type}${plural}`;
- }
+ const ariaLabel = this.computeAriaLabel();
const chipClass = `checksChip font-small ${icon.name}`;
const chipClassFullLength = `${chipClass} hoverFullLength`;
// 15 is roughly the number of chars for the chip exceeding its 120px width.
@@ -181,6 +174,19 @@
`;
}
+ private computeAriaLabel() {
+ if (!this.statusOrCategory) return '';
+ const label = labelFor(this.statusOrCategory);
+ const type = isStatus(this.statusOrCategory) ? 'run' : 'result';
+ const count = Number(this.text);
+ const isCountChip = !isNaN(count);
+ if (isCountChip) {
+ const plural = count > 1 ? 's' : '';
+ return `${this.text} ${label} ${type}${plural}`;
+ }
+ return `${label} for check ${this.text}`;
+ }
+
private renderChip(clazz: string, ariaLabel: string, icon: ChecksIcon) {
return html`
<div class=${clazz} role="link" tabindex="0" aria-label=${ariaLabel}>
diff --git a/polygerrit-ui/app/elements/change/gr-change-summary/gr-checks-chip_test.ts b/polygerrit-ui/app/elements/change/gr-change-summary/gr-checks-chip_test.ts
index 1fbbca6..60526da 100644
--- a/polygerrit-ui/app/elements/change/gr-change-summary/gr-checks-chip_test.ts
+++ b/polygerrit-ui/app/elements/change/gr-change-summary/gr-checks-chip_test.ts
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
import '../../../test/common-test-setup-karma';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import {GrChecksChip} from './gr-checks-chip';
import {Category} from '../../../api/checks';
@@ -23,14 +23,65 @@
});
test('renders', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `<div
- aria-label="0 success result"
- class="check_circle checksChip font-small"
- role="link"
- tabindex="0"
- >
- <gr-icon icon="check_circle"></gr-icon>
- <div class="text">0</div>
- </div>`);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `<div
+ aria-label="0 success result"
+ class="check_circle checksChip font-small"
+ role="link"
+ tabindex="0"
+ >
+ <gr-icon icon="check_circle"></gr-icon>
+ <div class="text">0</div>
+ </div>`
+ );
+ });
+
+ test('renders specific check', async () => {
+ element.text = 'Super Check';
+ element.statusOrCategory = Category.ERROR;
+ await element.updateComplete;
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div
+ aria-label="error for check Super Check"
+ class="checksChip error font-small"
+ role="link"
+ tabindex="0"
+ >
+ <gr-icon icon="error" filled></gr-icon>
+ <div class="text">Super Check</div>
+ </div>
+ `
+ );
+ });
+
+ test('renders check with link', async () => {
+ element.text = 'LinkProducer';
+ element.statusOrCategory = Category.WARNING;
+ element.links = ['http://www.google.com'];
+ await element.updateComplete;
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div
+ aria-label="warning for check LinkProducer"
+ class="checksChip warning font-small"
+ role="link"
+ tabindex="0"
+ >
+ <gr-icon icon="warning" filled></gr-icon>
+ <a
+ aria-label="Link to check details"
+ href="http://www.google.com"
+ target="_blank"
+ >
+ <gr-icon class="launch" icon="open_in_new"> </gr-icon>
+ </a>
+ <div class="text">LinkProducer</div>
+ </div>
+ `
+ );
});
});
diff --git a/polygerrit-ui/app/elements/change/gr-change-summary/gr-summary-chip.ts b/polygerrit-ui/app/elements/change/gr-change-summary/gr-summary-chip.ts
index 37edd19..4ac8790 100644
--- a/polygerrit-ui/app/elements/change/gr-change-summary/gr-summary-chip.ts
+++ b/polygerrit-ui/app/elements/change/gr-change-summary/gr-summary-chip.ts
@@ -8,8 +8,8 @@
import {customElement, property} from 'lit/decorators.js';
import {sharedStyles} from '../../../styles/shared-styles';
import {getAppContext} from '../../../services/app-context';
-import {fireShowPrimaryTab} from '../../../utils/event-util';
-import {PrimaryTab} from '../../../constants/constants';
+import {fireShowTab} from '../../../utils/event-util';
+import {Tab} from '../../../constants/constants';
import {CommentTabState} from '../../../types/events';
import {fontStyles} from '../../../styles/gr-font-styles';
@@ -102,7 +102,7 @@
this.reporting.reportInteraction('comment chip click', {
category: this.category,
});
- fireShowPrimaryTab(this, PrimaryTab.COMMENT_THREADS, true, {
+ fireShowTab(this, Tab.COMMENT_THREADS, true, {
commentTab: this.category,
});
}
diff --git a/polygerrit-ui/app/elements/change/gr-change-summary/gr-summary-chip_test.ts b/polygerrit-ui/app/elements/change/gr-change-summary/gr-summary-chip_test.ts
index cb29cf5..b12bafc 100644
--- a/polygerrit-ui/app/elements/change/gr-change-summary/gr-summary-chip_test.ts
+++ b/polygerrit-ui/app/elements/change/gr-change-summary/gr-summary-chip_test.ts
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
import '../../../test/common-test-setup-karma';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import {GrSummaryChip, SummaryChipStyles} from './gr-summary-chip';
import {CommentTabState} from '../../../types/events';
@@ -22,10 +22,11 @@
});
test('renders', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `<button
- class="font-small summaryChip warning"
- >
- <slot> </slot>
- </button>`);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `<button class="font-small summaryChip warning">
+ <slot> </slot>
+ </button>`
+ );
});
});
diff --git a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.ts b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.ts
index 3bdc6d7..c802967 100644
--- a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.ts
+++ b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.ts
@@ -43,8 +43,7 @@
import {
ChangeStatus,
DefaultBase,
- PrimaryTab,
- SecondaryTab,
+ Tab,
DiffViewMode,
} from '../../../constants/constants';
import {getAppContext} from '../../../services/app-context';
@@ -105,7 +104,12 @@
import {GrDownloadDialog} from '../gr-download-dialog/gr-download-dialog';
import {GrChangeMetadata} from '../gr-change-metadata/gr-change-metadata';
import {ChangeComments} from '../../diff/gr-comment-api/gr-comment-api';
-import {assertIsDefined} from '../../../utils/common-util';
+import {
+ assertIsDefined,
+ assert,
+ query as queryEl,
+ queryAll,
+} from '../../../utils/common-util';
import {GrEditControls} from '../../edit/gr-edit-controls/gr-edit-controls';
import {
CommentThread,
@@ -259,7 +263,7 @@
@query('#replyBtn') replyBtn?: GrButton;
- @query('#primaryTabs') primaryTabs?: PaperTabsElement;
+ @query('#tabs') tabs?: PaperTabsElement;
@query('gr-messages-list') messagesList?: GrMessagesList;
@@ -468,21 +472,27 @@
@state()
mergeable: boolean | null = null;
+ /**
+ * Plugins can provide (multiple) tabs. For each plugin tab we render an
+ * endpoint for the header. If the plugin tab is active, then we also render
+ * an endpoint for the content.
+ *
+ * This is the list of endpoint names for the headers. The header name that
+ * the user sees is an implementation detail of the plugin that we don't know.
+ */
// Private but used in tests.
@state()
- dynamicTabHeaderEndpoints: string[] = [];
+ pluginTabsHeaderEndpoints: string[] = [];
+ /**
+ * Plugins can provide (multiple) tabs. For each plugin tab we render an
+ * endpoint for the header. If the plugin tab is active, then we also render
+ * an endpoint for the content.
+ *
+ * This is the list of endpoint names for the content.
+ */
@state()
- private dynamicTabContentEndpoints: string[] = [];
-
- // Private but used in tests.
- @state()
- // The dynamic content of the plugin added tab
- selectedTabPluginEndpoint = '';
-
- @state()
- // The dynamic heading of the plugin added tab
- private selectedTabPluginHeader = '';
+ private pluginTabsContentEndpoints: string[] = [];
@state()
private currentRobotCommentsPatchSet?: PatchSetNum;
@@ -492,13 +502,9 @@
@state()
private changeViewAriaHidden = false;
- /**
- * this is a two-element tuple to always
- * hold the current active tab for both primary and secondary tabs
- * Private but used in tests.
- */
+ // visible for testing
@state()
- activeTabs: string[] = [PrimaryTab.FILES, SecondaryTab.CHANGE_LOG];
+ activeTab = Tab.FILES;
@property({type: Boolean})
unresolvedOnly = true;
@@ -621,9 +627,7 @@
this.addEventListener('open-fix-preview', e => this.onOpenFixPreview(e));
this.addEventListener('close-fix-preview', e => this.onCloseFixPreview(e));
- this.addEventListener(EventType.SHOW_PRIMARY_TAB, e =>
- this.setActivePrimaryTab(e)
- );
+ this.addEventListener(EventType.SHOW_TAB, e => this.setActiveTab(e));
this.addEventListener('reload', e => {
this.loadData(
/* isLocationChange= */ false,
@@ -806,18 +810,18 @@
getPluginLoader()
.awaitPluginsLoaded()
.then(() => {
- this.dynamicTabHeaderEndpoints =
+ this.pluginTabsHeaderEndpoints =
getPluginEndpoints().getDynamicEndpoints('change-view-tab-header');
- this.dynamicTabContentEndpoints =
+ this.pluginTabsContentEndpoints =
getPluginEndpoints().getDynamicEndpoints('change-view-tab-content');
if (
- this.dynamicTabContentEndpoints.length !==
- this.dynamicTabHeaderEndpoints.length
+ this.pluginTabsContentEndpoints.length !==
+ this.pluginTabsHeaderEndpoints.length
) {
this.reporting.error(new Error('Mismatch of headers and content.'));
}
})
- .then(() => this.initActiveTabs());
+ .then(() => this.initActiveTab());
this.throttledToggleChangeStar = throttleWrap<KeyboardEvent>(_ =>
this.handleToggleChangeStar()
@@ -1149,7 +1153,7 @@
.show-robot-comments {
margin: var(--spacing-m);
}
- .patchInfo gr-thread-list::part(threads) {
+ .tabContent gr-thread-list::part(threads) {
padding: var(--spacing-l);
}
`,
@@ -1177,7 +1181,8 @@
>
${this.renderChangeInfoSection()}
<h2 class="assistive-tech-only">Files and Comments tabs</h2>
- ${this.renderPaperTabs()} ${this.renderPatchInfoSection()}
+ ${this.renderTabHeaders()} ${this.renderTabContent()}
+ ${this.renderChangeLog()}
</div>
<gr-apply-fix-dialog
id="applyFixDialog"
@@ -1403,18 +1408,15 @@
</div>`;
}
- private renderPaperTabs() {
+ private renderTabHeaders() {
return html`
- <paper-tabs
- id="primaryTabs"
- @selected-changed=${this.setActivePrimaryTab}
- >
- <paper-tab @click=${this.onPaperTabClick} data-name=${PrimaryTab.FILES}
+ <paper-tabs id="tabs" @selected-changed=${this.setActiveTab}>
+ <paper-tab @click=${this.onPaperTabClick} data-name=${Tab.FILES}
><span>Files</span></paper-tab
>
<paper-tab
@click=${this.onPaperTabClick}
- data-name=${PrimaryTab.COMMENT_THREADS}
+ data-name=${Tab.COMMENT_THREADS}
class="commentThreads"
>
<gr-tooltip-content
@@ -1427,14 +1429,12 @@
${when(
this.showChecksTab,
() => html`
- <paper-tab
- data-name=${PrimaryTab.CHECKS}
- @click=${this.onPaperTabClick}
+ <paper-tab data-name=${Tab.CHECKS} @click=${this.onPaperTabClick}
><span>Checks</span></paper-tab
>
`
)}
- ${this.dynamicTabHeaderEndpoints.map(
+ ${this.pluginTabsHeaderEndpoints.map(
tabHeader => html`
<paper-tab data-name=${tabHeader}>
<gr-endpoint-decorator name=${tabHeader}>
@@ -1452,10 +1452,7 @@
${when(
this.showFindingsTab,
() => html`
- <paper-tab
- data-name=${PrimaryTab.FINDINGS}
- @click=${this.onPaperTabClick}
- >
+ <paper-tab data-name=${Tab.FINDINGS} @click=${this.onPaperTabClick}>
<span>Findings</span>
</paper-tab>
`
@@ -1464,115 +1461,133 @@
`;
}
- private renderPatchInfoSection() {
+ private renderTabContent() {
+ return html`
+ <section class="tabContent">
+ ${this.renderFilesTab()} ${this.renderCommentsTab()}
+ ${this.renderChecksTab()} ${this.renderFindingsTab()}
+ ${this.renderPluginTab()}
+ </section>
+ `;
+ }
+
+ private renderFilesTab() {
+ return html`
+ <div ?hidden=${this.activeTab !== Tab.FILES}>
+ <gr-file-list-header
+ id="fileListHeader"
+ .account=${this.account}
+ .allPatchSets=${this.allPatchSets}
+ .change=${this.change}
+ .changeNum=${this.changeNum}
+ .revisionInfo=${this.getRevisionInfo()}
+ .commitInfo=${this.commitInfo}
+ .changeUrl=${this.computeChangeUrl()}
+ .editMode=${this.getEditMode()}
+ .loggedIn=${this.loggedIn}
+ .shownFileCount=${this.shownFileCount}
+ .patchNum=${this.patchRange?.patchNum}
+ .basePatchNum=${this.patchRange?.basePatchNum}
+ .filesExpanded=${this.fileList?.filesExpanded}
+ @open-diff-prefs=${this.handleOpenDiffPrefs}
+ @open-download-dialog=${this.handleOpenDownloadDialog}
+ @expand-diffs=${this.expandAllDiffs}
+ @collapse-diffs=${this.collapseAllDiffs}
+ >
+ </gr-file-list-header>
+ <gr-file-list
+ id="fileList"
+ class="hideOnMobileOverlay"
+ .change=${this.change}
+ .changeNum=${this.changeNum}
+ .patchRange=${this.patchRange}
+ .editMode=${this.getEditMode()}
+ @files-shown-changed=${(e: CustomEvent<{length: number}>) => {
+ this.shownFileCount = e.detail.length;
+ }}
+ @files-expanded-changed=${(
+ _e: ValueChangedEvent<FilesExpandedState>
+ ) => {
+ this.requestUpdate();
+ }}
+ @file-action-tap=${this.handleFileActionTap}
+ >
+ </gr-file-list>
+ </div>
+ `;
+ }
+
+ private renderCommentsTab() {
+ if (this.activeTab !== Tab.COMMENT_THREADS) return nothing;
+ return html`
+ <h3 class="assistive-tech-only">Comments</h3>
+ <gr-thread-list
+ .threads=${this.commentThreads}
+ .commentTabState=${this.tabState}
+ only-show-robot-comments-with-human-reply
+ .unresolvedOnly=${this.unresolvedOnly}
+ .scrollCommentId=${this.scrollCommentId}
+ show-comment-context
+ ></gr-thread-list>
+ `;
+ }
+
+ private renderChecksTab() {
+ if (this.activeTab !== Tab.CHECKS) return nothing;
+ return html`
+ <h3 class="assistive-tech-only">Checks</h3>
+ <gr-checks-tab id="checksTab" .tabState=${this.tabState}></gr-checks-tab>
+ `;
+ }
+
+ private renderFindingsTab() {
+ if (this.activeTab !== Tab.FINDINGS) return nothing;
+ if (!this.showFindingsTab) return nothing;
const robotCommentThreads = this.computeRobotCommentThreads();
const robotCommentsPatchSetDropdownItems =
this.computeRobotCommentsPatchSetDropdownItems();
return html`
- <section class="patchInfo">
- <div ?hidden=${!this.isTabActive(PrimaryTab.FILES)}>
- <gr-file-list-header
- id="fileListHeader"
- .account=${this.account}
- .allPatchSets=${this.allPatchSets}
- .change=${this.change}
- .changeNum=${this.changeNum}
- .revisionInfo=${this.getRevisionInfo()}
- .commitInfo=${this.commitInfo}
- .changeUrl=${this.computeChangeUrl()}
- .editMode=${this.getEditMode()}
- .loggedIn=${this.loggedIn}
- .shownFileCount=${this.shownFileCount}
- .patchNum=${this.patchRange?.patchNum}
- .basePatchNum=${this.patchRange?.basePatchNum}
- .filesExpanded=${this.fileList?.filesExpanded}
- @open-diff-prefs=${this.handleOpenDiffPrefs}
- @open-download-dialog=${this.handleOpenDownloadDialog}
- @expand-diffs=${this.expandAllDiffs}
- @collapse-diffs=${this.collapseAllDiffs}
+ <gr-dropdown-list
+ class="patch-set-dropdown"
+ .items=${robotCommentsPatchSetDropdownItems}
+ .value=${this.currentRobotCommentsPatchSet}
+ @value-change=${this.handleRobotCommentPatchSetChanged}
+ >
+ </gr-dropdown-list>
+ <gr-thread-list .threads=${robotCommentThreads} hide-dropdown>
+ </gr-thread-list>
+ ${when(
+ this.showRobotCommentsButton,
+ () => html`
+ <gr-button
+ class="show-robot-comments"
+ @click=${this.toggleShowRobotComments}
>
- </gr-file-list-header>
- <gr-file-list
- id="fileList"
- class="hideOnMobileOverlay"
- .change=${this.change}
- .changeNum=${this.changeNum}
- .patchRange=${this.patchRange}
- .editMode=${this.getEditMode()}
- @files-shown-changed=${(e: CustomEvent<{length: number}>) => {
- this.shownFileCount = e.detail.length;
- }}
- @files-expanded-changed=${(
- _e: ValueChangedEvent<FilesExpandedState>
- ) => {
- this.requestUpdate();
- }}
- @file-action-tap=${this.handleFileActionTap}
- >
- </gr-file-list>
- </div>
- ${when(
- this.isTabActive(PrimaryTab.COMMENT_THREADS),
- () => html`
- <h3 class="assistive-tech-only">Comments</h3>
- <gr-thread-list
- .threads=${this.commentThreads}
- .commentTabState=${this.tabState}
- only-show-robot-comments-with-human-reply=""
- .unresolvedOnly=${this.unresolvedOnly}
- .scrollCommentId=${this.scrollCommentId}
- show-comment-context
- ></gr-thread-list>
- `
- )}
- ${when(
- this.isTabActive(PrimaryTab.CHECKS),
- () => html`
- <h3 class="assistive-tech-only">Checks</h3>
- <gr-checks-tab
- id="checksTab"
- .tabState=${this.tabState}
- ></gr-checks-tab>
- `
- )}
- ${when(
- this.isTabActive(PrimaryTab.FINDINGS),
- () => html`
- <gr-dropdown-list
- class="patch-set-dropdown"
- .items=${robotCommentsPatchSetDropdownItems}
- .value=${this.currentRobotCommentsPatchSet}
- @value-change=${this.handleRobotCommentPatchSetChanged}
- >
- </gr-dropdown-list>
- <gr-thread-list .threads=${robotCommentThreads} hide-dropdown>
- </gr-thread-list>
- ${when(
- this.showRobotCommentsButton,
- () => html`
- <gr-button
- class="show-robot-comments"
- @click=${this.toggleShowRobotComments}
- >
- ${this.showAllRobotComments ? 'Show Less' : 'Show more'}
- </gr-button>
- `
- )}
- `
- )}
- ${when(
- this.isTabActive(this.selectedTabPluginHeader),
- () => html`
- <gr-endpoint-decorator .name=${this.selectedTabPluginEndpoint}>
- <gr-endpoint-param name="change" .value=${this.change}>
- </gr-endpoint-param>
- <gr-endpoint-param name="revision" .value=${this.selectedRevision}></gr-endpoint-param>
- </gr-endpoint-param>
- </gr-endpoint-decorator>
+ ${this.showAllRobotComments ? 'Show Less' : 'Show more'}
+ </gr-button>
`
- )}
- </section>
+ )}
+ `;
+ }
+ private renderPluginTab() {
+ const i = this.pluginTabsHeaderEndpoints.findIndex(
+ t => this.activeTab === t
+ );
+ if (i === -1) return nothing;
+ const pluginTabContentEndpoint = this.pluginTabsContentEndpoints[i];
+ return html`
+ <gr-endpoint-decorator .name=${pluginTabContentEndpoint}>
+ <gr-endpoint-param name="change" .value=${this.change}>
+ </gr-endpoint-param>
+ <gr-endpoint-param name="revision" .value=${this.selectedRevision}></gr-endpoint-param>
+ </gr-endpoint-param>
+ </gr-endpoint-decorator>
+ `;
+ }
+
+ private renderChangeLog() {
+ return html`
<gr-endpoint-decorator name="change-view-integration">
<gr-endpoint-param name="change" .value=${this.change}>
</gr-endpoint-param>
@@ -1580,8 +1595,8 @@
</gr-endpoint-param>
</gr-endpoint-decorator>
- <paper-tabs id="secondaryTabs">
- <paper-tab data-name=${SecondaryTab.CHANGE_LOG} class="changeLog">
+ <paper-tabs>
+ <paper-tab data-name="_changeLog" class="changeLog">
Change Log
</paper-tab>
</paper-tabs>
@@ -1628,94 +1643,38 @@
}
}
- private isTabActive(tab?: string) {
- if (!tab || !this.activeTabs) return false;
- return this.activeTabs.includes(tab);
- }
-
- /**
- * Actual implementation of switching a tab
- *
- * @param paperTabs - the parent tabs container
- */
- private setActiveTab(
- paperTabs: PaperTabsElement | null,
- activeDetails: {
- activeTabName?: string;
- activeTabIndex?: number;
- scrollIntoView?: boolean;
- },
- src?: string
- ) {
+ setActiveTab(e: SwitchTabEvent) {
+ const paperTabs = queryEl<PaperTabsElement>(this, '#tabs');
if (!paperTabs) return;
- const {activeTabName, activeTabIndex, scrollIntoView} = activeDetails;
- const tabs = paperTabs.querySelectorAll(
- 'paper-tab'
- ) as NodeListOf<HTMLElement>;
- let activeIndex = -1;
- if (activeTabIndex !== undefined) {
- activeIndex = activeTabIndex;
- } else {
- for (let i = 0; i <= tabs.length; i++) {
- const tab = tabs[i];
- if (tab.dataset['name'] === activeTabName) {
- activeIndex = i;
- break;
- }
- }
+ const tabs = [...queryAll<HTMLElement>(paperTabs, 'paper-tab')];
+ if (!tabs) return;
+
+ let tabName = e.detail.tab;
+ let tabIndex = e.detail.value;
+
+ if (tabIndex === undefined) {
+ assert(tabName !== undefined, 'tabName or tabIndex must be defined');
+ tabIndex = tabs.findIndex(t => t.dataset['name'] === tabName);
+ assert(tabIndex !== -1, `tab ${tabName} not found`);
}
- if (activeIndex === -1) {
- this.reporting.error(new Error(`tab not found for ${activeDetails}`));
- return;
+
+ if (tabName === undefined) {
+ tabName = tabs[tabIndex].dataset['name'];
}
- const tabName = tabs[activeIndex].dataset['name'];
- if (scrollIntoView) {
- paperTabs.scrollIntoView({block: 'center'});
- }
- if (paperTabs.selected !== activeIndex) {
+
+ if (paperTabs.selected !== tabIndex) {
// paperTabs.selected is undefined during rendering
if (paperTabs.selected !== undefined) {
+ const src = (e.composedPath()?.[0] as Element | undefined)?.tagName;
this.reporting.reportInteraction(Interaction.SHOW_TAB, {tabName, src});
}
- paperTabs.selected = activeIndex;
+ paperTabs.selected = tabIndex;
}
- return tabName;
- }
- /**
- * Changes active primary tab.
- * Private but used in tests.
- */
- setActivePrimaryTab(e: SwitchTabEvent) {
- const primaryTabs =
- this.shadowRoot!.querySelector<PaperTabsElement>('#primaryTabs');
- const activeTabName = this.setActiveTab(
- primaryTabs,
- {
- activeTabName: e.detail.tab,
- activeTabIndex: e.detail.value,
- scrollIntoView: e.detail.scrollIntoView,
- },
- (e.composedPath()?.[0] as Element | undefined)?.tagName
- );
- if (activeTabName) {
- this.activeTabs = [activeTabName, this.activeTabs[1]];
+ this.activeTab = tabName as Tab;
- // update plugin endpoint if its a plugin tab
- const pluginIndex = (this.dynamicTabHeaderEndpoints || []).indexOf(
- activeTabName
- );
- if (pluginIndex !== -1) {
- this.selectedTabPluginEndpoint =
- this.dynamicTabContentEndpoints[pluginIndex];
- this.selectedTabPluginHeader =
- this.dynamicTabHeaderEndpoints[pluginIndex];
- } else {
- this.selectedTabPluginEndpoint = '';
- this.selectedTabPluginHeader = '';
- }
- }
if (e.detail.tabState) this.tabState = e.detail.tabState;
+ if (e.detail.scrollIntoView) paperTabs.scrollIntoView({block: 'center'});
}
/**
@@ -1735,7 +1694,7 @@
target = target?.parentElement as HTMLElement | null;
} while (target);
- if (tabName === PrimaryTab.COMMENT_THREADS) {
+ if (tabName === Tab.COMMENT_THREADS) {
// Show unresolved threads by default
// Show resolved threads only if no unresolved threads exist
const hasUnresolvedThreads =
@@ -2191,29 +2150,30 @@
getPluginLoader()
.awaitPluginsLoaded()
.then(() => {
- this.initActiveTabs();
+ this.initActiveTab();
});
}
- private initActiveTabs() {
- let primaryTab = PrimaryTab.FILES;
+ private initActiveTab() {
+ let tab = Tab.FILES;
if (this.params?.tab) {
- primaryTab = this.params?.tab as PrimaryTab;
+ tab = this.params?.tab as Tab;
} else if (this.params?.commentId) {
- primaryTab = PrimaryTab.COMMENT_THREADS;
+ tab = Tab.COMMENT_THREADS;
}
const detail: SwitchTabEventDetail = {
- tab: primaryTab,
+ tab,
};
- if (primaryTab === PrimaryTab.CHECKS) {
+ if (tab === Tab.CHECKS) {
const state: ChecksTabState = {};
detail.tabState = {checksTab: state};
if (this.params?.filter) state.filter = this.params.filter;
if (this.params?.select) state.select = this.params.select;
if (this.params?.attempt) state.attempt = this.params.attempt;
}
- this.setActivePrimaryTab(
- new CustomEvent(EventType.SHOW_PRIMARY_TAB, {
+
+ this.setActiveTab(
+ new CustomEvent(EventType.SHOW_TAB, {
detail,
})
);
diff --git a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_test.ts b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_test.ts
index 66ef3ab..5135262 100644
--- a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_test.ts
+++ b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_test.ts
@@ -14,8 +14,8 @@
DiffViewMode,
HttpMethod,
MessageTag,
- PrimaryTab,
createDefaultPreferences,
+ Tab,
} from '../../../constants/constants';
import {GrEditConstants} from '../../edit/gr-edit-constants';
import {_testOnly_resetEndpoints} from '../../shared/gr-js-api-interface/gr-plugin-endpoints';
@@ -95,7 +95,7 @@
import {GrThreadList} from '../gr-thread-list/gr-thread-list';
import {assertIsDefined} from '../../../utils/common-util';
import {DEFAULT_NUM_FILES_SHOWN} from '../gr-file-list/gr-file-list';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import {deepClone} from '../../../utils/deep-util';
suite('gr-change-view tests', () => {
@@ -369,9 +369,7 @@
changeNum: TEST_NUMERIC_CHANGE_ID,
project: 'gerrit' as RepoName,
};
- // Do this asynchronously as some tests don't expect the element to have
- // rendered yet.
- element.updateComplete.then(() => {
+ await element.updateComplete.then(() => {
assertIsDefined(element.actions);
sinon.stub(element.actions, 'reload').returns(Promise.resolve());
});
@@ -382,177 +380,180 @@
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div class="container loading">Loading...</div>
- <div aria-hidden="false" class="container" hidden="" id="mainContent">
- <section class="changeInfoSection">
- <div class="header">
- <h1 class="assistive-tech-only">Change :</h1>
- <div class="headerTitle">
- <div class="changeStatuses"></div>
- <gr-change-star id="changeStar"> </gr-change-star>
- <a aria-label="Change undefined" class="changeNumber"> </a>
- <span class="changeNumberColon"> : </span>
- <span class="headerSubject"> </span>
- <gr-copy-clipboard
- class="changeCopyClipboard"
- hideinput=""
- text="undefined: undefined | http://localhost:9876undefined"
- >
- </gr-copy-clipboard>
- </div>
- <div class="commitActions">
- <gr-change-actions hidden="" id="actions"> </gr-change-actions>
- </div>
- </div>
- <h2 class="assistive-tech-only">Change metadata</h2>
- <div class="changeInfo">
- <div class="changeInfo-column changeMetadata hideOnMobileOverlay">
- <gr-change-metadata id="metadata"> </gr-change-metadata>
- </div>
- <div class="changeInfo-column mainChangeInfo" id="mainChangeInfo">
- <div class="hideOnMobileOverlay" id="commitAndRelated">
- <div class="commitContainer">
- <h3 class="assistive-tech-only">Commit Message</h3>
- <div>
- <gr-button
- aria-disabled="false"
- class="reply"
- id="replyBtn"
- primary=""
- role="button"
- tabindex="0"
- title="Open reply dialog to publish comments and add reviewers (shortcut: a)"
- >
- Reply
- </gr-button>
- </div>
- <div class="commitMessage" id="commitMessage">
- <gr-editable-content
- id="commitMessageEditor"
- remove-zero-width-space=""
- >
- <gr-linked-text pre="" remove-zero-width-space="">
- <span id="output" slot="insert"> </span>
- </gr-linked-text>
- </gr-editable-content>
- </div>
- <h3 class="assistive-tech-only">
- Comments and Checks Summary
- </h3>
- <gr-change-summary> </gr-change-summary>
- <gr-endpoint-decorator name="commit-container">
- <gr-endpoint-param name="change"> </gr-endpoint-param>
- <gr-endpoint-param name="revision"> </gr-endpoint-param>
- </gr-endpoint-decorator>
- </div>
- <div class="relatedChanges">
- <gr-related-changes-list id="relatedChanges">
- </gr-related-changes-list>
- </div>
- <div class="emptySpace"></div>
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div class="container loading">Loading...</div>
+ <div aria-hidden="false" class="container" hidden="" id="mainContent">
+ <section class="changeInfoSection">
+ <div class="header">
+ <h1 class="assistive-tech-only">Change :</h1>
+ <div class="headerTitle">
+ <div class="changeStatuses"></div>
+ <gr-change-star id="changeStar"> </gr-change-star>
+ <a aria-label="Change undefined" class="changeNumber"> </a>
+ <span class="changeNumberColon"> : </span>
+ <span class="headerSubject"> </span>
+ <gr-copy-clipboard
+ class="changeCopyClipboard"
+ hideinput=""
+ text="undefined: undefined | http://localhost:9876undefined"
+ >
+ </gr-copy-clipboard>
+ </div>
+ <div class="commitActions">
+ <gr-change-actions hidden="" id="actions"> </gr-change-actions>
</div>
</div>
- </div>
- </section>
- <h2 class="assistive-tech-only">Files and Comments tabs</h2>
- <paper-tabs dir="null" id="primaryTabs" role="tablist" tabindex="0">
- <paper-tab
- aria-disabled="false"
- aria-selected="true"
- class="iron-selected"
- data-name="files"
- role="tab"
- tabindex="0"
- >
- <span> Files </span>
- </paper-tab>
- <paper-tab
- aria-disabled="false"
- aria-selected="false"
- class="commentThreads"
- data-name="comments"
- role="tab"
- tabindex="-1"
- >
- <gr-tooltip-content has-tooltip="" title="">
- <span> Comments </span>
- </gr-tooltip-content>
- </paper-tab>
- <paper-tab
- aria-disabled="false"
- aria-selected="false"
- data-name="change-view-tab-header-url"
- role="tab"
- tabindex="-1"
- >
- <gr-endpoint-decorator name="change-view-tab-header-url">
- <gr-endpoint-param name="change"> </gr-endpoint-param>
- <gr-endpoint-param name="revision"> </gr-endpoint-param>
- </gr-endpoint-decorator>
- </paper-tab>
- </paper-tabs>
- <section class="patchInfo">
- <div>
- <gr-file-list-header id="fileListHeader"> </gr-file-list-header>
- <gr-file-list class="hideOnMobileOverlay" id="fileList">
- </gr-file-list>
- </div>
- </section>
- <gr-endpoint-decorator name="change-view-integration">
- <gr-endpoint-param name="change"> </gr-endpoint-param>
- <gr-endpoint-param name="revision"> </gr-endpoint-param>
- </gr-endpoint-decorator>
- <paper-tabs dir="null" id="secondaryTabs" role="tablist" tabindex="0">
- <paper-tab
- aria-disabled="false"
- aria-selected="false"
- class="changeLog"
- data-name="_changeLog"
- role="tab"
- tabindex="-1"
- >
- Change Log
- </paper-tab>
- </paper-tabs>
- <section class="changeLog">
- <h2 class="assistive-tech-only">Change Log</h2>
- <gr-messages-list class="hideOnMobileOverlay"> </gr-messages-list>
- </section>
- </div>
- <gr-apply-fix-dialog id="applyFixDialog"> </gr-apply-fix-dialog>
- <gr-overlay
- aria-hidden="true"
- id="downloadOverlay"
- style="outline: none; display: none;"
- tabindex="-1"
- with-backdrop=""
- >
- <gr-download-dialog id="downloadDialog" role="dialog">
- </gr-download-dialog>
- </gr-overlay>
- <gr-overlay
- aria-hidden="true"
- id="includedInOverlay"
- style="outline: none; display: none;"
- tabindex="-1"
- with-backdrop=""
- >
- <gr-included-in-dialog id="includedInDialog"> </gr-included-in-dialog>
- </gr-overlay>
- <gr-overlay
- aria-hidden="true"
- class="scrollable"
- id="replyOverlay"
- no-cancel-on-esc-key=""
- no-cancel-on-outside-click=""
- scroll-action="lock"
- style="outline: none; display: none;"
- tabindex="-1"
- with-backdrop=""
- >
- </gr-overlay>
- `);
+ <h2 class="assistive-tech-only">Change metadata</h2>
+ <div class="changeInfo">
+ <div class="changeInfo-column changeMetadata hideOnMobileOverlay">
+ <gr-change-metadata id="metadata"> </gr-change-metadata>
+ </div>
+ <div class="changeInfo-column mainChangeInfo" id="mainChangeInfo">
+ <div class="hideOnMobileOverlay" id="commitAndRelated">
+ <div class="commitContainer">
+ <h3 class="assistive-tech-only">Commit Message</h3>
+ <div>
+ <gr-button
+ aria-disabled="false"
+ class="reply"
+ id="replyBtn"
+ primary=""
+ role="button"
+ tabindex="0"
+ title="Open reply dialog to publish comments and add reviewers (shortcut: a)"
+ >
+ Reply
+ </gr-button>
+ </div>
+ <div class="commitMessage" id="commitMessage">
+ <gr-editable-content
+ id="commitMessageEditor"
+ remove-zero-width-space=""
+ >
+ <gr-linked-text pre="" remove-zero-width-space="">
+ <span id="output" slot="insert"> </span>
+ </gr-linked-text>
+ </gr-editable-content>
+ </div>
+ <h3 class="assistive-tech-only">
+ Comments and Checks Summary
+ </h3>
+ <gr-change-summary> </gr-change-summary>
+ <gr-endpoint-decorator name="commit-container">
+ <gr-endpoint-param name="change"> </gr-endpoint-param>
+ <gr-endpoint-param name="revision"> </gr-endpoint-param>
+ </gr-endpoint-decorator>
+ </div>
+ <div class="relatedChanges">
+ <gr-related-changes-list id="relatedChanges">
+ </gr-related-changes-list>
+ </div>
+ <div class="emptySpace"></div>
+ </div>
+ </div>
+ </div>
+ </section>
+ <h2 class="assistive-tech-only">Files and Comments tabs</h2>
+ <paper-tabs dir="null" id="tabs" role="tablist" tabindex="0">
+ <paper-tab
+ aria-disabled="false"
+ aria-selected="true"
+ class="iron-selected"
+ data-name="files"
+ role="tab"
+ tabindex="0"
+ >
+ <span> Files </span>
+ </paper-tab>
+ <paper-tab
+ aria-disabled="false"
+ aria-selected="false"
+ class="commentThreads"
+ data-name="comments"
+ role="tab"
+ tabindex="-1"
+ >
+ <gr-tooltip-content has-tooltip="" title="">
+ <span> Comments </span>
+ </gr-tooltip-content>
+ </paper-tab>
+ <paper-tab
+ aria-disabled="false"
+ aria-selected="false"
+ data-name="change-view-tab-header-url"
+ role="tab"
+ tabindex="-1"
+ >
+ <gr-endpoint-decorator name="change-view-tab-header-url">
+ <gr-endpoint-param name="change"> </gr-endpoint-param>
+ <gr-endpoint-param name="revision"> </gr-endpoint-param>
+ </gr-endpoint-decorator>
+ </paper-tab>
+ </paper-tabs>
+ <section class="tabContent">
+ <div>
+ <gr-file-list-header id="fileListHeader"> </gr-file-list-header>
+ <gr-file-list class="hideOnMobileOverlay" id="fileList">
+ </gr-file-list>
+ </div>
+ </section>
+ <gr-endpoint-decorator name="change-view-integration">
+ <gr-endpoint-param name="change"> </gr-endpoint-param>
+ <gr-endpoint-param name="revision"> </gr-endpoint-param>
+ </gr-endpoint-decorator>
+ <paper-tabs dir="null" role="tablist" tabindex="0">
+ <paper-tab
+ aria-disabled="false"
+ aria-selected="false"
+ class="changeLog"
+ data-name="_changeLog"
+ role="tab"
+ tabindex="-1"
+ >
+ Change Log
+ </paper-tab>
+ </paper-tabs>
+ <section class="changeLog">
+ <h2 class="assistive-tech-only">Change Log</h2>
+ <gr-messages-list class="hideOnMobileOverlay"> </gr-messages-list>
+ </section>
+ </div>
+ <gr-apply-fix-dialog id="applyFixDialog"> </gr-apply-fix-dialog>
+ <gr-overlay
+ aria-hidden="true"
+ id="downloadOverlay"
+ style="outline: none; display: none;"
+ tabindex="-1"
+ with-backdrop=""
+ >
+ <gr-download-dialog id="downloadDialog" role="dialog">
+ </gr-download-dialog>
+ </gr-overlay>
+ <gr-overlay
+ aria-hidden="true"
+ id="includedInOverlay"
+ style="outline: none; display: none;"
+ tabindex="-1"
+ with-backdrop=""
+ >
+ <gr-included-in-dialog id="includedInDialog"> </gr-included-in-dialog>
+ </gr-overlay>
+ <gr-overlay
+ aria-hidden="true"
+ class="scrollable"
+ id="replyOverlay"
+ no-cancel-on-esc-key=""
+ no-cancel-on-outside-click=""
+ scroll-action="lock"
+ style="outline: none; display: none;"
+ tabindex="-1"
+ with-backdrop=""
+ >
+ </gr-overlay>
+ `
+ );
});
test('handleMessageAnchorTap', async () => {
@@ -684,35 +685,35 @@
setup(async () => {
element.changeNum = TEST_NUMERIC_CHANGE_ID;
await element.updateComplete;
+ await waitUntil(() => element.pluginTabsHeaderEndpoints.length > 0);
});
test('plugin added tab shows up as a dynamic endpoint', async () => {
- await flush();
assert(
- element.dynamicTabHeaderEndpoints.includes('change-view-tab-header-url')
+ element.pluginTabsHeaderEndpoints.includes('change-view-tab-header-url')
);
- const primaryTabs = element.shadowRoot!.querySelector('#primaryTabs')!;
- const paperTabs = primaryTabs.querySelectorAll<HTMLElement>('paper-tab');
+ const tabs = element.shadowRoot!.querySelector('#tabs')!;
+ const paperTabs = tabs.querySelectorAll<HTMLElement>('paper-tab');
// 4 Tabs are : Files, Comment Threads, Plugin
- assert.equal(primaryTabs.querySelectorAll('paper-tab').length, 3);
+ assert.equal(tabs.querySelectorAll('paper-tab').length, 3);
assert.equal(paperTabs[0].dataset.name, 'files');
assert.equal(paperTabs[1].dataset.name, 'comments');
assert.equal(paperTabs[2].dataset.name, 'change-view-tab-header-url');
});
- test('setActivePrimaryTab switched tab correctly', async () => {
- element.setActivePrimaryTab(
+ test('setActiveTab switched tab correctly', async () => {
+ element.setActiveTab(
new CustomEvent('', {
detail: {tab: 'change-view-tab-header-url'},
})
);
await element.updateComplete;
- assert.equal(element.activeTabs[0], 'change-view-tab-header-url');
+ assert.equal(element.activeTab, 'change-view-tab-header-url');
});
- test('show-primary-tab switched primary tab correctly', async () => {
+ test('show-tab switched primary tab correctly', async () => {
element.dispatchEvent(
- new CustomEvent('show-primary-tab', {
+ new CustomEvent('show-tab', {
composed: true,
bubbles: true,
detail: {
@@ -721,24 +722,24 @@
})
);
await element.updateComplete;
- assert.equal(element.activeTabs[0], 'change-view-tab-header-url');
+ assert.equal(element.activeTab, 'change-view-tab-header-url');
});
test('param change should switch primary tab correctly', async () => {
- assert.equal(element.activeTabs[0], PrimaryTab.FILES);
+ assert.equal(element.activeTab, Tab.FILES);
// view is required
element.changeNum = undefined;
element.params = {
...createAppElementChangeViewParams(),
...element.params,
- tab: PrimaryTab.COMMENT_THREADS,
+ tab: Tab.COMMENT_THREADS,
};
await element.updateComplete;
- assert.equal(element.activeTabs[0], PrimaryTab.COMMENT_THREADS);
+ assert.equal(element.activeTab, Tab.COMMENT_THREADS);
});
test('invalid param change should not switch primary tab', async () => {
- assert.equal(element.activeTabs[0], PrimaryTab.FILES);
+ assert.equal(element.activeTab, Tab.FILES);
// view is required
element.params = {
...createAppElementChangeViewParams(),
@@ -746,16 +747,23 @@
tab: 'random',
};
await element.updateComplete;
- assert.equal(element.activeTabs[0], PrimaryTab.FILES);
+ assert.equal(element.activeTab, Tab.FILES);
});
- test('switching tab sets _selectedTabPluginEndpoint', async () => {
- const paperTabs = element.shadowRoot!.querySelector('#primaryTabs')!;
+ test('switching to plugin tab renders the plugin tab content', async () => {
+ const paperTabs = element.shadowRoot!.querySelector('#tabs')!;
tap(paperTabs.querySelectorAll('paper-tab')[2]);
await element.updateComplete;
- assert.equal(
- element.selectedTabPluginEndpoint,
- 'change-view-tab-content-url'
+ const tabContent = queryAndAssert(element, '.tabContent');
+ const endpoint = queryAndAssert(tabContent, 'gr-endpoint-decorator');
+ assert.dom.equal(
+ endpoint,
+ /* HTML */ `
+ <gr-endpoint-decorator>
+ <gr-endpoint-param name="change"></gr-endpoint-param>
+ <gr-endpoint-param name="revision"></gr-endpoint-param>
+ </gr-endpoint-decorator>
+ `
);
});
});
@@ -1068,7 +1076,7 @@
};
element.commentThreads = THREADS;
await element.updateComplete;
- const paperTabs = element.shadowRoot!.querySelector('#primaryTabs')!;
+ const paperTabs = element.shadowRoot!.querySelector('#tabs')!;
const tabs = paperTabs.querySelectorAll('paper-tab');
assert.isTrue(tabs.length > 1);
assert.equal(tabs[1].dataset.name, 'comments');
@@ -1108,7 +1116,7 @@
element.commentThreads = THREADS;
element.showFindingsTab = true;
await element.updateComplete;
- const paperTabs = element.shadowRoot!.querySelector('#primaryTabs')!;
+ const paperTabs = element.shadowRoot!.querySelector('#tabs')!;
const tabs = paperTabs.querySelectorAll('paper-tab');
assert.isTrue(tabs.length > 3);
assert.equal(tabs[3].dataset.name, 'findings');
diff --git a/polygerrit-ui/app/elements/change/gr-commit-info/gr-commit-info_test.ts b/polygerrit-ui/app/elements/change/gr-commit-info/gr-commit-info_test.ts
index 363cdd2..f15094e 100644
--- a/polygerrit-ui/app/elements/change/gr-commit-info/gr-commit-info_test.ts
+++ b/polygerrit-ui/app/elements/change/gr-commit-info/gr-commit-info_test.ts
@@ -14,14 +14,13 @@
} from '../../../test/test-data-generators';
import {CommitId, RepoName} from '../../../types/common';
import {GrRouter} from '../../core/gr-router/gr-router';
-
-const basicFixture = fixtureFromElement('gr-commit-info');
+import {fixture, html} from '@open-wc/testing';
suite('gr-commit-info tests', () => {
let element: GrCommitInfo;
- setup(() => {
- element = basicFixture.instantiate();
+ setup(async () => {
+ element = await fixture(html`<gr-commit-info></gr-commit-info>`);
});
test('render', async () => {
@@ -30,12 +29,15 @@
element.serverConfig = createServerInfo();
await element.updateComplete;
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div class="container">
- <a href="" rel="noopener" target="_blank"> </a>
- <gr-copy-clipboard hastooltip="" hideinput=""> </gr-copy-clipboard>
- </div>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div class="container">
+ <a href="" rel="noopener" target="_blank"> </a>
+ <gr-copy-clipboard hastooltip="" hideinput=""> </gr-copy-clipboard>
+ </div>
+ `
+ );
});
test('weblinks use GerritNav interface', async () => {
diff --git a/polygerrit-ui/app/elements/change/gr-confirm-abandon-dialog/gr-confirm-abandon-dialog_test.ts b/polygerrit-ui/app/elements/change/gr-confirm-abandon-dialog/gr-confirm-abandon-dialog_test.ts
index aaae6b5..9df4c73 100644
--- a/polygerrit-ui/app/elements/change/gr-confirm-abandon-dialog/gr-confirm-abandon-dialog_test.ts
+++ b/polygerrit-ui/app/elements/change/gr-confirm-abandon-dialog/gr-confirm-abandon-dialog_test.ts
@@ -8,34 +8,37 @@
import {GrConfirmAbandonDialog} from './gr-confirm-abandon-dialog';
import {queryAndAssert} from '../../../test/test-utils';
import {GrDialog} from '../../shared/gr-dialog/gr-dialog';
-
-const basicFixture = fixtureFromElement('gr-confirm-abandon-dialog');
+import {fixture, html} from '@open-wc/testing';
suite('gr-confirm-abandon-dialog tests', () => {
let element: GrConfirmAbandonDialog;
setup(async () => {
- element = basicFixture.instantiate();
- await element.updateComplete;
+ element = await fixture(
+ html`<gr-confirm-abandon-dialog></gr-confirm-abandon-dialog>`
+ );
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <gr-dialog confirm-label="Abandon" role="dialog">
- <div class="header" slot="header">Abandon Change</div>
- <div class="main" slot="main">
- <label for="messageInput"> Abandon Message </label>
- <iron-autogrow-textarea
- aria-disabled="false"
- autocomplete="on"
- class="message"
- id="messageInput"
- placeholder="<Insert reasoning here>"
- >
- </iron-autogrow-textarea>
- </div>
- </gr-dialog>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <gr-dialog confirm-label="Abandon" role="dialog">
+ <div class="header" slot="header">Abandon Change</div>
+ <div class="main" slot="main">
+ <label for="messageInput"> Abandon Message </label>
+ <iron-autogrow-textarea
+ aria-disabled="false"
+ autocomplete="on"
+ class="message"
+ id="messageInput"
+ placeholder="<Insert reasoning here>"
+ >
+ </iron-autogrow-textarea>
+ </div>
+ </gr-dialog>
+ `
+ );
});
test('handleConfirmTap', () => {
diff --git a/polygerrit-ui/app/elements/change/gr-confirm-cherrypick-conflict-dialog/gr-confirm-cherrypick-conflict-dialog_test.ts b/polygerrit-ui/app/elements/change/gr-confirm-cherrypick-conflict-dialog/gr-confirm-cherrypick-conflict-dialog_test.ts
index 2613d87..b1623db 100644
--- a/polygerrit-ui/app/elements/change/gr-confirm-cherrypick-conflict-dialog/gr-confirm-cherrypick-conflict-dialog_test.ts
+++ b/polygerrit-ui/app/elements/change/gr-confirm-cherrypick-conflict-dialog/gr-confirm-cherrypick-conflict-dialog_test.ts
@@ -3,7 +3,7 @@
* Copyright 2018 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import '../../../test/common-test-setup-karma';
import {queryAndAssert} from '../../../utils/common-util';
import './gr-confirm-cherrypick-conflict-dialog';
@@ -21,18 +21,21 @@
});
test('render', async () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <gr-dialog confirm-label="Continue" role="dialog">
- <div class="header" slot="header">Cherry Pick Conflict!</div>
- <div class="main" slot="main">
- <span>Cherry Pick failed! (merge conflicts)</span>
- <span
- >Please select "Continue" to continue with conflicts or select
+ assert.shadowDom.equal(
+ element,
+ /* prettier-ignore */ /* HTML */ `
+ <gr-dialog confirm-label="Continue" role="dialog">
+ <div class="header" slot="header">Cherry Pick Conflict!</div>
+ <div class="main" slot="main">
+ <span>Cherry Pick failed! (merge conflicts)</span>
+ <span
+ >Please select "Continue" to continue with conflicts or select
"cancel" to close the dialog.</span
- >
- </div>
- </gr-dialog>
- `);
+ >
+ </div>
+ </gr-dialog>
+ `
+ );
});
test('confirm', async () => {
diff --git a/polygerrit-ui/app/elements/change/gr-confirm-cherrypick-dialog/gr-confirm-cherrypick-dialog_test.ts b/polygerrit-ui/app/elements/change/gr-confirm-cherrypick-dialog/gr-confirm-cherrypick-dialog_test.ts
index 7933896..1d23cff 100644
--- a/polygerrit-ui/app/elements/change/gr-confirm-cherrypick-dialog/gr-confirm-cherrypick-dialog_test.ts
+++ b/polygerrit-ui/app/elements/change/gr-confirm-cherrypick-dialog/gr-confirm-cherrypick-dialog_test.ts
@@ -24,7 +24,7 @@
import {GrDialog} from '../../shared/gr-dialog/gr-dialog.js';
import * as MockInteractions from '@polymer/iron-test-helpers/mock-interactions';
import {ProgressStatus} from '../../../constants/constants';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
const CHERRY_PICK_TYPES = {
SINGLE_CHANGE: 1,
@@ -54,43 +54,49 @@
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <gr-dialog confirm-label="Cherry Pick" disabled="" role="dialog">
- <div class="header title" slot="header">
- Cherry Pick Change to Another Branch
- </div>
- <div class="main" slot="main">
- <gr-endpoint-decorator name="cherrypick-main">
- <gr-endpoint-param name="changes"> </gr-endpoint-param>
- <gr-endpoint-slot name="top"> </gr-endpoint-slot>
- <label for="branchInput"> Cherry Pick to branch </label>
- <gr-autocomplete id="branchInput" placeholder="Destination branch">
- </gr-autocomplete>
- <label for="baseInput">
- Provide base commit sha1 for cherry-pick
- </label>
- <iron-input>
- <input
- id="baseCommitInput"
- is="iron-input"
- maxlength="40"
- placeholder="(optional)"
- />
- </iron-input>
- <label for="messageInput"> Cherry Pick Commit Message </label>
- <iron-autogrow-textarea
- aria-disabled="false"
- autocomplete="on"
- class="message"
- id="messageInput"
- rows="4"
- >
- </iron-autogrow-textarea>
- <gr-endpoint-slot name="bottom"></gr-endpoint-slot>
- </gr-endpoint-decorator>
- </div>
- </gr-dialog>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <gr-dialog confirm-label="Cherry Pick" disabled="" role="dialog">
+ <div class="header title" slot="header">
+ Cherry Pick Change to Another Branch
+ </div>
+ <div class="main" slot="main">
+ <gr-endpoint-decorator name="cherrypick-main">
+ <gr-endpoint-param name="changes"> </gr-endpoint-param>
+ <gr-endpoint-slot name="top"> </gr-endpoint-slot>
+ <label for="branchInput"> Cherry Pick to branch </label>
+ <gr-autocomplete
+ id="branchInput"
+ placeholder="Destination branch"
+ >
+ </gr-autocomplete>
+ <label for="baseInput">
+ Provide base commit sha1 for cherry-pick
+ </label>
+ <iron-input>
+ <input
+ id="baseCommitInput"
+ is="iron-input"
+ maxlength="40"
+ placeholder="(optional)"
+ />
+ </iron-input>
+ <label for="messageInput"> Cherry Pick Commit Message </label>
+ <iron-autogrow-textarea
+ aria-disabled="false"
+ autocomplete="on"
+ class="message"
+ id="messageInput"
+ rows="4"
+ >
+ </iron-autogrow-textarea>
+ <gr-endpoint-slot name="bottom"></gr-endpoint-slot>
+ </gr-endpoint-decorator>
+ </div>
+ </gr-dialog>
+ `
+ );
});
test('with message missing newline', async () => {
diff --git a/polygerrit-ui/app/elements/change/gr-confirm-move-dialog/gr-confirm-move-dialog_test.ts b/polygerrit-ui/app/elements/change/gr-confirm-move-dialog/gr-confirm-move-dialog_test.ts
index a0b55de..d627e19 100644
--- a/polygerrit-ui/app/elements/change/gr-confirm-move-dialog/gr-confirm-move-dialog_test.ts
+++ b/polygerrit-ui/app/elements/change/gr-confirm-move-dialog/gr-confirm-move-dialog_test.ts
@@ -8,7 +8,7 @@
import {GrConfirmMoveDialog} from './gr-confirm-move-dialog';
import {queryAndAssert, stubRestApi} from '../../../test/test-utils';
import {BranchName, GitRef, RepoName} from '../../../types/common';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import {GrAutocomplete} from '../../shared/gr-autocomplete/gr-autocomplete';
suite('gr-confirm-move-dialog tests', () => {
@@ -36,26 +36,29 @@
});
test('render', async () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <gr-dialog confirm-label="Move Change" role="dialog">
- <div class="header" slot="header">Move Change to Another Branch</div>
- <div class="main" slot="main">
- <p class="warning">
- Warning: moving a change will not change its parents.
- </p>
- <label for="branchInput"> Move change to branch </label>
- <gr-autocomplete id="branchInput" placeholder="Destination branch">
- </gr-autocomplete>
- <label for="messageInput"> Move Change Message </label>
- <iron-autogrow-textarea
- aria-disabled="false"
- id="messageInput"
- class="message"
- autocomplete="on"
- ></iron-autogrow-textarea>
- </div>
- </gr-dialog>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <gr-dialog confirm-label="Move Change" role="dialog">
+ <div class="header" slot="header">Move Change to Another Branch</div>
+ <div class="main" slot="main">
+ <p class="warning">
+ Warning: moving a change will not change its parents.
+ </p>
+ <label for="branchInput"> Move change to branch </label>
+ <gr-autocomplete id="branchInput" placeholder="Destination branch">
+ </gr-autocomplete>
+ <label for="messageInput"> Move Change Message </label>
+ <iron-autogrow-textarea
+ aria-disabled="false"
+ id="messageInput"
+ class="message"
+ autocomplete="on"
+ ></iron-autogrow-textarea>
+ </div>
+ </gr-dialog>
+ `
+ );
});
test('with updated commit message', async () => {
diff --git a/polygerrit-ui/app/elements/change/gr-confirm-rebase-dialog/gr-confirm-rebase-dialog_test.ts b/polygerrit-ui/app/elements/change/gr-confirm-rebase-dialog/gr-confirm-rebase-dialog_test.ts
index fa247de..6e6ed15 100644
--- a/polygerrit-ui/app/elements/change/gr-confirm-rebase-dialog/gr-confirm-rebase-dialog_test.ts
+++ b/polygerrit-ui/app/elements/change/gr-confirm-rebase-dialog/gr-confirm-rebase-dialog_test.ts
@@ -10,7 +10,7 @@
import * as MockInteractions from '@polymer/iron-test-helpers/mock-interactions';
import {NumericChangeId, BranchName} from '../../../types/common';
import {createChangeViewChange} from '../../../test/test-data-generators';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
suite('gr-confirm-rebase-dialog tests', () => {
let element: GrConfirmRebaseDialog;
@@ -24,55 +24,58 @@
test('render', async () => {
element.branch = 'test' as BranchName;
await element.updateComplete;
- expect(element).shadowDom.to.equal(/* HTML */ `<gr-dialog
- confirm-label="Rebase"
- id="confirmDialog"
- role="dialog"
- >
- <div class="header" slot="header">Confirm rebase</div>
- <div class="main" slot="main">
- <div class="rebaseOption" hidden="" id="rebaseOnParent">
- <input id="rebaseOnParentInput" name="rebaseOptions" type="radio" />
- <label for="rebaseOnParentInput" id="rebaseOnParentLabel">
- Rebase on parent change
- </label>
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `<gr-dialog
+ confirm-label="Rebase"
+ id="confirmDialog"
+ role="dialog"
+ >
+ <div class="header" slot="header">Confirm rebase</div>
+ <div class="main" slot="main">
+ <div class="rebaseOption" hidden="" id="rebaseOnParent">
+ <input id="rebaseOnParentInput" name="rebaseOptions" type="radio" />
+ <label for="rebaseOnParentInput" id="rebaseOnParentLabel">
+ Rebase on parent change
+ </label>
+ </div>
+ <div class="message" hidden="" id="parentUpToDateMsg">
+ This change is up to date with its parent.
+ </div>
+ <div class="rebaseOption" hidden="" id="rebaseOnTip">
+ <input
+ disabled=""
+ id="rebaseOnTipInput"
+ name="rebaseOptions"
+ type="radio"
+ />
+ <label for="rebaseOnTipInput" id="rebaseOnTipLabel">
+ Rebase on top of the test branch
+ <span hidden=""> (breaks relation chain) </span>
+ </label>
+ </div>
+ <div class="message" id="tipUpToDateMsg">
+ Change is up to date with the target branch already (test)
+ </div>
+ <div class="rebaseOption" id="rebaseOnOther">
+ <input id="rebaseOnOtherInput" name="rebaseOptions" type="radio" />
+ <label for="rebaseOnOtherInput" id="rebaseOnOtherLabel">
+ Rebase on a specific change, ref, or commit
+ <span hidden=""> (breaks relation chain) </span>
+ </label>
+ </div>
+ <div class="parentRevisionContainer">
+ <gr-autocomplete
+ allow-non-suggested-values=""
+ id="parentInput"
+ no-debounce=""
+ placeholder="Change number, ref, or commit hash"
+ >
+ </gr-autocomplete>
+ </div>
</div>
- <div class="message" hidden="" id="parentUpToDateMsg">
- This change is up to date with its parent.
- </div>
- <div class="rebaseOption" hidden="" id="rebaseOnTip">
- <input
- disabled=""
- id="rebaseOnTipInput"
- name="rebaseOptions"
- type="radio"
- />
- <label for="rebaseOnTipInput" id="rebaseOnTipLabel">
- Rebase on top of the test branch
- <span hidden=""> (breaks relation chain) </span>
- </label>
- </div>
- <div class="message" id="tipUpToDateMsg">
- Change is up to date with the target branch already (test)
- </div>
- <div class="rebaseOption" id="rebaseOnOther">
- <input id="rebaseOnOtherInput" name="rebaseOptions" type="radio" />
- <label for="rebaseOnOtherInput" id="rebaseOnOtherLabel">
- Rebase on a specific change, ref, or commit
- <span hidden=""> (breaks relation chain) </span>
- </label>
- </div>
- <div class="parentRevisionContainer">
- <gr-autocomplete
- allow-non-suggested-values=""
- id="parentInput"
- no-debounce=""
- placeholder="Change number, ref, or commit hash"
- >
- </gr-autocomplete>
- </div>
- </div>
- </gr-dialog> `);
+ </gr-dialog> `
+ );
});
test('controls with parent and rebase on current available', async () => {
diff --git a/polygerrit-ui/app/elements/change/gr-confirm-revert-dialog/gr-confirm-revert-dialog_test.ts b/polygerrit-ui/app/elements/change/gr-confirm-revert-dialog/gr-confirm-revert-dialog_test.ts
index 6cb9771..7aea221 100644
--- a/polygerrit-ui/app/elements/change/gr-confirm-revert-dialog/gr-confirm-revert-dialog_test.ts
+++ b/polygerrit-ui/app/elements/change/gr-confirm-revert-dialog/gr-confirm-revert-dialog_test.ts
@@ -3,7 +3,7 @@
* Copyright 2016 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import '../../../test/common-test-setup-karma';
import {createChange} from '../../../test/test-data-generators';
import {CommitId} from '../../../types/common';
@@ -20,24 +20,27 @@
});
test('renders', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <gr-dialog role="dialog">
- <div class="header" slot="header">Revert Merged Change</div>
- <div class="main" slot="main">
- <div class="error" hidden="">
- <span> A reason is required </span>
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <gr-dialog role="dialog">
+ <div class="header" slot="header">Revert Merged Change</div>
+ <div class="main" slot="main">
+ <div class="error" hidden="">
+ <span> A reason is required </span>
+ </div>
+ <gr-endpoint-decorator name="confirm-revert-change">
+ <label for="messageInput"> Revert Commit Message </label>
+ <iron-autogrow-textarea
+ id="messageInput"
+ class="message"
+ aria-disabled="false"
+ ></iron-autogrow-textarea>
+ </gr-endpoint-decorator>
</div>
- <gr-endpoint-decorator name="confirm-revert-change">
- <label for="messageInput"> Revert Commit Message </label>
- <iron-autogrow-textarea
- id="messageInput"
- class="message"
- aria-disabled="false"
- ></iron-autogrow-textarea>
- </gr-endpoint-decorator>
- </div>
- </gr-dialog>
- `);
+ </gr-dialog>
+ `
+ );
});
test('no match', () => {
diff --git a/polygerrit-ui/app/elements/change/gr-confirm-submit-dialog/gr-confirm-submit-dialog_test.ts b/polygerrit-ui/app/elements/change/gr-confirm-submit-dialog/gr-confirm-submit-dialog_test.ts
index 11a5c61..e9924b5 100644
--- a/polygerrit-ui/app/elements/change/gr-confirm-submit-dialog/gr-confirm-submit-dialog_test.ts
+++ b/polygerrit-ui/app/elements/change/gr-confirm-submit-dialog/gr-confirm-submit-dialog_test.ts
@@ -12,14 +12,15 @@
import {EDIT} from '../../../types/common';
import {GrConfirmSubmitDialog} from './gr-confirm-submit-dialog';
import './gr-confirm-submit-dialog';
-
-const basicFixture = fixtureFromElement('gr-confirm-submit-dialog');
+import {fixture, html} from '@open-wc/testing';
suite('gr-confirm-submit-dialog tests', () => {
let element: GrConfirmSubmitDialog;
- setup(() => {
- element = basicFixture.instantiate();
+ setup(async () => {
+ element = await fixture(
+ html`<gr-confirm-submit-dialog></gr-confirm-submit-dialog>`
+ );
element.initialised = true;
});
@@ -32,27 +33,30 @@
};
await element.updateComplete;
- expect(element).shadowDom.to.equal(/* HTML */ `
- <gr-dialog
- confirm-label="Continue"
- confirm-on-enter=""
- id="dialog"
- role="dialog"
- >
- <div class="header" slot="header">my-label</div>
- <div class="main" slot="main">
- <gr-endpoint-decorator name="confirm-submit-change">
- <p>
- Ready to submit “
- <strong> my-subject </strong>
- ”?
- </p>
- <gr-endpoint-param name="change"> </gr-endpoint-param>
- <gr-endpoint-param name="action"> </gr-endpoint-param>
- </gr-endpoint-decorator>
- </div>
- </gr-dialog>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <gr-dialog
+ confirm-label="Continue"
+ confirm-on-enter=""
+ id="dialog"
+ role="dialog"
+ >
+ <div class="header" slot="header">my-label</div>
+ <div class="main" slot="main">
+ <gr-endpoint-decorator name="confirm-submit-change">
+ <p>
+ Ready to submit “
+ <strong> my-subject </strong>
+ ”?
+ </p>
+ <gr-endpoint-param name="change"> </gr-endpoint-param>
+ <gr-endpoint-param name="action"> </gr-endpoint-param>
+ </gr-endpoint-decorator>
+ </div>
+ </gr-dialog>
+ `
+ );
});
test('computeUnresolvedCommentsWarning', () => {
diff --git a/polygerrit-ui/app/elements/change/gr-download-dialog/gr-download-dialog_test.ts b/polygerrit-ui/app/elements/change/gr-download-dialog/gr-download-dialog_test.ts
index 3ba7e62..4343874 100644
--- a/polygerrit-ui/app/elements/change/gr-download-dialog/gr-download-dialog_test.ts
+++ b/polygerrit-ui/app/elements/change/gr-download-dialog/gr-download-dialog_test.ts
@@ -21,8 +21,7 @@
import {GrDownloadDialog} from './gr-download-dialog';
import {mockPromise, queryAll, queryAndAssert} from '../../../test/test-utils';
import {GrDownloadCommands} from '../../shared/gr-download-commands/gr-download-commands';
-
-const basicFixture = fixtureFromElement('gr-download-dialog');
+import {fixture, html} from '@open-wc/testing';
function getChangeObject() {
return {
@@ -96,7 +95,7 @@
let element: GrDownloadDialog;
setup(async () => {
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-download-dialog></gr-download-dialog>`);
element.patchNum = 1 as PatchSetNum;
element.config = createDownloadInfo();
await element.updateComplete;
@@ -104,8 +103,9 @@
test('render', () => {
// prettier and shadowDom string don't agree on the long text in the h3
- expect(element).shadowDom.to
- .equal(/* prettier-ignore */ /* HTML */ `
+ assert.shadowDom.equal(
+ element,
+ /* prettier-ignore */ /* HTML */ `
<section>
<h3 class="heading-3">
Patch set 1 of
@@ -148,7 +148,8 @@
</gr-button>
</span>
</section>
- `);
+ `
+ );
});
test('anchors use download attribute', () => {
diff --git a/polygerrit-ui/app/elements/change/gr-file-list-header/gr-file-list-header_test.ts b/polygerrit-ui/app/elements/change/gr-file-list-header/gr-file-list-header_test.ts
index e7b4a87..e51df4b 100644
--- a/polygerrit-ui/app/elements/change/gr-file-list-header/gr-file-list-header_test.ts
+++ b/polygerrit-ui/app/elements/change/gr-file-list-header/gr-file-list-header_test.ts
@@ -27,7 +27,7 @@
import {ChangeInfo, ChangeStatus} from '../../../api/rest-api';
import {PatchSet} from '../../../utils/patch-set-util';
import {createDefaultDiffPrefs} from '../../../constants/constants';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import {GrButton} from '../../shared/gr-button/gr-button';
suite('gr-file-list-header tests', () => {
@@ -57,85 +57,88 @@
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div class="patchInfo-header">
- <div class="patchInfo-left">
- <div class="patchInfoContent">
- <gr-patch-range-select id="rangeSelect"> </gr-patch-range-select>
- <span class="separator"> </span>
- <gr-commit-info> </gr-commit-info>
- <span class="container latestPatchContainer">
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div class="patchInfo-header">
+ <div class="patchInfo-left">
+ <div class="patchInfoContent">
+ <gr-patch-range-select id="rangeSelect"> </gr-patch-range-select>
<span class="separator"> </span>
- <a> Go to latest patch set </a>
- </span>
+ <gr-commit-info> </gr-commit-info>
+ <span class="container latestPatchContainer">
+ <span class="separator"> </span>
+ <a> Go to latest patch set </a>
+ </span>
+ </div>
</div>
- </div>
- <div class="rightControls">
- <div class="fileViewActions">
- <span class="fileViewActionsLabel"> Diff view: </span>
- <gr-diff-mode-selector id="modeSelect"> </gr-diff-mode-selector>
- <span class="hideOnEdit" hidden="" id="diffPrefsContainer">
- <gr-tooltip-content has-tooltip="" title="Diff preferences">
+ <div class="rightControls">
+ <div class="fileViewActions">
+ <span class="fileViewActionsLabel"> Diff view: </span>
+ <gr-diff-mode-selector id="modeSelect"> </gr-diff-mode-selector>
+ <span class="hideOnEdit" hidden="" id="diffPrefsContainer">
+ <gr-tooltip-content has-tooltip="" title="Diff preferences">
+ <gr-button
+ aria-disabled="false"
+ class="desktop prefsButton"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ <gr-icon filled icon="settings"></gr-icon>
+ </gr-button>
+ </gr-tooltip-content>
+ </span>
+ <span class="separator"> </span>
+ </div>
+ <span class="desktop downloadContainer">
+ <gr-tooltip-content
+ has-tooltip=""
+ title="Open download overlay (shortcut: d)"
+ >
<gr-button
aria-disabled="false"
- class="desktop prefsButton"
+ class="download"
link=""
role="button"
tabindex="0"
>
- <gr-icon filled icon="settings"></gr-icon>
+ Download
</gr-button>
</gr-tooltip-content>
</span>
- <span class="separator"> </span>
- </div>
- <span class="desktop downloadContainer">
<gr-tooltip-content
has-tooltip=""
- title="Open download overlay (shortcut: d)"
+ title="Show/hide all inline diffs (shortcut: I)"
>
<gr-button
aria-disabled="false"
- class="download"
+ id="expandBtn"
link=""
role="button"
tabindex="0"
>
- Download
+ Expand All
</gr-button>
</gr-tooltip-content>
- </span>
- <gr-tooltip-content
- has-tooltip=""
- title="Show/hide all inline diffs (shortcut: I)"
- >
- <gr-button
- aria-disabled="false"
- id="expandBtn"
- link=""
- role="button"
- tabindex="0"
+ <gr-tooltip-content
+ has-tooltip=""
+ title="Show/hide all inline diffs (shortcut: I)"
>
- Expand All
- </gr-button>
- </gr-tooltip-content>
- <gr-tooltip-content
- has-tooltip=""
- title="Show/hide all inline diffs (shortcut: I)"
- >
- <gr-button
- aria-disabled="false"
- id="collapseBtn"
- link=""
- role="button"
- tabindex="0"
- >
- Collapse All
- </gr-button>
- </gr-tooltip-content>
+ <gr-button
+ aria-disabled="false"
+ id="collapseBtn"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Collapse All
+ </gr-button>
+ </gr-tooltip-content>
+ </div>
</div>
- </div>
- `);
+ `
+ );
});
test('Diff preferences hidden when no prefs', async () => {
diff --git a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.ts b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.ts
index 735725b..6e5e896 100644
--- a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.ts
+++ b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.ts
@@ -20,7 +20,7 @@
import {assertIsDefined} from '../../../utils/common-util';
import {asyncForeach} from '../../../utils/async-util';
import {FilesExpandedState} from '../gr-file-list-constants';
-import {pluralize} from '../../../utils/string-util';
+import {diffFilePaths, pluralize} from '../../../utils/string-util';
import {GerritNav} from '../../core/gr-navigation/gr-navigation';
import {getPluginEndpoints} from '../../shared/gr-js-api-interface/gr-plugin-endpoints';
import {getPluginLoader} from '../../shared/gr-js-api-interface/gr-plugin-loader';
@@ -494,6 +494,15 @@
display: block;
overflow-x: auto;
}
+ .matchingFilePath {
+ color: var(--deemphasized-text-color);
+ }
+ .newFilePath {
+ color: var(--primary-text-color);
+ }
+ .fileName {
+ color: var(--link-color);
+ }
.truncatedFileName {
display: none;
}
@@ -853,11 +862,7 @@
protected override async getUpdateComplete(): Promise<boolean> {
const result = await super.getUpdateComplete();
- await Promise.all(
- this.diffs.map(async d => {
- await d.updateComplete;
- })
- );
+ await Promise.all(this.diffs.map(d => d.updateComplete));
return result;
}
@@ -993,6 +998,7 @@
showPrependedDynamicColumns: boolean
) {
this.reportRenderedRow(index);
+ const previousFileName = this.shownFiles[index - 1]?.__path;
const patchSetFile = this.computePatchSetFile(file);
return html` <div class="stickyArea">
<div
@@ -1005,7 +1011,8 @@
${when(showPrependedDynamicColumns, () =>
this.renderPrependedContentEndpointsForFile(file)
)}
- ${this.renderFileStatus(file)} ${this.renderFilePath(file)}
+ ${this.renderFileStatus(file)}
+ ${this.renderFilePath(file, previousFileName)}
${this.renderFileComments(file)}
${this.renderSizeBar(file, sizeBarLayout)} ${this.renderFileStats(file)}
${when(showDynamicColumns, () =>
@@ -1134,36 +1141,54 @@
`;
}
- private renderFilePath(file: NormalizedFileInfo) {
- return html` <span class="path" role="gridcell">
- <a class="pathLink" href=${ifDefined(this.computeDiffURL(file.__path))}>
- <span title=${computeDisplayPath(file.__path)} class="fullFileName">
- ${computeDisplayPath(file.__path)}
- </span>
- <span
- title=${computeDisplayPath(file.__path)}
- class="truncatedFileName"
- >
- ${computeTruncatedPath(file.__path)}
- </span>
- <gr-copy-clipboard
- ?hideInput=${true}
- .text=${file.__path}
- ></gr-copy-clipboard>
- </a>
- ${when(
- file.old_path,
- () => html`
- <div class="oldPath" title=${ifDefined(file.old_path)}>
- ${file.old_path}
- <gr-copy-clipboard
- ?hideInput=${true}
- .text=${file.old_path}
- ></gr-copy-clipboard>
- </div>
- `
- )}
- </span>`;
+ private renderFilePath(file: NormalizedFileInfo, previousFilePath?: string) {
+ return html`
+ <span class="path" role="gridcell">
+ <a class="pathLink" href=${ifDefined(this.computeDiffURL(file.__path))}>
+ <span title=${computeDisplayPath(file.__path)} class="fullFileName">
+ ${this.renderStyledPath(file.__path, previousFilePath)}
+ </span>
+ <span
+ title=${computeDisplayPath(file.__path)}
+ class="truncatedFileName"
+ >
+ ${computeTruncatedPath(file.__path)}
+ </span>
+ <gr-copy-clipboard
+ ?hideInput=${true}
+ .text=${file.__path}
+ ></gr-copy-clipboard>
+ </a>
+ ${when(
+ file.old_path,
+ () => html`
+ <div class="oldPath" title=${ifDefined(file.old_path)}>
+ ${file.old_path}
+ <gr-copy-clipboard
+ ?hideInput=${true}
+ .text=${file.old_path}
+ ></gr-copy-clipboard>
+ </div>
+ `
+ )}
+ </span>
+ `;
+ }
+
+ private renderStyledPath(filePath: string, previousFilePath?: string) {
+ const {matchingFolders, newFolders, fileName} = diffFilePaths(
+ filePath,
+ previousFilePath
+ );
+ return [
+ matchingFolders.length > 0
+ ? html`<span class="matchingFilePath">${matchingFolders}</span>`
+ : nothing,
+ newFolders.length > 0
+ ? html`<span class="newFilePath">${newFolders}</span>`
+ : nothing,
+ html`<span class="fileName">${fileName}</span>`,
+ ];
}
private renderFileComments(file: NormalizedFileInfo) {
diff --git a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list_test.ts b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list_test.ts
index 600d4f1..3a56a43 100644
--- a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list_test.ts
+++ b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list_test.ts
@@ -8,13 +8,13 @@
import './gr-file-list';
import {FilesExpandedState} from '../gr-file-list-constants';
import {GerritNav} from '../../core/gr-navigation/gr-navigation';
-import {runA11yAudit} from '../../../test/a11y-test-utils';
import {
mockPromise,
query,
stubRestApi,
waitUntil,
pressKey,
+ stubElement,
} from '../../../test/test-utils';
import {
BasePatchSetNum,
@@ -53,12 +53,11 @@
import {GrDiffHost} from '../../diff/gr-diff-host/gr-diff-host';
import {GrEditFileControls} from '../../edit/gr-edit-file-controls/gr-edit-file-controls';
import {GrIcon} from '../../shared/gr-icon/gr-icon';
-
-const basicFixture = fixtureFromElement('gr-file-list');
+import {fixture, html, assert} from '@open-wc/testing';
suite('gr-diff a11y test', () => {
test('audit', async () => {
- await runA11yAudit(basicFixture);
+ assert.isAccessible(await fixture(html`<gr-file-list></gr-file-list>`));
});
});
@@ -81,13 +80,13 @@
stubRestApi('getDiffRobotComments').returns(Promise.resolve({}));
stubRestApi('getDiffDrafts').returns(Promise.resolve({}));
stubRestApi('getAccountCapabilities').returns(Promise.resolve({}));
- stub('gr-date-formatter', 'loadTimeFormat').callsFake(() =>
+ stubElement('gr-date-formatter', 'loadTimeFormat').callsFake(() =>
Promise.resolve()
);
- stub('gr-diff-host', 'reload').callsFake(() => Promise.resolve());
- stub('gr-diff-host', 'prefetchDiff').callsFake(() => {});
+ stubElement('gr-diff-host', 'reload').callsFake(() => Promise.resolve());
+ stubElement('gr-diff-host', 'prefetchDiff').callsFake(() => {});
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-file-list></gr-file-list>`);
element.diffPrefs = {
context: 10,
@@ -116,144 +115,187 @@
});
test('renders', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `<h3
- class="assistive-tech-only"
- >
- File list
- </h3>
- <div aria-label="Files list" id="container" role="grid">
- <div class="header-row row" role="row">
- <div class="status" role="gridcell"></div>
- <div class="path" role="columnheader">File</div>
- <div class="comments desktop" role="columnheader">Comments</div>
- <div class="comments mobile" role="columnheader" title="Comments">
- C
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `<h3 class="assistive-tech-only">File list</h3>
+ <div aria-label="Files list" id="container" role="grid">
+ <div class="header-row row" role="row">
+ <div class="status" role="gridcell"></div>
+ <div class="path" role="columnheader">File</div>
+ <div class="comments desktop" role="columnheader">Comments</div>
+ <div class="comments mobile" role="columnheader" title="Comments">
+ C
+ </div>
+ <div class="desktop sizeBars" role="columnheader">Size</div>
+ <div class="header-stats" role="columnheader">Delta</div>
+ <div aria-hidden="true" class="hideOnEdit reviewed"></div>
+ <div aria-hidden="true" class="editFileControls showOnEdit"></div>
+ <div aria-hidden="true" class="show-hide"></div>
</div>
- <div class="desktop sizeBars" role="columnheader">Size</div>
- <div class="header-stats" role="columnheader">Delta</div>
- <div aria-hidden="true" class="hideOnEdit reviewed"></div>
- <div aria-hidden="true" class="editFileControls showOnEdit"></div>
- <div aria-hidden="true" class="show-hide"></div>
</div>
- </div>
- <div class="controlRow invisible row">
- <gr-button
- aria-disabled="false"
- class="fileListButton"
- id="incrementButton"
- link=""
- role="button"
- tabindex="0"
- >
- Show -200 more
- </gr-button>
- <gr-tooltip-content title="">
+ <div class="controlRow invisible row">
<gr-button
aria-disabled="false"
class="fileListButton"
- id="showAllButton"
+ id="incrementButton"
link=""
role="button"
tabindex="0"
>
- Show all 0 files
+ Show -200 more
</gr-button>
- </gr-tooltip-content>
- </div>
- <gr-diff-preferences-dialog
- id="diffPreferencesDialog"
- ></gr-diff-preferences-dialog>`);
+ <gr-tooltip-content title="">
+ <gr-button
+ aria-disabled="false"
+ class="fileListButton"
+ id="showAllButton"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Show all 0 files
+ </gr-button>
+ </gr-tooltip-content>
+ </div>
+ <gr-diff-preferences-dialog
+ id="diffPreferencesDialog"
+ ></gr-diff-preferences-dialog>`
+ );
});
test('renders file row', async () => {
element.files = createFiles(1, {lines_inserted: 9});
await element.updateComplete;
const fileRows = queryAll<HTMLDivElement>(element, '.file-row');
- expect(fileRows?.[0]).dom.equal(/* HTML */ `<div
- class="file-row row"
- data-file='{"path":"'/file0"}'
- role="row"
- tabindex="-1"
- >
- <div class="status" role="gridcell">
- <gr-file-status></gr-file-status>
- </div>
- <span class="path" role="gridcell">
- <a class="pathLink">
- <span class="fullFileName" title="'/file0"> '/file0 </span>
- <span class="truncatedFileName" title="'/file0"> …/file0 </span>
- <gr-copy-clipboard hideinput=""> </gr-copy-clipboard>
- </a>
- </span>
- <div role="gridcell">
- <div class="comments desktop">
- <span class="drafts"> </span> <span> </span>
- <span class="noCommentsScreenReaderText"> No comments </span>
+ assert.dom.equal(
+ fileRows?.[0],
+ /* HTML */ `<div
+ class="file-row row"
+ data-file='{"path":"'/file0"}'
+ role="row"
+ tabindex="-1"
+ >
+ <div class="status" role="gridcell">
+ <gr-file-status></gr-file-status>
</div>
- <div class="comments mobile">
- <span class="drafts"> </span> <span> </span>
- <span class="noCommentsScreenReaderText"> No comments </span>
+ <span class="path" role="gridcell">
+ <a class="pathLink">
+ <span class="fullFileName" title="'/file0">
+ <span class="newFilePath"> '/ </span>
+ <span class="fileName"> file0 </span>
+ </span>
+ <span class="truncatedFileName" title="'/file0"> …/file0 </span>
+ <gr-copy-clipboard hideinput=""> </gr-copy-clipboard>
+ </a>
+ </span>
+ <div role="gridcell">
+ <div class="comments desktop">
+ <span class="drafts"> </span> <span> </span>
+ <span class="noCommentsScreenReaderText"> No comments </span>
+ </div>
+ <div class="comments mobile">
+ <span class="drafts"> </span> <span> </span>
+ <span class="noCommentsScreenReaderText"> No comments </span>
+ </div>
</div>
- </div>
- <div class="desktop" role="gridcell">
- <div
- aria-label="A bar that represents the addition and deletion ratio for the current file"
- class="hide sizeBars"
- ></div>
- </div>
- <div class="stats" role="gridcell">
- <div>
- <span aria-label="9 lines added" class="added" tabindex="0">
- +9
- </span>
- <span aria-label="0 lines removed" class="removed" tabindex="0">
- -0
- </span>
- <span hidden=""> +/-0 B </span>
+ <div class="desktop" role="gridcell">
+ <div
+ aria-label="A bar that represents the addition and deletion ratio for the current file"
+ class="hide sizeBars"
+ ></div>
</div>
- </div>
- <div class="hideOnEdit reviewed" role="gridcell">
- <span aria-hidden="true" class="reviewedLabel"> Reviewed </span>
- <span
- aria-checked="false"
- aria-label="Reviewed"
- class="reviewedSwitch"
- role="switch"
- tabindex="0"
- >
+ <div class="stats" role="gridcell">
+ <div>
+ <span aria-label="9 lines added" class="added" tabindex="0">
+ +9
+ </span>
+ <span aria-label="0 lines removed" class="removed" tabindex="0">
+ -0
+ </span>
+ <span hidden=""> +/-0 B </span>
+ </div>
+ </div>
+ <div class="hideOnEdit reviewed" role="gridcell">
+ <span aria-hidden="true" class="reviewedLabel"> Reviewed </span>
<span
- class="markReviewed"
- tabindex="-1"
- title="Mark as reviewed (shortcut: r)"
+ aria-checked="false"
+ aria-label="Reviewed"
+ class="reviewedSwitch"
+ role="switch"
+ tabindex="0"
>
- MARK REVIEWED
+ <span
+ class="markReviewed"
+ tabindex="-1"
+ title="Mark as reviewed (shortcut: r)"
+ >
+ MARK REVIEWED
+ </span>
</span>
+ </div>
+ <div
+ aria-hidden="true"
+ class="editFileControls showOnEdit"
+ role="gridcell"
+ ></div>
+ <div class="show-hide" role="gridcell">
+ <span
+ aria-checked="false"
+ aria-label="Expand file"
+ class="show-hide"
+ data-expand="true"
+ data-path="'/file0"
+ role="switch"
+ tabindex="0"
+ >
+ <gr-icon
+ icon="expand_more"
+ class="show-hide-icon"
+ id="icon"
+ tabindex="-1"
+ ></gr-icon>
+ </span>
+ </div>
+ </div>`
+ );
+ });
+
+ test('renders file paths', async () => {
+ element.files = createFiles(2, {lines_inserted: 9});
+ await element.updateComplete;
+ const fileRows = queryAll<HTMLDivElement>(element, '.file-row');
+
+ assert.dom.equal(
+ fileRows[0].querySelector('.path'),
+ /* HTML */ `
+ <span class="path" role="gridcell">
+ <a class="pathLink">
+ <span class="fullFileName" title="'/file0">
+ <span class="newFilePath"> '/ </span>
+ <span class="fileName"> file0 </span>
+ </span>
+ <span class="truncatedFileName" title="'/file0"> …/file0 </span>
+ <gr-copy-clipboard hideinput=""> </gr-copy-clipboard>
+ </a>
</span>
- </div>
- <div
- aria-hidden="true"
- class="editFileControls showOnEdit"
- role="gridcell"
- ></div>
- <div class="show-hide" role="gridcell">
- <span
- aria-checked="false"
- aria-label="Expand file"
- class="show-hide"
- data-expand="true"
- data-path="'/file0"
- role="switch"
- tabindex="0"
- >
- <gr-icon
- icon="expand_more"
- class="show-hide-icon"
- id="icon"
- tabindex="-1"
- ></gr-icon>
+ `
+ );
+ // The second row will have a matchingFilePath instead of newFilePath.
+ assert.dom.equal(
+ fileRows[1].querySelector('.path'),
+ /* HTML */ `
+ <span class="path" role="gridcell">
+ <a class="pathLink">
+ <span class="fullFileName" title="'/file1">
+ <span class="matchingFilePath"> '/ </span>
+ <span class="fileName"> file1 </span>
+ </span>
+ <span class="truncatedFileName" title="'/file1"> …/file1 </span>
+ <gr-copy-clipboard hideinput=""> </gr-copy-clipboard>
+ </a>
</span>
- </div>
- </div>`);
+ `
+ );
});
test('renders file status column', async () => {
@@ -262,13 +304,16 @@
await element.updateComplete;
const fileRows = queryAll<HTMLDivElement>(element, '.file-row');
const statusCol = queryAndAssert(fileRows?.[0], '.status');
- expect(statusCol).dom.equal(/* HTML */ `
- <div class="extended status" role="gridcell">
- <gr-file-status></gr-file-status>
- <gr-icon class="file-status-arrow" icon="arrow_right_alt"></gr-icon>
- <gr-file-status></gr-file-status>
- </div>
- `);
+ assert.dom.equal(
+ statusCol,
+ /* HTML */ `
+ <div class="extended status" role="gridcell">
+ <gr-file-status></gr-file-status>
+ <gr-icon class="file-status-arrow" icon="arrow_right_alt"></gr-icon>
+ <gr-file-status></gr-file-status>
+ </div>
+ `
+ );
});
test('renders file status column header', async () => {
@@ -278,17 +323,20 @@
await element.updateComplete;
const fileRows = queryAll<HTMLDivElement>(element, '.header-row');
const statusCol = queryAndAssert(fileRows?.[0], '.status');
- expect(statusCol).dom.equal(/* HTML */ `
- <div class="extended status" role="gridcell">
- <gr-tooltip-content has-tooltip="" title="Patchset 1">
- <div class="content">1</div>
- </gr-tooltip-content>
- <gr-icon class="file-status-arrow" icon="arrow_right_alt"></gr-icon>
- <gr-tooltip-content has-tooltip="" title="Patchset 2">
- <div class="content">2</div>
- </gr-tooltip-content>
- </div>
- `);
+ assert.dom.equal(
+ statusCol,
+ /* HTML */ `
+ <div class="extended status" role="gridcell">
+ <gr-tooltip-content has-tooltip="" title="Patchset 1">
+ <div class="content">1</div>
+ </gr-tooltip-content>
+ <gr-icon class="file-status-arrow" icon="arrow_right_alt"></gr-icon>
+ <gr-tooltip-content has-tooltip="" title="Patchset 2">
+ <div class="content">2</div>
+ </gr-tooltip-content>
+ </div>
+ `
+ );
});
test('correct number of files are shown', async () => {
@@ -2001,13 +2049,13 @@
stubRestApi('getDiffComments').returns(Promise.resolve({}));
stubRestApi('getDiffRobotComments').returns(Promise.resolve({}));
stubRestApi('getDiffDrafts').returns(Promise.resolve({}));
- stub('gr-date-formatter', 'loadTimeFormat').callsFake(() =>
+ stubElement('gr-date-formatter', 'loadTimeFormat').callsFake(() =>
Promise.resolve()
);
stubRestApi('getDiff').callsFake(() => Promise.resolve(createDiff()));
- stub('gr-diff-host', 'prefetchDiff').callsFake(() => {});
+ stubElement('gr-diff-host', 'prefetchDiff').callsFake(() => {});
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-file-list></gr-file-list>`);
element.diffPrefs = {
context: 10,
tab_size: 8,
diff --git a/polygerrit-ui/app/elements/change/gr-included-in-dialog/gr-included-in-dialog_test.ts b/polygerrit-ui/app/elements/change/gr-included-in-dialog/gr-included-in-dialog_test.ts
index f9f3d16..23bb9ea 100644
--- a/polygerrit-ui/app/elements/change/gr-included-in-dialog/gr-included-in-dialog_test.ts
+++ b/polygerrit-ui/app/elements/change/gr-included-in-dialog/gr-included-in-dialog_test.ts
@@ -9,38 +9,41 @@
import {BranchName, IncludedInInfo, TagName} from '../../../types/common';
import {IronInputElement} from '@polymer/iron-input';
import {queryAndAssert} from '../../../test/test-utils';
-
-const basicFixture = fixtureFromElement('gr-included-in-dialog');
+import {fixture, html} from '@open-wc/testing';
suite('gr-included-in-dialog', () => {
let element: GrIncludedInDialog;
setup(async () => {
- element = basicFixture.instantiate();
- await element.updateComplete;
+ element = await fixture(
+ html`<gr-included-in-dialog></gr-included-in-dialog>`
+ );
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <header>
- <h1 class="heading-1" id="title">Included In:</h1>
- <span class="closeButtonContainer">
- <gr-button
- aria-disabled="false"
- id="closeButton"
- link=""
- role="button"
- tabindex="0"
- >
- Close
- </gr-button>
- </span>
- <iron-input id="filterInput">
- <input placeholder="Filter" />
- </iron-input>
- </header>
- <div>Loading...</div>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <header>
+ <h1 class="heading-1" id="title">Included In:</h1>
+ <span class="closeButtonContainer">
+ <gr-button
+ aria-disabled="false"
+ id="closeButton"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Close
+ </gr-button>
+ </span>
+ <iron-input id="filterInput">
+ <input placeholder="Filter" />
+ </iron-input>
+ </header>
+ <div>Loading...</div>
+ `
+ );
});
test('computeGroups', () => {
diff --git a/polygerrit-ui/app/elements/change/gr-label-score-row/gr-label-score-row.ts b/polygerrit-ui/app/elements/change/gr-label-score-row/gr-label-score-row.ts
index 38429d3..50c5caf 100644
--- a/polygerrit-ui/app/elements/change/gr-label-score-row/gr-label-score-row.ts
+++ b/polygerrit-ui/app/elements/change/gr-label-score-row/gr-label-score-row.ts
@@ -382,13 +382,23 @@
return this.permittedLabels[this.label.name] || [];
}
- private computeLabelValueTitle(value: string) {
+ // private but used in tests
+ computeLabelValueTitle(value: string) {
if (!this.labels || !this.label) return '';
- const label = this.labels[this.label.name];
- if (label && (label as DetailedLabelInfo).values) {
+ const label = this.labels[this.label.name] as DetailedLabelInfo;
+ if (label && label.values) {
+ // In case the user already voted a certain value and then selects 0
+ // we should show "Reset Vote" instead of "No Value selected"
+ if (
+ Number(value) === 0 &&
+ this.label.value &&
+ Number(this.label.value) !== 0
+ ) {
+ return 'Reset Vote';
+ }
// TODO(TS): maybe add a type guard for DetailedLabelInfo and
// QuickLabelInfo
- return (label as DetailedLabelInfo).values![value];
+ return label.values[value];
} else {
return '';
}
diff --git a/polygerrit-ui/app/elements/change/gr-label-score-row/gr-label-score-row_test.ts b/polygerrit-ui/app/elements/change/gr-label-score-row/gr-label-score-row_test.ts
index 7af2831..8edcaf2 100644
--- a/polygerrit-ui/app/elements/change/gr-label-score-row/gr-label-score-row_test.ts
+++ b/polygerrit-ui/app/elements/change/gr-label-score-row/gr-label-score-row_test.ts
@@ -8,14 +8,13 @@
import {GrLabelScoreRow} from './gr-label-score-row';
import {AccountId} from '../../../api/rest-api';
import {GrButton} from '../../shared/gr-button/gr-button';
-
-const basicFixture = fixtureFromElement('gr-label-score-row');
+import {fixture, html} from '@open-wc/testing';
suite('gr-label-row-score tests', () => {
let element: GrLabelScoreRow;
setup(async () => {
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-label-score-row></gr-label-score-row>`);
element.labels = {
'Code-Review': {
values: {
@@ -107,6 +106,17 @@
checkAriaCheckedValid();
});
+ test('Reset Vote title', () => {
+ // User already voted +1 so we show reset vote
+ assert.equal(element.computeLabelValueTitle('0'), 'Reset Vote');
+ element.label = {
+ name: 'Verified',
+ value: '0',
+ };
+ // User voted 0 and selected 0 hence no score
+ assert.equal(element.computeLabelValueTitle('0'), 'No score');
+ });
+
test('_computeVoteAttribute', () => {
let value = 1;
let index = 0;
@@ -222,7 +232,7 @@
const selectedValueLabel = element.shadowRoot!.querySelector(
'#selectedValueLabel'
);
- assert.strictEqual(selectedValueLabel!.textContent!.trim(), 'No score');
+ assert.strictEqual(selectedValueLabel!.textContent!.trim(), 'Reset Vote');
checkAriaCheckedValid();
});
@@ -300,73 +310,81 @@
});
test('shadowDom test', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <span class="labelNameCell" id="labelName" aria-hidden="true">
- Verified
- </span>
- <div class="buttonsCell">
- <span class="placeholder" data-label="Verified"></span>
- <iron-selector
- aria-labelledby="labelName"
- id="labelSelector"
- role="radiogroup"
- selected="+1"
- >
- <gr-button
- aria-disabled="false"
- aria-label="-1"
- data-name="Verified"
- data-value="-1"
- role="button"
- tabindex="0"
- title="bad"
- data-vote="min"
- votechip=""
- flatten=""
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <span class="labelNameCell" id="labelName" aria-hidden="true">
+ Verified
+ </span>
+ <div class="buttonsCell">
+ <span class="placeholder" data-label="Verified"></span>
+ <iron-selector
+ aria-labelledby="labelName"
+ id="labelSelector"
+ role="radiogroup"
+ selected="+1"
>
- <gr-tooltip-content light-tooltip="" has-tooltip="" title="bad">
- -1
- </gr-tooltip-content>
- </gr-button>
- <gr-button
- aria-disabled="false"
- aria-label=" 0"
- data-name="Verified"
- data-value=" 0"
- role="button"
- tabindex="0"
- data-vote="neutral"
- votechip=""
- flatten=""
- >
- <gr-tooltip-content light-tooltip="" has-tooltip="">
- 0
- </gr-tooltip-content>
- </gr-button>
- <gr-button
- aria-checked="true"
- aria-disabled="false"
- aria-label="+1"
- class="iron-selected"
- data-name="Verified"
- data-value="+1"
- role="button"
- tabindex="0"
- title="good"
- data-vote="max"
- votechip=""
- flatten=""
- >
- <gr-tooltip-content light-tooltip="" has-tooltip="" title="good">
- +1
- </gr-tooltip-content>
- </gr-button>
- </iron-selector>
- <span class="placeholder" data-label="Verified"></span>
- </div>
- <div class="selectedValueCell ">
- <span id="selectedValueLabel">good</span>
- </div>
- `);
+ <gr-button
+ aria-disabled="false"
+ aria-label="-1"
+ data-name="Verified"
+ data-value="-1"
+ role="button"
+ tabindex="0"
+ title="bad"
+ data-vote="min"
+ votechip=""
+ flatten=""
+ >
+ <gr-tooltip-content light-tooltip="" has-tooltip="" title="bad">
+ -1
+ </gr-tooltip-content>
+ </gr-button>
+ <gr-button
+ aria-disabled="false"
+ aria-label=" 0"
+ data-name="Verified"
+ data-value=" 0"
+ role="button"
+ tabindex="0"
+ data-vote="neutral"
+ title="Reset Vote"
+ votechip=""
+ flatten=""
+ >
+ <gr-tooltip-content
+ light-tooltip=""
+ title="Reset Vote"
+ has-tooltip=""
+ >
+ 0
+ </gr-tooltip-content>
+ </gr-button>
+ <gr-button
+ aria-checked="true"
+ aria-disabled="false"
+ aria-label="+1"
+ class="iron-selected"
+ data-name="Verified"
+ data-value="+1"
+ role="button"
+ tabindex="0"
+ title="good"
+ data-vote="max"
+ votechip=""
+ flatten=""
+ >
+ <gr-tooltip-content light-tooltip="" has-tooltip="" title="good">
+ +1
+ </gr-tooltip-content>
+ </gr-button>
+ </iron-selector>
+ <span class="placeholder" data-label="Verified"></span>
+ </div>
+ <div class="selectedValueCell ">
+ <span id="selectedValueLabel">good</span>
+ </div>
+ `
+ );
});
});
diff --git a/polygerrit-ui/app/elements/change/gr-label-scores/gr-label-scores_test.ts b/polygerrit-ui/app/elements/change/gr-label-scores/gr-label-scores_test.ts
index 9306364..21caf8f 100644
--- a/polygerrit-ui/app/elements/change/gr-label-scores/gr-label-scores_test.ts
+++ b/polygerrit-ui/app/elements/change/gr-label-scores/gr-label-scores_test.ts
@@ -15,8 +15,7 @@
} from '../../../test/test-data-generators';
import {ChangeStatus} from '../../../constants/constants';
import {getVoteForAccount} from '../../../utils/label-util';
-
-const basicFixture = fixtureFromElement('gr-label-scores');
+import {fixture, html} from '@open-wc/testing';
suite('gr-label-scores tests', () => {
const accountId = 123 as AccountId;
@@ -24,7 +23,7 @@
setup(async () => {
stubRestApi('getLoggedIn').resolves(false);
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-label-scores></gr-label-scores>`);
element.change = {
...createChange(),
labels: {
@@ -75,19 +74,22 @@
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <h3 class="heading-4">Trigger Votes</h3>
- <div class="scoresTable">
- <gr-label-score-row name="Code-Review"> </gr-label-score-row>
- <gr-label-score-row name="Verified"> </gr-label-score-row>
- </div>
- <div class="mergedMessage" hidden="">
- Because this change has been merged, votes may not be decreased.
- </div>
- <div class="abandonedMessage" hidden="">
- Because this change has been abandoned, you cannot vote.
- </div>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <h3 class="heading-4">Trigger Votes</h3>
+ <div class="scoresTable">
+ <gr-label-score-row name="Code-Review"> </gr-label-score-row>
+ <gr-label-score-row name="Verified"> </gr-label-score-row>
+ </div>
+ <div class="mergedMessage" hidden="">
+ Because this change has been merged, votes may not be decreased.
+ </div>
+ <div class="abandonedMessage" hidden="">
+ Because this change has been abandoned, you cannot vote.
+ </div>
+ `
+ );
});
test('get and set label scores', async () => {
diff --git a/polygerrit-ui/app/elements/change/gr-message-scores/gr-message-scores_test.ts b/polygerrit-ui/app/elements/change/gr-message-scores/gr-message-scores_test.ts
index dd7d55a..33c1719 100644
--- a/polygerrit-ui/app/elements/change/gr-message-scores/gr-message-scores_test.ts
+++ b/polygerrit-ui/app/elements/change/gr-message-scores/gr-message-scores_test.ts
@@ -12,15 +12,13 @@
} from '../../../test/test-data-generators';
import {queryAll, stubFlags} from '../../../test/test-utils';
import {GrMessageScores} from './gr-message-scores';
-
-const basicFixture = fixtureFromElement('gr-message-scores');
+import {fixture, html} from '@open-wc/testing';
suite('gr-message-score tests', () => {
let element: GrMessageScores;
setup(async () => {
- element = basicFixture.instantiate();
- await element.updateComplete;
+ element = await fixture(html`<gr-message-scores></gr-message-scores>`);
});
test('render', async () => {
@@ -37,11 +35,14 @@
};
await element.updateComplete;
- expect(element).shadowDom.to.equal(/* HTML */ `
- <span class="max positive score"> Verified +1 </span>
- <span class="min negative score"> Code-Review -2 </span>
- <span class="positive score"> Trybot-Label3 +1 </span>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <span class="max positive score"> Verified +1 </span>
+ <span class="min negative score"> Code-Review -2 </span>
+ <span class="positive score"> Trybot-Label3 +1 </span>
+ `
+ );
});
test('votes', async () => {
@@ -149,7 +150,7 @@
test('reset vote', async () => {
stubFlags('isEnabled').returns(true);
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-message-scores></gr-message-scores>`);
element.change = {
...createChange(),
labels: {
@@ -172,17 +173,23 @@
element.shadowRoot?.querySelectorAll('gr-trigger-vote');
assert.equal(triggerChips?.length, 1);
const triggerChip = triggerChips?.[0];
- expect(triggerChip).shadowDom.equal(`<div class="container">
+ assert.shadowDom.equal(
+ triggerChip,
+ `<div class="container">
<span class="label">Auto-Submit</span>
<gr-vote-chip></gr-vote-chip>
- </div>`);
+ </div>`
+ );
const voteChips = triggerChip?.shadowRoot?.querySelectorAll('gr-vote-chip');
assert.equal(voteChips?.length, 1);
- expect(voteChips?.[0]).shadowDom.equal('');
+ assert.shadowDom.equal(voteChips?.[0], '');
const scoreChips = element.shadowRoot?.querySelectorAll('.score');
assert.equal(scoreChips?.length, 1);
- expect(scoreChips?.[0]).dom.equal(`<span class="removed score">
- Commit-Queue 0 (vote reset)
- </span>`);
+ assert.dom.equal(
+ scoreChips?.[0],
+ /* HTML */ `
+ <span class="removed score"> Commit-Queue 0 (vote reset) </span>
+ `
+ );
});
});
diff --git a/polygerrit-ui/app/elements/change/gr-message/gr-message.ts b/polygerrit-ui/app/elements/change/gr-message/gr-message.ts
index 685fc4e..5c3b889 100644
--- a/polygerrit-ui/app/elements/change/gr-message/gr-message.ts
+++ b/polygerrit-ui/app/elements/change/gr-message/gr-message.ts
@@ -33,6 +33,7 @@
isFormattedReviewerUpdate,
LabelExtreme,
PATCH_SET_PREFIX_PATTERN,
+ isUnresolved,
} from '../../../utils/comment-util';
import {LABEL_TITLE_SCORE_PATTERN} from '../gr-message-scores/gr-message-scores';
import {getAppContext} from '../../../services/app-context';
@@ -278,14 +279,19 @@
}
.commentsSummary {
margin-right: var(--spacing-s);
- min-width: 115px;
}
.expanded .commentsSummary {
display: none;
}
- .commentsIcon {
+ gr-icon.commentsIcon {
vertical-align: top;
}
+ gr-icon.unresolved.commentsIcon {
+ color: var(--warning-foreground);
+ }
+ .numberOfComments {
+ padding-right: var(--spacing-m);
+ }
gr-account-label::part(gr-account-label-text) {
font-weight: var(--font-weight-bold);
}
@@ -351,14 +357,50 @@
</div>`;
}
+ private renderCommentIcon({
+ commentThreadsCount,
+ unresolved,
+ }: {
+ commentThreadsCount: number;
+ unresolved: boolean;
+ }) {
+ if (commentThreadsCount === 0) {
+ return nothing;
+ }
+ return html` <span
+ class="numberOfComments"
+ title=${pluralize(
+ commentThreadsCount,
+ (unresolved ? 'unresolved' : 'resolved') + ' comment'
+ )}
+ >
+ <gr-icon
+ icon=${unresolved ? 'feedback' : 'mark_chat_read'}
+ filled
+ class="${unresolved ? 'unresolved ' : ''}commentsIcon"
+ ></gr-icon>
+ ${commentThreadsCount}</span
+ >`;
+ }
+
private renderCommentsSummary() {
if (!this.commentThreads?.length) return nothing;
- const commentCountText = pluralize(this.commentThreads.length, 'comment');
+ const unresolvedThreadsCount =
+ this.commentThreads.filter(isUnresolved).length;
+ const resolvedThreadsCount =
+ this.commentThreads.length - unresolvedThreadsCount;
+
return html`
<div class="commentsSummary">
- <gr-icon icon="mode_comment" filled class="commentsIcon"></gr-icon>
- <span class="numberOfComments">${commentCountText}</span>
+ ${this.renderCommentIcon({
+ commentThreadsCount: unresolvedThreadsCount,
+ unresolved: true,
+ })}
+ ${this.renderCommentIcon({
+ commentThreadsCount: resolvedThreadsCount,
+ unresolved: false,
+ })}
</div>
`;
}
diff --git a/polygerrit-ui/app/elements/change/gr-message/gr-message_test.ts b/polygerrit-ui/app/elements/change/gr-message/gr-message_test.ts
index cd44925..66fd332 100644
--- a/polygerrit-ui/app/elements/change/gr-message/gr-message_test.ts
+++ b/polygerrit-ui/app/elements/change/gr-message/gr-message_test.ts
@@ -13,6 +13,7 @@
createComment,
createRevisions,
createLabelInfo,
+ createCommentThread,
} from '../../../test/test-data-generators';
import {
mockPromise,
@@ -42,7 +43,7 @@
import {CommentSide} from '../../../constants/constants';
import {SinonStubbedMember} from 'sinon';
import {html} from 'lit';
-import {fixture} from '@open-wc/testing-helpers';
+import {fixture} from '@open-wc/testing';
suite('gr-message tests', () => {
let element: GrMessage;
@@ -142,35 +143,38 @@
await element.updateComplete;
assert.isTrue(element.computeIsAutomated());
- expect(element).shadowDom.to.equal(/* HTML */ `<div class="collapsed">
- <div class="contentContainer">
- <div class="author">
- <gr-account-label class="authorLabel"> </gr-account-label>
- <gr-message-scores> </gr-message-scores>
- </div>
- <div class="content messageContent">
- <div class="hideOnOpen message">
- This is a message with id cm_id_1
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `<div class="collapsed">
+ <div class="contentContainer">
+ <div class="author">
+ <gr-account-label class="authorLabel"> </gr-account-label>
+ <gr-message-scores> </gr-message-scores>
</div>
- </div>
- <span class="dateContainer">
- <span class="date">
- <gr-date-formatter showdateandtime="" withtooltip="">
- </gr-date-formatter>
+ <div class="content messageContent">
+ <div class="hideOnOpen message">
+ This is a message with id cm_id_1
+ </div>
+ </div>
+ <span class="dateContainer">
+ <span class="date">
+ <gr-date-formatter showdateandtime="" withtooltip="">
+ </gr-date-formatter>
+ </span>
+ <gr-icon
+ icon="expand_more"
+ id="expandToggle"
+ title="Toggle expanded state"
+ ></gr-icon>
</span>
- <gr-icon
- icon="expand_more"
- id="expandToggle"
- title="Toggle expanded state"
- ></gr-icon>
- </span>
- </div>
- </div>`);
+ </div>
+ </div>`
+ );
element.hideAutomated = true;
await element.updateComplete;
- expect(element).shadowDom.to.equal(/* HTML */ '');
+ assert.shadowDom.equal(element, /* HTML */ '');
});
test('reviewer message treated as autogenerated', async () => {
@@ -183,35 +187,38 @@
await element.updateComplete;
assert.isTrue(element.computeIsAutomated());
- expect(element).shadowDom.to.equal(/* HTML */ `<div class="collapsed">
- <div class="contentContainer">
- <div class="author">
- <gr-account-label class="authorLabel"> </gr-account-label>
- <gr-message-scores> </gr-message-scores>
- </div>
- <div class="content messageContent">
- <div class="hideOnOpen message">
- This is a message with id cm_id_1
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `<div class="collapsed">
+ <div class="contentContainer">
+ <div class="author">
+ <gr-account-label class="authorLabel"> </gr-account-label>
+ <gr-message-scores> </gr-message-scores>
</div>
- </div>
- <span class="dateContainer">
- <span class="date">
- <gr-date-formatter showdateandtime="" withtooltip="">
- </gr-date-formatter>
+ <div class="content messageContent">
+ <div class="hideOnOpen message">
+ This is a message with id cm_id_1
+ </div>
+ </div>
+ <span class="dateContainer">
+ <span class="date">
+ <gr-date-formatter showdateandtime="" withtooltip="">
+ </gr-date-formatter>
+ </span>
+ <gr-icon
+ icon="expand_more"
+ id="expandToggle"
+ title="Toggle expanded state"
+ ></gr-icon>
</span>
- <gr-icon
- icon="expand_more"
- id="expandToggle"
- title="Toggle expanded state"
- ></gr-icon>
- </span>
- </div>
- </div>`);
+ </div>
+ </div>`
+ );
element.hideAutomated = true;
await element.updateComplete;
- expect(element).shadowDom.to.equal(/* HTML */ '');
+ assert.shadowDom.equal(element, /* HTML */ '');
});
test('batch reviewer message treated as autogenerated', async () => {
@@ -225,36 +232,39 @@
await element.updateComplete;
assert.isTrue(element.computeIsAutomated());
- expect(element).shadowDom.to.equal(/* HTML */ `<div class="collapsed">
- <div class="contentContainer">
- <div class="author">
- <gr-account-label class="authorLabel"> </gr-account-label>
- <gr-message-scores> </gr-message-scores>
- </div>
- <div class="content messageContent">
- <div class="hideOnOpen message">
- This is a message with id cm_id_1
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `<div class="collapsed">
+ <div class="contentContainer">
+ <div class="author">
+ <gr-account-label class="authorLabel"> </gr-account-label>
+ <gr-message-scores> </gr-message-scores>
</div>
- </div>
- <div class="content"></div>
- <span class="dateContainer">
- <span class="date">
- <gr-date-formatter showdateandtime="" withtooltip="">
- </gr-date-formatter>
+ <div class="content messageContent">
+ <div class="hideOnOpen message">
+ This is a message with id cm_id_1
+ </div>
+ </div>
+ <div class="content"></div>
+ <span class="dateContainer">
+ <span class="date">
+ <gr-date-formatter showdateandtime="" withtooltip="">
+ </gr-date-formatter>
+ </span>
+ <gr-icon
+ icon="expand_more"
+ id="expandToggle"
+ title="Toggle expanded state"
+ ></gr-icon>
</span>
- <gr-icon
- icon="expand_more"
- id="expandToggle"
- title="Toggle expanded state"
- ></gr-icon>
- </span>
- </div>
- </div>`);
+ </div>
+ </div>`
+ );
element.hideAutomated = true;
await element.updateComplete;
- expect(element).shadowDom.to.equal(/* HTML */ '');
+ assert.shadowDom.equal(element, /* HTML */ '');
});
test('tag that is not autogenerated prefix does not hide', async () => {
@@ -290,13 +300,69 @@
</span>
</div>
</div>`;
- expect(element).shadowDom.to.equal(rendered);
+ assert.shadowDom.equal(element, rendered);
element.hideAutomated = true;
await element.updateComplete;
console.error(element.computeIsAutomated());
- expect(element).shadowDom.to.equal(rendered);
+ assert.shadowDom.equal(element, rendered);
+ });
+
+ test('renders comment message', async () => {
+ element.commentThreads = [
+ createCommentThread([
+ createComment({message: 'hello 1', unresolved: true}),
+ ]),
+ createCommentThread([createComment({message: 'hello 2'})]),
+ ];
+ element.message = {
+ ...createChangeMessage(),
+ commentThreads: element.commentThreads,
+ };
+ await element.updateComplete;
+
+ const rendered = /* HTML */ `<div class="collapsed">
+ <div class="contentContainer">
+ <div class="author">
+ <gr-account-label class="authorLabel"> </gr-account-label>
+ <gr-message-scores> </gr-message-scores>
+ </div>
+ <div class="commentsSummary">
+ <span class="numberOfComments" title="1 unresolved comment">
+ <gr-icon
+ class="commentsIcon unresolved"
+ filled=""
+ icon="feedback"
+ >
+ </gr-icon>
+ 1
+ </span>
+ <span class="numberOfComments" title="1 resolved comment">
+ <gr-icon class="commentsIcon" filled="" icon="mark_chat_read">
+ </gr-icon>
+ 1
+ </span>
+ </div>
+ <div class="content messageContent">
+ <div class="hideOnOpen message">
+ This is a message with id cm_id_1
+ </div>
+ </div>
+ <span class="dateContainer">
+ <span class="date">
+ <gr-date-formatter showdateandtime="" withtooltip="">
+ </gr-date-formatter>
+ </span>
+ <gr-icon
+ icon="expand_more"
+ id="expandToggle"
+ title="Toggle expanded state"
+ ></gr-icon>
+ </span>
+ </div>
+ </div>`;
+ assert.shadowDom.equal(element, rendered);
});
test('reply button hidden unless logged in', () => {
diff --git a/polygerrit-ui/app/elements/change/gr-messages-list/gr-messages-list_test.ts b/polygerrit-ui/app/elements/change/gr-messages-list/gr-messages-list_test.ts
index ff9770a..c6f2830 100644
--- a/polygerrit-ui/app/elements/change/gr-messages-list/gr-messages-list_test.ts
+++ b/polygerrit-ui/app/elements/change/gr-messages-list/gr-messages-list_test.ts
@@ -30,7 +30,7 @@
import * as MockInteractions from '@polymer/iron-test-helpers/mock-interactions';
import {assertIsDefined} from '../../../utils/common-util';
import {html} from 'lit';
-import {fixture} from '@open-wc/testing-helpers';
+import {fixture} from '@open-wc/testing';
const author = {
_account_id: 42 as AccountId,
@@ -141,24 +141,27 @@
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div class="header">
- <div class="container" id="showAllActivityToggleContainer"></div>
- <gr-button
- aria-disabled="false"
- id="collapse-messages"
- link=""
- role="button"
- tabindex="0"
- title="Expand all messages (shortcut: x)"
- >
- Expand All
- </gr-button>
- </div>
- <gr-message data-message-id="${messages[0].id}"> </gr-message>
- <gr-message data-message-id="${messages[1].id}"> </gr-message>
- <gr-message data-message-id="${messages[2].id}"> </gr-message>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div class="header">
+ <div class="container" id="showAllActivityToggleContainer"></div>
+ <gr-button
+ aria-disabled="false"
+ id="collapse-messages"
+ link=""
+ role="button"
+ tabindex="0"
+ title="Expand all messages (shortcut: x)"
+ >
+ Expand All
+ </gr-button>
+ </div>
+ <gr-message data-message-id="${messages[0].id}"> </gr-message>
+ <gr-message data-message-id="${messages[1].id}"> </gr-message>
+ <gr-message data-message-id="${messages[2].id}"> </gr-message>
+ `
+ );
});
test('expand/collapse all', async () => {
diff --git a/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-change.ts b/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-change.ts
index 69fd142..0d14d02 100644
--- a/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-change.ts
+++ b/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-change.ts
@@ -14,6 +14,7 @@
import {ChangeStatus} from '../../../constants/constants';
import {isChangeInfo} from '../../../utils/change-util';
import {ifDefined} from 'lit/directives/if-defined.js';
+import {classMap} from 'lit/directives/class-map.js';
@customElement('gr-related-change')
export class GrRelatedChange extends LitElement {
@@ -99,60 +100,48 @@
override render() {
const change = this.change;
if (!change) throw new Error('Missing change');
- const linkClass = this._computeLinkClass(change);
+ const linkClass = {
+ strikethrough: change.status === ChangeStatus.ABANDONED,
+ submittable: !!change.submittable,
+ };
+ let statusClass = {};
+ if (!isChangeInfo(change)) {
+ statusClass = {
+ status: true,
+ notCurrent: change._revision_number !== change._current_revision_number,
+ indirectAncestor: !!this.isIndirectAncestor(change),
+ submittable: !!change.submittable,
+ hidden: change.status === ChangeStatus.NEW,
+ };
+ }
return html`
<div class="changeContainer">
<a
href=${ifDefined(this.href)}
aria-label=${ifDefined(this.label)}
- class=${linkClass}
+ class=${classMap(linkClass)}
><slot></slot
></a>
${this.showSubmittableCheck
? html`<span
tabindex="-1"
title="Submittable"
- class="submittableCheck ${linkClass}"
+ class="submittableCheck ${classMap(linkClass)}"
role="img"
aria-label="Submittable"
>✓</span
>`
: ''}
${this.showChangeStatus && !isChangeInfo(change)
- ? html`<span class=${this._computeChangeStatusClass(change)}>
- (${this._computeChangeStatus(change)})
+ ? html`<span class=${classMap(statusClass)}>
+ (${this.computeChangeStatus(change)})
</span>`
: ''}
</div>
`;
}
- _computeLinkClass(change: ChangeInfo | RelatedChangeAndCommitInfo) {
- const statuses = [];
- if (change.status === ChangeStatus.ABANDONED) {
- statuses.push('strikethrough');
- }
- if (change.submittable) {
- statuses.push('submittable');
- }
- return statuses.join(' ');
- }
-
- _computeChangeStatusClass(change: RelatedChangeAndCommitInfo) {
- const classes = ['status'];
- if (change._revision_number !== change._current_revision_number) {
- classes.push('notCurrent');
- } else if (this._isIndirectAncestor(change)) {
- classes.push('indirectAncestor');
- } else if (change.submittable) {
- classes.push('submittable');
- } else if (change.status === ChangeStatus.NEW) {
- classes.push('hidden');
- }
- return classes.join(' ');
- }
-
- _computeChangeStatus(change: RelatedChangeAndCommitInfo) {
+ private computeChangeStatus(change: RelatedChangeAndCommitInfo) {
switch (change.status) {
case ChangeStatus.MERGED:
return 'Merged';
@@ -161,7 +150,7 @@
}
if (change._revision_number !== change._current_revision_number) {
return 'Not current';
- } else if (this._isIndirectAncestor(change)) {
+ } else if (this.isIndirectAncestor(change)) {
return 'Indirect ancestor';
} else if (change.submittable) {
return 'Submittable';
@@ -169,7 +158,7 @@
return '';
}
- _isIndirectAncestor(change: RelatedChangeAndCommitInfo) {
+ private isIndirectAncestor(change: RelatedChangeAndCommitInfo) {
return (
this.connectedRevisions &&
!this.connectedRevisions.includes(change.commit.commit)
diff --git a/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list.ts b/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list.ts
index 7a2dd00..d572a36 100644
--- a/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list.ts
+++ b/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list.ts
@@ -108,6 +108,10 @@
height: 1px;
min-width: 20px;
}
+ .repo,
+ .branch {
+ color: var(--primary-text-color);
+ }
gr-related-collapse[collapsed] .marker.arrow {
visibility: visible;
min-width: auto;
@@ -212,8 +216,8 @@
? GerritNav.getUrlForChangeById(
change._change_number,
change.project,
- change._revision_number as RevisionPatchSetNum,
- 'related-change'
+ 'related-change',
+ change._revision_number as RevisionPatchSetNum
)
: ''}
show-change-status
@@ -264,16 +268,7 @@
>
${this.renderMarkers(
submittedTogetherMarkersPredicate(index)
- )}<gr-related-change
- .label=${this.renderChangeTitle(change)}
- .change=${change}
- .href=${GerritNav.getUrlForChangeById(
- change._number,
- change.project
- )}
- show-submittable-check
- >${this.renderChangeLine(change)}</gr-related-change
- >
+ )}${this.renderSubmittedTogetherLine(change, true)}
</div>`
)}
</gr-related-collapse>
@@ -283,6 +278,28 @@
</section>`;
}
+ private renderSubmittedTogetherLine(
+ change: ChangeInfo,
+ showSubmittabilityCheck: boolean
+ ) {
+ const truncatedRepo = truncatePath(change.project, 2);
+ return html`
+ <span class="repo" .title=${change.project}>${truncatedRepo}</span
+ ><span class="branch"> | ${change.branch} </span>
+ <gr-related-change
+ .label=${this.renderChangeTitle(change)}
+ .change=${change}
+ .href=${GerritNav.getUrlForChangeById(
+ change._number,
+ change.project,
+ 'submitted-together'
+ )}
+ ?show-submittable-check=${showSubmittabilityCheck}
+ >${change.subject}</gr-related-change
+ >
+ `;
+ }
+
private renderSameTopic(
isFirst: boolean,
sectionSize: (section: Section) => number
@@ -314,15 +331,7 @@
>
${this.renderMarkers(
sameTopicMarkersPredicate(index)
- )}<gr-related-change
- .change=${change}
- .label=${this.renderChangeTitle(change)}
- .href=${GerritNav.getUrlForChangeById(
- change._number,
- change.project
- )}
- >${this.renderChangeLine(change)}</gr-related-change
- >
+ )}${this.renderSubmittedTogetherLine(change, false)}
</div>`
)}
</gr-related-collapse>
@@ -363,7 +372,8 @@
.change=${change}
.href=${GerritNav.getUrlForChangeById(
change._number,
- change.project
+ change.project,
+ 'merge-conflict'
)}
>${change.subject}</gr-related-change
>
@@ -407,7 +417,8 @@
.change=${change}
.href=${GerritNav.getUrlForChangeById(
change._number,
- change.project
+ change.project,
+ 'cherry-pick'
)}
>${change.branch}: ${change.subject}</gr-related-change
>
@@ -421,13 +432,6 @@
return `${change.project}: ${change.branch}: ${change.subject}`;
}
- private renderChangeLine(change: ChangeInfo) {
- const truncatedRepo = truncatePath(change.project, 2);
- return html`<span class="truncatedRepo" .title=${change.project}
- >${truncatedRepo}</span
- >: ${change.branch}: ${change.subject}`;
- }
-
sectionSizeFactory(
relatedChangesLen: number,
submittedTogetherLen: number,
diff --git a/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list_test.ts b/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list_test.ts
index 5b8259f..7d25d06 100644
--- a/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list_test.ts
+++ b/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list_test.ts
@@ -3,6 +3,7 @@
* Copyright 2021 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
+import {fixture, html} from '@open-wc/testing';
import {SinonStubbedMember} from 'sinon';
import {PluginApi} from '../../../api/plugin';
import {ChangeStatus} from '../../../constants/constants';
@@ -44,13 +45,13 @@
} from './gr-related-changes-list';
import {GrRelatedCollapse} from './gr-related-collapse';
-const basicFixture = fixtureFromElement('gr-related-changes-list');
-
suite('gr-related-changes-list', () => {
let element: GrRelatedChangesList;
- setup(() => {
- element = basicFixture.instantiate();
+ setup(async () => {
+ element = await fixture(
+ html`<gr-related-changes-list></gr-related-changes-list>`
+ );
});
suite('show when collapsed', () => {
@@ -196,28 +197,66 @@
stubRestApi('getRelatedChanges').returns(
Promise.resolve(relatedChangeInfo)
);
+ stubRestApi('getChangesSubmittedTogether').returns(
+ Promise.resolve(submittedTogether)
+ );
+ stubRestApi('getChangeCherryPicks').returns(
+ Promise.resolve([createChange()])
+ );
await element.reload();
- expect(element).shadowDom.to.equal(/* HTML */ `
- <gr-endpoint-decorator name="related-changes-section">
- <gr-endpoint-param name="change"> </gr-endpoint-param>
- <gr-endpoint-slot name="top"> </gr-endpoint-slot>
- <section id="relatedChanges">
- <gr-related-collapse class="first" title="Relation chain">
- <div class="relatedChangeLine show-when-collapsed">
- <span class="marker space"> </span>
- <gr-related-change
- show-change-status=""
- show-submittable-check=""
- >
- Test commit subject
- </gr-related-change>
- </div>
- </gr-related-collapse>
- </section>
- <gr-endpoint-slot name="bottom"> </gr-endpoint-slot>
- </gr-endpoint-decorator>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <gr-endpoint-decorator name="related-changes-section">
+ <gr-endpoint-param name="change"> </gr-endpoint-param>
+ <gr-endpoint-slot name="top"> </gr-endpoint-slot>
+ <section id="relatedChanges">
+ <gr-related-collapse class="first" title="Relation chain">
+ <div class="relatedChangeLine show-when-collapsed">
+ <span class="marker space"> </span>
+ <gr-related-change
+ show-change-status=""
+ show-submittable-check=""
+ >
+ Test commit subject
+ </gr-related-change>
+ </div>
+ </gr-related-collapse>
+ </section>
+ <section id="submittedTogether">
+ <gr-related-collapse title="Submitted together">
+ <div class="relatedChangeLine show-when-collapsed">
+ <span
+ aria-label="Arrow marking current change"
+ class="arrowToCurrentChange marker"
+ role="img"
+ >
+ âž”
+ </span>
+ <span class="repo" title="test-project">test-project</span>
+ <span class="branch"> | test-branch </span>
+ <gr-related-change show-submittable-check="">
+ Test subject
+ </gr-related-change>
+ </div>
+ </gr-related-collapse>
+ <div class="note" hidden="">(+ )</div>
+ </section>
+ <section id="cherryPicks">
+ <gr-related-collapse title="Cherry picks">
+ <div class="relatedChangeLine show-when-collapsed">
+ <span class="marker space"> </span>
+ <gr-related-change>
+ test-branch: Test subject
+ </gr-related-change>
+ </div>
+ </gr-related-collapse>
+ </section>
+ <gr-endpoint-slot name="bottom"> </gr-endpoint-slot>
+ </gr-endpoint-decorator>
+ `
+ );
});
test('first list', async () => {
@@ -261,6 +300,7 @@
Promise.resolve([createChange()])
);
await element.reload();
+
const relatedChanges = queryAndAssert<GrRelatedCollapse>(
queryAndAssert<HTMLElement>(element, '#relatedChanges'),
'gr-related-collapse'
@@ -326,8 +366,10 @@
let element: GrRelatedChangesList;
let conflictsStub: SinonStubbedMember<RestApiService['getChangeConflicts']>;
- setup(() => {
- element = basicFixture.instantiate();
+ setup(async () => {
+ element = await fixture(
+ html`<gr-related-changes-list></gr-related-changes-list>`
+ );
conflictsStub = stubRestApi('getChangeConflicts').returns(
Promise.resolve(undefined)
);
@@ -601,9 +643,11 @@
suite('gr-related-changes-list plugin tests', () => {
let element: GrRelatedChangesList;
- setup(() => {
+ setup(async () => {
resetPlugins();
- element = basicFixture.instantiate();
+ element = await fixture(
+ html`<gr-related-changes-list></gr-related-changes-list>`
+ );
});
teardown(() => {
diff --git a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog-it_test.ts b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog-it_test.ts
index cdad41b..b2cfdda 100644
--- a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog-it_test.ts
+++ b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog-it_test.ts
@@ -12,7 +12,7 @@
} from '../../../test/test-utils';
import {getPluginLoader} from '../../shared/gr-js-api-interface/gr-plugin-loader';
import {GrReplyDialog} from './gr-reply-dialog';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import {
AccountId,
NumericChangeId,
@@ -23,8 +23,6 @@
import {createChange} from '../../../test/test-data-generators';
import {GrTextarea} from '../../shared/gr-textarea/gr-textarea';
-const basicFixture = fixtureFromElement('gr-reply-dialog');
-
suite('gr-reply-dialog-it tests', () => {
let element: GrReplyDialog;
let changeNum: NumericChangeId;
@@ -116,7 +114,7 @@
undefined,
'http://test.com/plugins/lgtm.js'
);
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-reply-dialog></gr-reply-dialog>`);
setupElement(element);
getPluginLoader().loadPlugins([]);
await getPluginLoader().awaitPluginsLoaded();
diff --git a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog_test.ts b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog_test.ts
index 8674f5f..f34693b 100644
--- a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog_test.ts
+++ b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog_test.ts
@@ -53,6 +53,7 @@
RevisionPatchSetNum,
Suggestion,
UrlEncodedCommentId,
+ UserId,
} from '../../../types/common';
import {CommentThread} from '../../../utils/comment-util';
import {GrAccountList} from '../../shared/gr-account-list/gr-account-list';
@@ -60,7 +61,7 @@
import {GrLabelScores} from '../gr-label-scores/gr-label-scores';
import {GrThreadList} from '../gr-thread-list/gr-thread-list';
import {GrAutocomplete} from '../../shared/gr-autocomplete/gr-autocomplete';
-import {fixture, html, waitUntil} from '@open-wc/testing-helpers';
+import {fixture, html, waitUntil} from '@open-wc/testing';
import {accountKey} from '../../../utils/account-util';
import {GrButton} from '../../shared/gr-button/gr-button';
import {GrAccountLabel} from '../../shared/gr-account-label/gr-account-label';
@@ -189,152 +190,155 @@
}
test('renders', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div tabindex="-1">
- <section class="peopleContainer">
- <gr-endpoint-decorator name="reply-reviewers">
- <gr-endpoint-param name="change"> </gr-endpoint-param>
- <gr-endpoint-param name="reviewers"> </gr-endpoint-param>
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div tabindex="-1">
+ <section class="peopleContainer">
+ <gr-endpoint-decorator name="reply-reviewers">
+ <gr-endpoint-param name="change"> </gr-endpoint-param>
+ <gr-endpoint-param name="reviewers"> </gr-endpoint-param>
+ <div class="peopleList">
+ <div class="peopleListLabel">Reviewers</div>
+ <gr-account-list id="reviewers"> </gr-account-list>
+ <gr-endpoint-slot name="right"> </gr-endpoint-slot>
+ </div>
+ <gr-endpoint-slot name="below"> </gr-endpoint-slot>
+ </gr-endpoint-decorator>
<div class="peopleList">
- <div class="peopleListLabel">Reviewers</div>
- <gr-account-list id="reviewers"> </gr-account-list>
- <gr-endpoint-slot name="right"> </gr-endpoint-slot>
+ <div class="peopleListLabel">CC</div>
+ <gr-account-list allow-any-input="" id="ccs"> </gr-account-list>
</div>
- <gr-endpoint-slot name="below"> </gr-endpoint-slot>
- </gr-endpoint-decorator>
- <div class="peopleList">
- <div class="peopleListLabel">CC</div>
- <gr-account-list allow-any-input="" id="ccs"> </gr-account-list>
- </div>
- <gr-overlay
- aria-hidden="true"
- id="reviewerConfirmationOverlay"
- style="outline: none; display: none;"
- >
- <div class="reviewerConfirmation">
- Group
- <span class="groupName"> </span>
- has
- <span class="groupSize"> </span>
- members.
- <br />
- Are you sure you want to add them all?
- </div>
- <div class="reviewerConfirmationButtons">
- <gr-button aria-disabled="false" role="button" tabindex="0">
- Yes
- </gr-button>
- <gr-button aria-disabled="false" role="button" tabindex="0">
- No
- </gr-button>
- </div>
- </gr-overlay>
- </section>
- <section class="labelsContainer">
- <gr-endpoint-decorator name="reply-label-scores">
- <gr-label-scores id="labelScores"> </gr-label-scores>
- <gr-endpoint-param name="change"> </gr-endpoint-param>
- </gr-endpoint-decorator>
- <div id="pluginMessage"></div>
- </section>
- <section class="newReplyDialog textareaContainer">
- <div class="patchsetLevelContainer resolved">
- <gr-endpoint-decorator name="reply-text">
- <gr-textarea
- class="message monospace newReplyDialog"
- id="textarea"
- monospace=""
- >
- </gr-textarea>
+ <gr-overlay
+ aria-hidden="true"
+ id="reviewerConfirmationOverlay"
+ style="outline: none; display: none;"
+ >
+ <div class="reviewerConfirmation">
+ Group
+ <span class="groupName"> </span>
+ has
+ <span class="groupSize"> </span>
+ members.
+ <br />
+ Are you sure you want to add them all?
+ </div>
+ <div class="reviewerConfirmationButtons">
+ <gr-button aria-disabled="false" role="button" tabindex="0">
+ Yes
+ </gr-button>
+ <gr-button aria-disabled="false" role="button" tabindex="0">
+ No
+ </gr-button>
+ </div>
+ </gr-overlay>
+ </section>
+ <section class="labelsContainer">
+ <gr-endpoint-decorator name="reply-label-scores">
+ <gr-label-scores id="labelScores"> </gr-label-scores>
<gr-endpoint-param name="change"> </gr-endpoint-param>
</gr-endpoint-decorator>
- <div class="labelContainer">
- <label>
- <input
- checked=""
- id="resolvedPatchsetLevelCommentCheckbox"
- type="checkbox"
- />
- Resolved
- </label>
- <label class="preview-formatting">
- <input type="checkbox" />
- Preview formatting
- </label>
- </div>
- </div>
- </section>
- <div class="newReplyDialog stickyBottom">
- <gr-endpoint-decorator name="reply-bottom">
- <gr-endpoint-param name="change"> </gr-endpoint-param>
- <section class="attention">
- <div class="attentionSummary">
- <div>
- <span> No changes to the attention set. </span>
- <gr-tooltip-content
- has-tooltip=""
- title="Edit attention set changes"
- >
- <gr-button
- aria-disabled="false"
- class="edit-attention-button"
- data-action-key="edit"
- data-action-type="change"
- data-label="Edit"
- link=""
- position-below=""
- role="button"
- tabindex="0"
- >
- <div>
- <gr-icon icon="edit" filled small></gr-icon>
- <span>Modify</span>
- </div>
- </gr-button>
- </gr-tooltip-content>
- </div>
- <div>
- <a
- href="https://gerrit-review.googlesource.com/Documentation/user-attention-set.html"
- target="_blank"
- >
- <gr-icon icon="help" title="read documentation"></gr-icon>
- </a>
- </div>
- </div>
- </section>
- <gr-endpoint-slot name="above-actions"> </gr-endpoint-slot>
- <section class="actions">
- <div class="left"></div>
- <div class="right">
- <gr-button
- aria-disabled="false"
- class="action cancel"
- id="cancelButton"
- link=""
- role="button"
- tabindex="0"
+ <div id="pluginMessage"></div>
+ </section>
+ <section class="newReplyDialog textareaContainer">
+ <div class="patchsetLevelContainer resolved">
+ <gr-endpoint-decorator name="reply-text">
+ <gr-textarea
+ class="message monospace newReplyDialog"
+ id="textarea"
+ monospace=""
>
- Cancel
- </gr-button>
- <gr-tooltip-content has-tooltip="" title="Send reply">
+ </gr-textarea>
+ <gr-endpoint-param name="change"> </gr-endpoint-param>
+ </gr-endpoint-decorator>
+ <div class="labelContainer">
+ <label>
+ <input
+ checked=""
+ id="resolvedPatchsetLevelCommentCheckbox"
+ type="checkbox"
+ />
+ Resolved
+ </label>
+ <label class="preview-formatting">
+ <input type="checkbox" />
+ Preview formatting
+ </label>
+ </div>
+ </div>
+ </section>
+ <div class="newReplyDialog stickyBottom">
+ <gr-endpoint-decorator name="reply-bottom">
+ <gr-endpoint-param name="change"> </gr-endpoint-param>
+ <section class="attention">
+ <div class="attentionSummary">
+ <div>
+ <span> No changes to the attention set. </span>
+ <gr-tooltip-content
+ has-tooltip=""
+ title="Edit attention set changes"
+ >
+ <gr-button
+ aria-disabled="false"
+ class="edit-attention-button"
+ data-action-key="edit"
+ data-action-type="change"
+ data-label="Edit"
+ link=""
+ position-below=""
+ role="button"
+ tabindex="0"
+ >
+ <div>
+ <gr-icon icon="edit" filled small></gr-icon>
+ <span>Modify</span>
+ </div>
+ </gr-button>
+ </gr-tooltip-content>
+ </div>
+ <div>
+ <a
+ href="https://gerrit-review.googlesource.com/Documentation/user-attention-set.html"
+ target="_blank"
+ >
+ <gr-icon icon="help" title="read documentation"></gr-icon>
+ </a>
+ </div>
+ </div>
+ </section>
+ <gr-endpoint-slot name="above-actions"> </gr-endpoint-slot>
+ <section class="actions">
+ <div class="left"></div>
+ <div class="right">
<gr-button
aria-disabled="false"
- class="action send"
- id="sendButton"
- primary=""
+ class="action cancel"
+ id="cancelButton"
+ link=""
role="button"
tabindex="0"
>
- Send
+ Cancel
</gr-button>
- </gr-tooltip-content>
- </div>
- </section>
- </gr-endpoint-decorator>
+ <gr-tooltip-content has-tooltip="" title="Send reply">
+ <gr-button
+ aria-disabled="false"
+ class="action send"
+ id="sendButton"
+ primary=""
+ role="button"
+ tabindex="0"
+ >
+ Send
+ </gr-button>
+ </gr-tooltip-content>
+ </div>
+ </section>
+ </gr-endpoint-decorator>
+ </div>
</div>
- </div>
- `);
+ `
+ );
});
test('default to publishing draft comments with reply', async () => {
@@ -1975,22 +1979,14 @@
await element.updateComplete;
assert.equal(mutations.length, 5);
- expect(mutations[0]).to.deep.equal(
- mapReviewer(cc1, ReviewerState.REVIEWER)
- );
- expect(mutations[1]).to.deep.equal(
- mapReviewer(cc2, ReviewerState.REVIEWER)
- );
- expect(mutations[2]).to.deep.equal(
- mapReviewer(reviewer1, ReviewerState.CC)
- );
- expect(mutations[3]).to.deep.equal(
- mapReviewer(reviewer2, ReviewerState.CC)
- );
+ assert.deepEqual(mutations[0], mapReviewer(cc1, ReviewerState.REVIEWER));
+ assert.deepEqual(mutations[1], mapReviewer(cc2, ReviewerState.REVIEWER));
+ assert.deepEqual(mutations[2], mapReviewer(reviewer1, ReviewerState.CC));
+ assert.deepEqual(mutations[3], mapReviewer(reviewer2, ReviewerState.CC));
// Only 1 account was initially part of the change
- expect(mutations[4]).to.deep.equal({
- reviewer: 33,
+ assert.deepEqual(mutations[4], {
+ reviewer: 33 as UserId,
state: ReviewerState.REMOVED,
});
});
@@ -2033,9 +2029,9 @@
);
await element.send(false, false);
- expect(mutations).to.have.lengthOf(1);
+ assert.lengthOf(mutations, 1);
// Only 1 account was initially part of the change
- expect(mutations[0]).to.deep.equal({
+ assert.deepEqual(mutations[0], {
reviewer: reviewer1._account_id,
state: ReviewerState.CC,
});
@@ -2062,7 +2058,7 @@
});
await element.send(false, false);
- expect(mutations).to.have.lengthOf(0);
+ assert.lengthOf(mutations, 0);
});
test('emits cancel on esc key', async () => {
diff --git a/polygerrit-ui/app/elements/change/gr-reviewer-list/gr-reviewer-list_test.ts b/polygerrit-ui/app/elements/change/gr-reviewer-list/gr-reviewer-list_test.ts
index 9f8aada..4eea066 100644
--- a/polygerrit-ui/app/elements/change/gr-reviewer-list/gr-reviewer-list_test.ts
+++ b/polygerrit-ui/app/elements/change/gr-reviewer-list/gr-reviewer-list_test.ts
@@ -14,49 +14,50 @@
import {GrButton} from '../../shared/gr-button/gr-button';
import {AccountId, EmailAddress} from '../../../types/common';
import './gr-reviewer-list';
-
-const basicFixture = fixtureFromElement('gr-reviewer-list');
+import {fixture, html} from '@open-wc/testing';
suite('gr-reviewer-list tests', () => {
let element: GrReviewerList;
setup(async () => {
- element = basicFixture.instantiate();
- await element.updateComplete;
+ element = await fixture(html`<gr-reviewer-list></gr-reviewer-list>`);
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div class="container">
- <div>
- <div class="controlsContainer" hidden="">
- <gr-button
- aria-disabled="false"
- class="addReviewer"
- id="addReviewer"
- link=""
- role="button"
- tabindex="0"
- title="Add reviewer"
- >
- <div>
- <gr-icon icon="edit" filled small></gr-icon>
- </div>
- </gr-button>
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div class="container">
+ <div>
+ <div class="controlsContainer" hidden="">
+ <gr-button
+ aria-disabled="false"
+ class="addReviewer"
+ id="addReviewer"
+ link=""
+ role="button"
+ tabindex="0"
+ title="Add reviewer"
+ >
+ <div>
+ <gr-icon icon="edit" filled small></gr-icon>
+ </div>
+ </gr-button>
+ </div>
</div>
+ <gr-button
+ aria-disabled="false"
+ class="hiddenReviewers"
+ hidden=""
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ and 0 more
+ </gr-button>
</div>
- <gr-button
- aria-disabled="false"
- class="hiddenReviewers"
- hidden=""
- link=""
- role="button"
- tabindex="0"
- >
- and 0 more
- </gr-button>
- </div>
- `);
+ `
+ );
});
test('controls hidden on immutable element', async () => {
diff --git a/polygerrit-ui/app/elements/change/gr-submit-requirement-dashboard-hovercard/gr-submit-requirement-dashboard-hovercard_test.ts b/polygerrit-ui/app/elements/change/gr-submit-requirement-dashboard-hovercard/gr-submit-requirement-dashboard-hovercard_test.ts
index ca78640..f301059 100644
--- a/polygerrit-ui/app/elements/change/gr-submit-requirement-dashboard-hovercard/gr-submit-requirement-dashboard-hovercard_test.ts
+++ b/polygerrit-ui/app/elements/change/gr-submit-requirement-dashboard-hovercard/gr-submit-requirement-dashboard-hovercard_test.ts
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
import '../../../test/common-test-setup-karma';
-import {fixture} from '@open-wc/testing-helpers';
+import {fixture} from '@open-wc/testing';
import {html} from 'lit';
import './gr-submit-requirement-dashboard-hovercard';
import {GrSubmitRequirementDashboardHovercard} from './gr-submit-requirement-dashboard-hovercard';
@@ -22,15 +22,18 @@
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div id="container" role="tooltip" tabindex="-1">
- <gr-submit-requirements
- disable-endpoints=""
- disable-hovercards=""
- suppress-title=""
- >
- </gr-submit-requirements>
- </div>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div id="container" role="tooltip" tabindex="-1">
+ <gr-submit-requirements
+ disable-endpoints=""
+ disable-hovercards=""
+ suppress-title=""
+ >
+ </gr-submit-requirements>
+ </div>
+ `
+ );
});
});
diff --git a/polygerrit-ui/app/elements/change/gr-submit-requirement-hovercard/gr-submit-requirement-hovercard_test.ts b/polygerrit-ui/app/elements/change/gr-submit-requirement-hovercard/gr-submit-requirement-hovercard_test.ts
index 1a44caa..5812966 100644
--- a/polygerrit-ui/app/elements/change/gr-submit-requirement-hovercard/gr-submit-requirement-hovercard_test.ts
+++ b/polygerrit-ui/app/elements/change/gr-submit-requirement-hovercard/gr-submit-requirement-hovercard_test.ts
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
import '../../../test/common-test-setup-karma';
-import {fixture} from '@open-wc/testing-helpers';
+import {fixture} from '@open-wc/testing';
import {html} from 'lit';
import './gr-submit-requirement-hovercard';
import {GrSubmitRequirementHovercard} from './gr-submit-requirement-hovercard';
@@ -36,109 +36,115 @@
});
test('renders', async () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div id="container" role="tooltip" tabindex="-1">
- <div class="section">
- <div class="sectionIcon">
- <gr-icon
- aria-label="satisfied"
- role="img"
- class="check_circle"
- filled
- icon="check_circle"
- >
- </gr-icon>
- </div>
- <div class="sectionContent">
- <h3 class="heading-3 name">
- <span> Verified </span>
- </h3>
- </div>
- </div>
- <div class="section">
- <div class="sectionIcon">
- <gr-icon class="small" icon="info"></gr-icon>
- </div>
- <div class="sectionContent">
- <div class="row">
- <div class="title">Status</div>
- <div>SATISFIED</div>
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div id="container" role="tooltip" tabindex="-1">
+ <div class="section">
+ <div class="sectionIcon">
+ <gr-icon
+ aria-label="satisfied"
+ role="img"
+ class="check_circle"
+ filled
+ icon="check_circle"
+ >
+ </gr-icon>
+ </div>
+ <div class="sectionContent">
+ <h3 class="heading-3 name">
+ <span> Verified </span>
+ </h3>
</div>
</div>
+ <div class="section">
+ <div class="sectionIcon">
+ <gr-icon class="small" icon="info"></gr-icon>
+ </div>
+ <div class="sectionContent">
+ <div class="row">
+ <div class="title">Status</div>
+ <div>SATISFIED</div>
+ </div>
+ </div>
+ </div>
+ <div class="button">
+ <gr-button
+ aria-disabled="false"
+ id="toggleConditionsButton"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ View conditions
+ <gr-icon icon="expand_more"></gr-icon>
+ </gr-button>
+ </div>
</div>
- <div class="button">
- <gr-button
- aria-disabled="false"
- id="toggleConditionsButton"
- link=""
- role="button"
- tabindex="0"
- >
- View conditions
- <gr-icon icon="expand_more"></gr-icon>
- </gr-button>
- </div>
- </div>
- `);
+ `
+ );
});
test('renders conditions after click', async () => {
const button = queryAndAssert<GrButton>(element, '#toggleConditionsButton');
button.click();
await element.updateComplete;
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div id="container" role="tooltip" tabindex="-1">
- <div class="section">
- <div class="sectionIcon">
- <gr-icon
- aria-label="satisfied"
- role="img"
- class="check_circle"
- filled
- icon="check_circle"
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div id="container" role="tooltip" tabindex="-1">
+ <div class="section">
+ <div class="sectionIcon">
+ <gr-icon
+ aria-label="satisfied"
+ role="img"
+ class="check_circle"
+ filled
+ icon="check_circle"
+ >
+ </gr-icon>
+ </div>
+ <div class="sectionContent">
+ <h3 class="heading-3 name">
+ <span> Verified </span>
+ </h3>
+ </div>
+ </div>
+ <div class="section">
+ <div class="sectionIcon">
+ <gr-icon class="small" icon="info"></gr-icon>
+ </div>
+ <div class="sectionContent">
+ <div class="row">
+ <div class="title">Status</div>
+ <div>SATISFIED</div>
+ </div>
+ </div>
+ </div>
+ <div class="button">
+ <gr-button
+ aria-disabled="false"
+ id="toggleConditionsButton"
+ link=""
+ role="button"
+ tabindex="0"
>
- </gr-icon>
+ Hide conditions
+ <gr-icon icon="expand_less"></gr-icon>
+ </gr-button>
</div>
- <div class="sectionContent">
- <h3 class="heading-3 name">
- <span> Verified </span>
- </h3>
- </div>
- </div>
- <div class="section">
- <div class="sectionIcon">
- <gr-icon class="small" icon="info"></gr-icon>
- </div>
- <div class="sectionContent">
- <div class="row">
- <div class="title">Status</div>
- <div>SATISFIED</div>
+ <div class="section condition">
+ <div class="sectionContent">
+ Submit condition:
+ <br />
+ <span class="expression">
+ label:Verified=MAX -label:Verified=MIN
+ </span>
</div>
</div>
</div>
- <div class="button">
- <gr-button
- aria-disabled="false"
- id="toggleConditionsButton"
- link=""
- role="button"
- tabindex="0"
- >
- Hide conditions
- <gr-icon icon="expand_less"></gr-icon>
- </gr-button>
- </div>
- <div class="section condition">
- <div class="sectionContent">
- Submit condition:
- <br />
- <span class="expression">
- label:Verified=MAX -label:Verified=MIN
- </span>
- </div>
- </div>
- </div>
- `);
+ `
+ );
});
test('renders label', async () => {
@@ -168,65 +174,68 @@
.account=${createAccountWithId()}
></gr-submit-requirement-hovercard>`
);
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div id="container" role="tooltip" tabindex="-1">
- <div class="section">
- <div class="sectionIcon">
- <gr-icon
- aria-label="satisfied"
- role="img"
- class="check_circle"
- filled
- icon="check_circle"
- ></gr-icon>
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div id="container" role="tooltip" tabindex="-1">
+ <div class="section">
+ <div class="sectionIcon">
+ <gr-icon
+ aria-label="satisfied"
+ role="img"
+ class="check_circle"
+ filled
+ icon="check_circle"
+ ></gr-icon>
+ </div>
+ <div class="sectionContent">
+ <h3 class="heading-3 name">
+ <span> Verified </span>
+ </h3>
+ </div>
</div>
- <div class="sectionContent">
- <h3 class="heading-3 name">
- <span> Verified </span>
- </h3>
+ <div class="section">
+ <div class="sectionIcon">
+ <gr-icon class="small" icon="info"></gr-icon>
+ </div>
+ <div class="sectionContent">
+ <div class="row">
+ <div class="title">Status</div>
+ <div>SATISFIED</div>
+ </div>
+ </div>
</div>
- </div>
- <div class="section">
- <div class="sectionIcon">
- <gr-icon class="small" icon="info"></gr-icon>
- </div>
- <div class="sectionContent">
+ <div class="section">
+ <div class="sectionIcon"></div>
<div class="row">
- <div class="title">Status</div>
- <div>SATISFIED</div>
+ <div>
+ <gr-label-info> </gr-label-info>
+ </div>
</div>
</div>
- </div>
- <div class="section">
- <div class="sectionIcon"></div>
- <div class="row">
- <div>
- <gr-label-info> </gr-label-info>
+ <div class="section description">
+ <div class="sectionIcon">
+ <gr-icon icon="description"></gr-icon>
+ </div>
+ <div class="sectionContent">
+ <gr-formatted-text notrailingmargin=""></gr-formatted-text>
</div>
</div>
- </div>
- <div class="section description">
- <div class="sectionIcon">
- <gr-icon icon="description"></gr-icon>
- </div>
- <div class="sectionContent">
- <gr-formatted-text notrailingmargin=""></gr-formatted-text>
+ <div class="button">
+ <gr-button
+ aria-disabled="false"
+ id="toggleConditionsButton"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ View conditions
+ <gr-icon icon="expand_more"></gr-icon>
+ </gr-button>
</div>
</div>
- <div class="button">
- <gr-button
- aria-disabled="false"
- id="toggleConditionsButton"
- link=""
- role="button"
- tabindex="0"
- >
- View conditions
- <gr-icon icon="expand_more"></gr-icon>
- </gr-button>
- </div>
- </div>
- `);
+ `
+ );
});
suite('quick approve label', () => {
@@ -264,13 +273,16 @@
></gr-submit-requirement-hovercard>`
);
const quickApprove = queryAndAssert(element, '.quickApprove');
- expect(quickApprove).dom.to.equal(/* HTML */ `
- <div class="button quickApprove">
- <gr-button aria-disabled="false" link="" role="button" tabindex="0">
- Vote Verified +2
- </gr-button>
- </div>
- `);
+ assert.dom.equal(
+ quickApprove,
+ /* HTML */ `
+ <div class="button quickApprove">
+ <gr-button aria-disabled="false" link="" role="button" tabindex="0">
+ Vote Verified +2
+ </gr-button>
+ </div>
+ `
+ );
});
test("doesn't render when already voted max vote", async () => {
@@ -342,13 +354,16 @@
></gr-submit-requirement-hovercard>`
);
const quickApprove = queryAndAssert(element, '.quickApprove');
- expect(quickApprove).dom.to.equal(/* HTML */ `
- <div class="button quickApprove">
- <gr-button aria-disabled="false" link="" role="button" tabindex="0"
- >Override (Build-Cop)
- </gr-button>
- </div>
- `);
+ assert.dom.equal(
+ quickApprove,
+ /* HTML */ `
+ <div class="button quickApprove">
+ <gr-button aria-disabled="false" link="" role="button" tabindex="0"
+ >Override (Build-Cop)
+ </gr-button>
+ </div>
+ `
+ );
});
});
});
diff --git a/polygerrit-ui/app/elements/change/gr-submit-requirements/gr-submit-requirements.ts b/polygerrit-ui/app/elements/change/gr-submit-requirements/gr-submit-requirements.ts
index b4e7493..640b9d0 100644
--- a/polygerrit-ui/app/elements/change/gr-submit-requirements/gr-submit-requirements.ts
+++ b/polygerrit-ui/app/elements/change/gr-submit-requirements/gr-submit-requirements.ts
@@ -37,8 +37,8 @@
import {CheckRun} from '../../../models/checks/checks-model';
import {getResultsOf, hasResultsOf} from '../../../models/checks/checks-util';
import {Category, RunStatus} from '../../../api/checks';
-import {fireShowPrimaryTab} from '../../../utils/event-util';
-import {PrimaryTab} from '../../../constants/constants';
+import {fireShowTab} from '../../../utils/event-util';
+import {Tab} from '../../../constants/constants';
import {submitRequirementsStyles} from '../../../styles/gr-submit-requirements-styles';
import {resolve} from '../../../models/dependency';
import {checksModelToken} from '../../../models/checks/checks-model';
@@ -387,7 +387,7 @@
.links=${links}
.statusOrCategory=${category}
@click=${() => {
- fireShowPrimaryTab(this, PrimaryTab.CHECKS, false, {
+ fireShowTab(this, Tab.CHECKS, false, {
checksTab: {
statusOrCategory: category,
},
diff --git a/polygerrit-ui/app/elements/change/gr-submit-requirements/gr-submit-requirements_test.ts b/polygerrit-ui/app/elements/change/gr-submit-requirements/gr-submit-requirements_test.ts
index f380159..9b4062a 100644
--- a/polygerrit-ui/app/elements/change/gr-submit-requirements/gr-submit-requirements_test.ts
+++ b/polygerrit-ui/app/elements/change/gr-submit-requirements/gr-submit-requirements_test.ts
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
import '../../../test/common-test-setup-karma';
-import {fixture} from '@open-wc/testing-helpers';
+import {fixture} from '@open-wc/testing';
import {html} from 'lit';
import './gr-submit-requirements';
import {GrSubmitRequirements} from './gr-submit-requirements';
@@ -63,49 +63,55 @@
});
test('renders', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <h3 class="heading-3 metadata-title" id="submit-requirements-caption">
- Submit Requirements
- </h3>
- <table aria-labelledby="submit-requirements-caption" class="requirements">
- <thead hidden="">
- <tr>
- <th>Status</th>
- <th>Name</th>
- <th>Votes</th>
- </tr>
- </thead>
- <tbody>
- <tr id="requirement-0-Verified" role="button" tabindex="0">
- <td>
- <gr-icon
- aria-label="satisfied"
- role="img"
- class="check_circle"
- filled
- icon="check_circle"
- >
- </gr-icon>
- </td>
- <td class="name">
- <gr-limited-text class="name"></gr-limited-text>
- </td>
- <td>
- <gr-endpoint-decorator
- class="votes-cell"
- name="submit-requirement-verified"
- >
- <gr-endpoint-param name="change"></gr-endpoint-param>
- <gr-endpoint-param name="requirement"></gr-endpoint-param>
- <gr-vote-chip></gr-vote-chip>
- </gr-endpoint-decorator>
- </td>
- </tr>
- </tbody>
- </table>
- <gr-submit-requirement-hovercard for="requirement-0-Verified">
- </gr-submit-requirement-hovercard>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <h3 class="heading-3 metadata-title" id="submit-requirements-caption">
+ Submit Requirements
+ </h3>
+ <table
+ aria-labelledby="submit-requirements-caption"
+ class="requirements"
+ >
+ <thead hidden="">
+ <tr>
+ <th>Status</th>
+ <th>Name</th>
+ <th>Votes</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr id="requirement-0-Verified" role="button" tabindex="0">
+ <td>
+ <gr-icon
+ aria-label="satisfied"
+ role="img"
+ class="check_circle"
+ filled
+ icon="check_circle"
+ >
+ </gr-icon>
+ </td>
+ <td class="name">
+ <gr-limited-text class="name"></gr-limited-text>
+ </td>
+ <td>
+ <gr-endpoint-decorator
+ class="votes-cell"
+ name="submit-requirement-verified"
+ >
+ <gr-endpoint-param name="change"></gr-endpoint-param>
+ <gr-endpoint-param name="requirement"></gr-endpoint-param>
+ <gr-vote-chip></gr-vote-chip>
+ </gr-endpoint-decorator>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ <gr-submit-requirement-hovercard for="requirement-0-Verified">
+ </gr-submit-requirement-hovercard>
+ `
+ );
});
suite('votes-cell', () => {
@@ -115,11 +121,14 @@
});
test('with vote', () => {
const votesCell = element.shadowRoot?.querySelectorAll('.votes-cell');
- expect(votesCell?.[0]).dom.equal(/* HTML */ `
- <div class="votes-cell">
- <gr-vote-chip> </gr-vote-chip>
- </div>
- `);
+ assert.dom.equal(
+ votesCell?.[0],
+ /* HTML */ `
+ <div class="votes-cell">
+ <gr-vote-chip> </gr-vote-chip>
+ </div>
+ `
+ );
});
test('no votes', async () => {
@@ -132,9 +141,10 @@
element.change = modifiedChange;
await element.updateComplete;
const votesCell = element.shadowRoot?.querySelectorAll('.votes-cell');
- expect(votesCell?.[0]).dom.equal(/* HTML */ `
- <div class="votes-cell">No votes</div>
- `);
+ assert.dom.equal(
+ votesCell?.[0],
+ /* HTML */ ' <div class="votes-cell">No votes</div> '
+ );
});
test('without label to vote on', async () => {
@@ -144,9 +154,10 @@
element.change = modifiedChange;
await element.updateComplete;
const votesCell = element.shadowRoot?.querySelectorAll('.votes-cell');
- expect(votesCell?.[0]).dom.equal(/* HTML */ `
- <div class="votes-cell">Satisfied</div>
- `);
+ assert.dom.equal(
+ votesCell?.[0],
+ /* HTML */ ' <div class="votes-cell">Satisfied</div> '
+ );
});
test('checks', async () => {
@@ -159,12 +170,15 @@
];
await element.updateComplete;
const votesCell = element.shadowRoot?.querySelectorAll('.votes-cell');
- expect(votesCell?.[0]).dom.equal(/* HTML */ `
- <div class="votes-cell">
- <gr-vote-chip></gr-vote-chip>
- <gr-checks-chip></gr-checks-chip>
- </div>
- `);
+ assert.dom.equal(
+ votesCell?.[0],
+ /* HTML */ `
+ <div class="votes-cell">
+ <gr-vote-chip></gr-vote-chip>
+ <gr-checks-chip></gr-checks-chip>
+ </div>
+ `
+ );
});
test('running checks', async () => {
@@ -178,12 +192,15 @@
];
await element.updateComplete;
const votesCell = element.shadowRoot?.querySelectorAll('.votes-cell');
- expect(votesCell?.[0]).dom.equal(/* HTML */ `
- <div class="votes-cell">
- <gr-vote-chip></gr-vote-chip>
- <gr-checks-chip></gr-checks-chip>
- </div>
- `);
+ assert.dom.equal(
+ votesCell?.[0],
+ /* HTML */ `
+ <div class="votes-cell">
+ <gr-vote-chip></gr-vote-chip>
+ <gr-checks-chip></gr-checks-chip>
+ </div>
+ `
+ );
});
test('with override label', async () => {
@@ -211,10 +228,13 @@
element.change = modifiedChange;
await element.updateComplete;
const votesCell = element.shadowRoot?.querySelectorAll('.votes-cell');
- expect(votesCell?.[0]).dom.equal(/* HTML */ `<div class="votes-cell">
- <gr-vote-chip> </gr-vote-chip>
- <span class="overrideLabel"> Override </span>
- </div>`);
+ assert.dom.equal(
+ votesCell?.[0],
+ /* HTML */ `<div class="votes-cell">
+ <gr-vote-chip> </gr-vote-chip>
+ <span class="overrideLabel"> Override </span>
+ </div>`
+ );
});
test('with override with 2 labels', async () => {
@@ -251,13 +271,16 @@
element.change = modifiedChange;
await element.updateComplete;
const votesCell = element.shadowRoot?.querySelectorAll('.votes-cell');
- expect(votesCell?.[0]).dom.equal(/* HTML */ `<div class="votes-cell">
- <gr-vote-chip> </gr-vote-chip>
- <span class="overrideLabel"> Override </span>
- <span class="separator"></span>
- <gr-vote-chip> </gr-vote-chip>
- <span class="overrideLabel"> Override2 </span>
- </div>`);
+ assert.dom.equal(
+ votesCell?.[0],
+ /* HTML */ `<div class="votes-cell">
+ <gr-vote-chip> </gr-vote-chip>
+ <span class="overrideLabel"> Override </span>
+ <span class="separator"></span>
+ <gr-vote-chip> </gr-vote-chip>
+ <span class="overrideLabel"> Override2 </span>
+ </div>`
+ );
});
});
diff --git a/polygerrit-ui/app/elements/change/gr-thread-list/gr-thread-list_test.ts b/polygerrit-ui/app/elements/change/gr-thread-list/gr-thread-list_test.ts
index 29ed322..e6d7455 100644
--- a/polygerrit-ui/app/elements/change/gr-thread-list/gr-thread-list_test.ts
+++ b/polygerrit-ui/app/elements/change/gr-thread-list/gr-thread-list_test.ts
@@ -38,14 +38,13 @@
import {query, queryAndAssert} from '../../../utils/common-util';
import {GrAccountLabel} from '../../shared/gr-account-label/gr-account-label';
import {GrDropdownList} from '../../shared/gr-dropdown-list/gr-dropdown-list';
-
-const basicFixture = fixtureFromElement('gr-thread-list');
+import {fixture, html} from '@open-wc/testing';
suite('gr-thread-list tests', () => {
let element: GrThreadList;
setup(async () => {
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-thread-list></gr-thread-list>`);
element.changeNum = 123 as NumericChangeId;
element.change = createParsedChange();
element.account = createAccountDetailWithId();
@@ -306,83 +305,89 @@
test('renders', async () => {
await element.updateComplete;
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div class="header">
- <span class="sort-text">Sort By:</span>
- <gr-dropdown-list id="sortDropdown"></gr-dropdown-list>
- <span class="separator"></span>
- <span class="filter-text">Filter By:</span>
- <gr-dropdown-list id="filterDropdown"></gr-dropdown-list>
- <span class="author-text">From:</span>
- <gr-account-label
- deselected=""
- selectionchipstyle=""
- nostatusicons=""
- ></gr-account-label>
- <gr-account-label
- deselected=""
- selectionchipstyle=""
- nostatusicons=""
- ></gr-account-label>
- <gr-account-label
- deselected=""
- selectionchipstyle=""
- nostatusicons=""
- ></gr-account-label>
- <gr-account-label
- deselected=""
- selectionchipstyle=""
- nostatusicons=""
- ></gr-account-label>
- <gr-account-label
- deselected=""
- selectionchipstyle=""
- nostatusicons=""
- ></gr-account-label>
- </div>
- <div id="threads" part="threads">
- <gr-comment-thread
- show-file-name=""
- show-file-path=""
- ></gr-comment-thread>
- <gr-comment-thread show-file-path=""></gr-comment-thread>
- <div class="thread-separator"></div>
- <gr-comment-thread
- show-file-name=""
- show-file-path=""
- ></gr-comment-thread>
- <gr-comment-thread show-file-path=""></gr-comment-thread>
- <div class="thread-separator"></div>
- <gr-comment-thread
- has-draft=""
- show-file-name=""
- show-file-path=""
- ></gr-comment-thread>
- <gr-comment-thread show-file-path=""></gr-comment-thread>
- <gr-comment-thread show-file-path=""></gr-comment-thread>
- <div class="thread-separator"></div>
- <gr-comment-thread
- show-file-name=""
- show-file-path=""
- ></gr-comment-thread>
- <div class="thread-separator"></div>
- <gr-comment-thread
- has-draft=""
- show-file-name=""
- show-file-path=""
- ></gr-comment-thread>
- </div>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div class="header">
+ <span class="sort-text">Sort By:</span>
+ <gr-dropdown-list id="sortDropdown"></gr-dropdown-list>
+ <span class="separator"></span>
+ <span class="filter-text">Filter By:</span>
+ <gr-dropdown-list id="filterDropdown"></gr-dropdown-list>
+ <span class="author-text">From:</span>
+ <gr-account-label
+ deselected=""
+ selectionchipstyle=""
+ nostatusicons=""
+ ></gr-account-label>
+ <gr-account-label
+ deselected=""
+ selectionchipstyle=""
+ nostatusicons=""
+ ></gr-account-label>
+ <gr-account-label
+ deselected=""
+ selectionchipstyle=""
+ nostatusicons=""
+ ></gr-account-label>
+ <gr-account-label
+ deselected=""
+ selectionchipstyle=""
+ nostatusicons=""
+ ></gr-account-label>
+ <gr-account-label
+ deselected=""
+ selectionchipstyle=""
+ nostatusicons=""
+ ></gr-account-label>
+ </div>
+ <div id="threads" part="threads">
+ <gr-comment-thread
+ show-file-name=""
+ show-file-path=""
+ ></gr-comment-thread>
+ <gr-comment-thread show-file-path=""></gr-comment-thread>
+ <div class="thread-separator"></div>
+ <gr-comment-thread
+ show-file-name=""
+ show-file-path=""
+ ></gr-comment-thread>
+ <gr-comment-thread show-file-path=""></gr-comment-thread>
+ <div class="thread-separator"></div>
+ <gr-comment-thread
+ has-draft=""
+ show-file-name=""
+ show-file-path=""
+ ></gr-comment-thread>
+ <gr-comment-thread show-file-path=""></gr-comment-thread>
+ <gr-comment-thread show-file-path=""></gr-comment-thread>
+ <div class="thread-separator"></div>
+ <gr-comment-thread
+ show-file-name=""
+ show-file-path=""
+ ></gr-comment-thread>
+ <div class="thread-separator"></div>
+ <gr-comment-thread
+ has-draft=""
+ show-file-name=""
+ show-file-path=""
+ ></gr-comment-thread>
+ </div>
+ `
+ );
});
test('renders empty', async () => {
element.threads = [];
await element.updateComplete;
- expect(queryAndAssert(element, 'div#threads')).dom.to.equal(/* HTML */ `
- <div id="threads" part="threads">
- <div><span>No comments</span></div>
- </div>
- `);
+ assert.dom.equal(
+ queryAndAssert(element, 'div#threads'),
+ /* HTML */ `
+ <div id="threads" part="threads">
+ <div><span>No comments</span></div>
+ </div>
+ `
+ );
});
test('tapping single author chips', async () => {
diff --git a/polygerrit-ui/app/elements/change/gr-trigger-vote-hovercard/gr-trigger-vote-hovercard_test.ts b/polygerrit-ui/app/elements/change/gr-trigger-vote-hovercard/gr-trigger-vote-hovercard_test.ts
index 8a67ea3..89a93b3 100644
--- a/polygerrit-ui/app/elements/change/gr-trigger-vote-hovercard/gr-trigger-vote-hovercard_test.ts
+++ b/polygerrit-ui/app/elements/change/gr-trigger-vote-hovercard/gr-trigger-vote-hovercard_test.ts
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
import '../../../test/common-test-setup-karma';
-import {fixture} from '@open-wc/testing-helpers';
+import {fixture} from '@open-wc/testing';
import {html} from 'lit';
import './gr-trigger-vote-hovercard';
import {GrTriggerVoteHovercard} from './gr-trigger-vote-hovercard';
@@ -22,29 +22,32 @@
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div id="container" role="tooltip" tabindex="-1">
- <div class="section">
- <div class="sectionContent">
- <h3 class="heading-3 name">
- <span> Foo </span>
- </h3>
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div id="container" role="tooltip" tabindex="-1">
+ <div class="section">
+ <div class="sectionContent">
+ <h3 class="heading-3 name">
+ <span> Foo </span>
+ </h3>
+ </div>
</div>
- </div>
- <div class="section">
- <div class="sectionIcon">
- <gr-icon icon="info" class=" small"></gr-icon>
- </div>
- <div class="sectionContent">
- <div class="row">
- <div class="title">Status</div>
- <div>
- <slot name="label-info"> </slot>
+ <div class="section">
+ <div class="sectionIcon">
+ <gr-icon icon="info" class=" small"></gr-icon>
+ </div>
+ <div class="sectionContent">
+ <div class="row">
+ <div class="title">Status</div>
+ <div>
+ <slot name="label-info"> </slot>
+ </div>
</div>
</div>
</div>
</div>
- </div>
- `);
+ `
+ );
});
});
diff --git a/polygerrit-ui/app/elements/change/gr-trigger-vote/gr-trigger-vote_test.ts b/polygerrit-ui/app/elements/change/gr-trigger-vote/gr-trigger-vote_test.ts
index c9862b4..277d16b 100644
--- a/polygerrit-ui/app/elements/change/gr-trigger-vote/gr-trigger-vote_test.ts
+++ b/polygerrit-ui/app/elements/change/gr-trigger-vote/gr-trigger-vote_test.ts
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
import '../../../test/common-test-setup-karma';
-import {fixture} from '@open-wc/testing-helpers';
+import {fixture} from '@open-wc/testing';
import {html} from 'lit';
import './gr-trigger-vote';
import {GrTriggerVote} from './gr-trigger-vote';
@@ -61,12 +61,15 @@
});
test('renders', () => {
- expect(element).shadowDom.to.equal(/* HTML */ ` <div class="container">
- <gr-trigger-vote-hovercard>
- <gr-label-info slot="label-info"></gr-label-info>
- </gr-trigger-vote-hovercard>
- <span class="label"> Verified </span>
- <gr-vote-chip> </gr-vote-chip>
- </div>`);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ ` <div class="container">
+ <gr-trigger-vote-hovercard>
+ <gr-label-info slot="label-info"></gr-label-info>
+ </gr-trigger-vote-hovercard>
+ <span class="label"> Verified </span>
+ <gr-vote-chip> </gr-vote-chip>
+ </div>`
+ );
});
});
diff --git a/polygerrit-ui/app/elements/checks/gr-checks-results.ts b/polygerrit-ui/app/elements/checks/gr-checks-results.ts
index 7686813..9956919 100644
--- a/polygerrit-ui/app/elements/checks/gr-checks-results.ts
+++ b/polygerrit-ui/app/elements/checks/gr-checks-results.ts
@@ -504,8 +504,8 @@
?filled=${icon.filled}
aria-label="external link to details"
class="link"
- ></gr-icon>
- <paper-tooltip offset="5">${tooltipText}</paper-tooltip></a
+ ></gr-icon
+ ><paper-tooltip offset="5">${tooltipText}</paper-tooltip></a
>`;
}
diff --git a/polygerrit-ui/app/elements/checks/gr-checks-results_test.ts b/polygerrit-ui/app/elements/checks/gr-checks-results_test.ts
index d47df32..c4ccb0d 100644
--- a/polygerrit-ui/app/elements/checks/gr-checks-results_test.ts
+++ b/polygerrit-ui/app/elements/checks/gr-checks-results_test.ts
@@ -7,7 +7,7 @@
import './gr-checks-results';
import {GrChecksResults, GrResultRow} from './gr-checks-results';
import {html} from 'lit';
-import {fixture} from '@open-wc/testing-helpers';
+import {fixture} from '@open-wc/testing';
import {checksModelToken} from '../../models/checks/checks-model';
import {fakeRun0, setAllFakeRuns} from '../../models/checks/checks-fakes';
import {resolve} from '../../models/dependency';
@@ -39,24 +39,29 @@
element.latestPatchNum = 1 as PatchSetNumber;
await element.updateComplete;
labelDiv = queryAndAssert(element, '.label');
- expect(labelDiv).dom.to.equal(/* HTML */ `
- <div class="approved label">
- <span> test-label +1 </span>
- <paper-tooltip
- fittovisiblebounds=""
- offset="5"
- role="tooltip"
- tabindex="-1"
- >
- The check result has (probably) influenced this label vote.
- </paper-tooltip>
- </div>
- `);
+ assert.dom.equal(
+ labelDiv,
+ /* HTML */ `
+ <div class="approved label">
+ <span> test-label +1 </span>
+ <paper-tooltip
+ fittovisiblebounds=""
+ offset="5"
+ role="tooltip"
+ tabindex="-1"
+ >
+ The check result has (probably) influenced this label vote.
+ </paper-tooltip>
+ </div>
+ `
+ );
});
test('renders', async () => {
await element.updateComplete;
- expect(element).shadowDom.to.equal(/* HTML */ `
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
<div class="flex">
<gr-hovercard-run> </gr-hovercard-run>
<div class="name" role="button" tabindex="0">
@@ -118,7 +123,8 @@
<gr-icon icon="expand_more"></gr-icon>
</div>
</div>
- `);
+ `
+ );
});
});
@@ -135,7 +141,8 @@
test('renders', async () => {
await element.updateComplete;
- expect(element).shadowDom.to.equal(
+ assert.shadowDom.equal(
+ element,
/* HTML */ `
<div class="header">
<div class="headerTopRow">
diff --git a/polygerrit-ui/app/elements/checks/gr-checks-runs_test.ts b/polygerrit-ui/app/elements/checks/gr-checks-runs_test.ts
index ba14e65..578b952 100644
--- a/polygerrit-ui/app/elements/checks/gr-checks-runs_test.ts
+++ b/polygerrit-ui/app/elements/checks/gr-checks-runs_test.ts
@@ -7,7 +7,7 @@
import './gr-checks-runs';
import {GrChecksRuns} from './gr-checks-runs';
import {html} from 'lit';
-import {fixture} from '@open-wc/testing-helpers';
+import {fixture} from '@open-wc/testing';
import {checksModelToken} from '../../models/checks/checks-model';
import {setAllFakeRuns} from '../../models/checks/checks-fakes';
import {resolve} from '../../models/dependency';
@@ -32,7 +32,8 @@
test('renders', async () => {
await element.updateComplete;
assert.equal(element.runs.length, 44);
- expect(element).shadowDom.to.equal(
+ assert.shadowDom.equal(
+ element,
/* HTML */ `
<h2 class="title">
<div class="heading-2">Runs</div>
@@ -95,7 +96,8 @@
element.collapsed = true;
await element.updateComplete;
assert.equal(element.runs.length, 44);
- expect(element).shadowDom.to.equal(
+ assert.shadowDom.equal(
+ element,
/* HTML */ `
<h2 class="title">
<div class="heading-2">Runs</div>
diff --git a/polygerrit-ui/app/elements/checks/gr-checks-tab_test.ts b/polygerrit-ui/app/elements/checks/gr-checks-tab_test.ts
index 8b2c916..2a77468 100644
--- a/polygerrit-ui/app/elements/checks/gr-checks-tab_test.ts
+++ b/polygerrit-ui/app/elements/checks/gr-checks-tab_test.ts
@@ -7,7 +7,7 @@
import {html} from 'lit';
import './gr-checks-tab';
import {GrChecksTab} from './gr-checks-tab';
-import {fixture} from '@open-wc/testing-helpers';
+import {fixture} from '@open-wc/testing';
import {checksModelToken} from '../../models/checks/checks-model';
import {fakeRun4_3, setAllFakeRuns} from '../../models/checks/checks-fakes';
import {resolve} from '../../models/dependency';
@@ -25,12 +25,15 @@
test('renders', async () => {
await element.updateComplete;
assert.equal(element.runs.length, 44);
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div class="container">
- <gr-checks-runs class="runs" collapsed=""> </gr-checks-runs>
- <gr-checks-results class="results"> </gr-checks-results>
- </div>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div class="container">
+ <gr-checks-runs class="runs" collapsed=""> </gr-checks-runs>
+ <gr-checks-results class="results"> </gr-checks-results>
+ </div>
+ `
+ );
});
test('select from tab state', async () => {
diff --git a/polygerrit-ui/app/elements/checks/gr-diff-check-result_test.ts b/polygerrit-ui/app/elements/checks/gr-diff-check-result_test.ts
index e863f14..994f42e 100644
--- a/polygerrit-ui/app/elements/checks/gr-diff-check-result_test.ts
+++ b/polygerrit-ui/app/elements/checks/gr-diff-check-result_test.ts
@@ -26,7 +26,9 @@
element.result = {...fakeRun1, ...fakeRun1.results?.[0]} as RunResult;
await element.updateComplete;
// cannot use /* HTML */ because formatted long message will not match.
- expect(element).shadowDom.to.equal(`
+ assert.shadowDom.equal(
+ element,
+ `
<div class="container font-normal warning">
<div class="header">
<div class="icon">
@@ -44,6 +46,7 @@
</div>
<div class="details"></div>
</div>
- `);
+ `
+ );
});
});
diff --git a/polygerrit-ui/app/elements/checks/gr-hovercard-run_test.ts b/polygerrit-ui/app/elements/checks/gr-hovercard-run_test.ts
index 4a9f69d..2b8bd63 100644
--- a/polygerrit-ui/app/elements/checks/gr-hovercard-run_test.ts
+++ b/polygerrit-ui/app/elements/checks/gr-hovercard-run_test.ts
@@ -5,7 +5,7 @@
*/
import '../../test/common-test-setup-karma';
import './gr-hovercard-run';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import {GrHovercardRun} from './gr-hovercard-run';
import {fakeRun0} from '../../models/checks/checks-fakes';
@@ -23,30 +23,33 @@
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div id="container" role="tooltip" tabindex="-1">
- <div class="section">
- <div class="chipRow">
- <div class="chip">
- <gr-icon icon="check"></gr-icon>
- <span> COMPLETED </span>
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div id="container" role="tooltip" tabindex="-1">
+ <div class="section">
+ <div class="chipRow">
+ <div class="chip">
+ <gr-icon icon="check"></gr-icon>
+ <span> COMPLETED </span>
+ </div>
+ </div>
+ </div>
+ <div class="section">
+ <div class="sectionIcon">
+ <gr-icon icon="error" filled class="error"></gr-icon>
+ </div>
+ <div class="sectionContent">
+ <h3 class="heading-3 name">
+ <span>
+ FAKE Error Finder Finder Finder Finder Finder Finder Finder
+ </span>
+ </h3>
</div>
</div>
</div>
- <div class="section">
- <div class="sectionIcon">
- <gr-icon icon="error" filled class="error"></gr-icon>
- </div>
- <div class="sectionContent">
- <h3 class="heading-3 name">
- <span>
- FAKE Error Finder Finder Finder Finder Finder Finder Finder
- </span>
- </h3>
- </div>
- </div>
- </div>
- `);
+ `
+ );
});
test('hovercard is shown with error icon', () => {
diff --git a/polygerrit-ui/app/elements/core/gr-account-dropdown/gr-account-dropdown_test.ts b/polygerrit-ui/app/elements/core/gr-account-dropdown/gr-account-dropdown_test.ts
index b9d621d..041441b 100644
--- a/polygerrit-ui/app/elements/core/gr-account-dropdown/gr-account-dropdown_test.ts
+++ b/polygerrit-ui/app/elements/core/gr-account-dropdown/gr-account-dropdown_test.ts
@@ -5,7 +5,7 @@
*/
import '../../../test/common-test-setup-karma';
import './gr-account-dropdown';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import {GrAccountDropdown} from './gr-account-dropdown';
import {AccountInfo} from '../../../types/common';
import {createServerInfo} from '../../../test/test-data-generators';
@@ -21,12 +21,15 @@
element.account = {name: 'John Doe', email: 'john@doe.com'} as AccountInfo;
await element.updateComplete;
- expect(element).shadowDom.to.equal(/* HTML */ `
- <gr-dropdown link="">
- <span>John Doe</span>
- <gr-avatar aria-label="Account avatar" hidden=""> </gr-avatar>
- </gr-dropdown>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <gr-dropdown link="">
+ <span>John Doe</span>
+ <gr-avatar aria-label="Account avatar" hidden=""> </gr-avatar>
+ </gr-dropdown>
+ `
+ );
});
test('account information', () => {
diff --git a/polygerrit-ui/app/elements/core/gr-error-dialog/gr-error-dialog_test.ts b/polygerrit-ui/app/elements/core/gr-error-dialog/gr-error-dialog_test.ts
index 19db752..900746f 100644
--- a/polygerrit-ui/app/elements/core/gr-error-dialog/gr-error-dialog_test.ts
+++ b/polygerrit-ui/app/elements/core/gr-error-dialog/gr-error-dialog_test.ts
@@ -3,7 +3,7 @@
* Copyright 2018 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import * as MockInteractions from '@polymer/iron-test-helpers/mock-interactions';
import '../../../test/common-test-setup-karma';
import {mockPromise, queryAndAssert} from '../../../test/test-utils';
@@ -19,18 +19,21 @@
});
test('renders', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <gr-dialog
- cancel-label=""
- confirm-label="Dismiss"
- confirm-on-enter=""
- id="dialog"
- role="dialog"
- >
- <div class="header" slot="header">An error occurred</div>
- <div class="main" slot="main"></div>
- </gr-dialog>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <gr-dialog
+ cancel-label=""
+ confirm-label="Dismiss"
+ confirm-on-enter=""
+ id="dialog"
+ role="dialog"
+ >
+ <div class="header" slot="header">An error occurred</div>
+ <div class="main" slot="main"></div>
+ </gr-dialog>
+ `
+ );
});
test('dismiss tap fires event', async () => {
diff --git a/polygerrit-ui/app/elements/core/gr-error-manager/gr-error-manager_test.ts b/polygerrit-ui/app/elements/core/gr-error-manager/gr-error-manager_test.ts
index a4f1893..634abbe 100644
--- a/polygerrit-ui/app/elements/core/gr-error-manager/gr-error-manager_test.ts
+++ b/polygerrit-ui/app/elements/core/gr-error-manager/gr-error-manager_test.ts
@@ -19,7 +19,7 @@
import {tap} from '@polymer/iron-test-helpers/mock-interactions';
import {AccountId} from '../../../types/common';
import {waitUntil} from '../../../test/test-utils';
-import {fixture} from '@open-wc/testing-helpers';
+import {fixture} from '@open-wc/testing';
import {html} from 'lit';
suite('gr-error-manager tests', () => {
@@ -57,28 +57,31 @@
});
test('renders', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <gr-overlay
- aria-hidden="true"
- id="errorOverlay"
- style="outline: none; display: none;"
- tabindex="-1"
- with-backdrop=""
- >
- <gr-error-dialog id="errorDialog"> </gr-error-dialog>
- </gr-overlay>
- <gr-overlay
- always-on-top=""
- aria-hidden="true"
- id="noInteractionOverlay"
- no-cancel-on-esc-key=""
- no-cancel-on-outside-click=""
- style="outline: none; display: none;"
- tabindex="-1"
- with-backdrop=""
- >
- </gr-overlay>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <gr-overlay
+ aria-hidden="true"
+ id="errorOverlay"
+ style="outline: none; display: none;"
+ tabindex="-1"
+ with-backdrop=""
+ >
+ <gr-error-dialog id="errorDialog"> </gr-error-dialog>
+ </gr-overlay>
+ <gr-overlay
+ always-on-top=""
+ aria-hidden="true"
+ id="noInteractionOverlay"
+ no-cancel-on-esc-key=""
+ no-cancel-on-outside-click=""
+ style="outline: none; display: none;"
+ tabindex="-1"
+ with-backdrop=""
+ >
+ </gr-overlay>
+ `
+ );
});
test('does not show auth error on 403 by default', async () => {
diff --git a/polygerrit-ui/app/elements/core/gr-key-binding-display/gr-key-binding-display_test.ts b/polygerrit-ui/app/elements/core/gr-key-binding-display/gr-key-binding-display_test.ts
index 5d12c72..77ee4bb 100644
--- a/polygerrit-ui/app/elements/core/gr-key-binding-display/gr-key-binding-display_test.ts
+++ b/polygerrit-ui/app/elements/core/gr-key-binding-display/gr-key-binding-display_test.ts
@@ -3,7 +3,7 @@
* Copyright 2018 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import '../../../test/common-test-setup-karma';
import './gr-key-binding-display';
import {GrKeyBindingDisplay} from './gr-key-binding-display';
@@ -24,16 +24,19 @@
});
test('renders', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <span class="key"> x </span>
- or
- <span class="key modifier"> Ctrl </span>
- <span class="key"> x </span>
- or
- <span class="key modifier"> Shift </span>
- <span class="key modifier"> Meta </span>
- <span class="key"> x </span>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <span class="key"> x </span>
+ or
+ <span class="key modifier"> Ctrl </span>
+ <span class="key"> x </span>
+ or
+ <span class="key modifier"> Shift </span>
+ <span class="key modifier"> Meta </span>
+ <span class="key"> x </span>
+ `
+ );
});
suite('_computeKey', () => {
diff --git a/polygerrit-ui/app/elements/core/gr-keyboard-shortcuts-dialog/gr-keyboard-shortcuts-dialog_test.ts b/polygerrit-ui/app/elements/core/gr-keyboard-shortcuts-dialog/gr-keyboard-shortcuts-dialog_test.ts
index bed46ef..d80e3d9 100644
--- a/polygerrit-ui/app/elements/core/gr-keyboard-shortcuts-dialog/gr-keyboard-shortcuts-dialog_test.ts
+++ b/polygerrit-ui/app/elements/core/gr-keyboard-shortcuts-dialog/gr-keyboard-shortcuts-dialog_test.ts
@@ -10,8 +10,7 @@
SectionView,
ShortcutSection,
} from '../../../services/shortcuts/shortcuts-service';
-
-const basicFixture = fixtureFromElement('gr-keyboard-shortcuts-dialog');
+import {fixture, html} from '@open-wc/testing';
const x = ['x'];
const ctrlX = ['Ctrl', 'x'];
@@ -21,7 +20,9 @@
let element: GrKeyboardShortcutsDialog;
setup(async () => {
- element = basicFixture.instantiate();
+ element = await fixture(
+ html`<gr-keyboard-shortcuts-dialog></gr-keyboard-shortcuts-dialog>`
+ );
await flush();
});
@@ -44,67 +45,70 @@
update(directory);
await element.updateComplete;
- expect(element).shadowDom.to.equal(/* HTML */ `
- <header>
- <h3 class="heading-2">Keyboard shortcuts</h3>
- <gr-button aria-disabled="false" link="" role="button" tabindex="0">
- Close
- </gr-button>
- </header>
- <main>
- <div class="column">
- <table>
- <caption class="heading-3">
- Navigation
- </caption>
- <thead>
- <tr>
- <th>
- <strong> Action </strong>
- </th>
- <th>
- <strong> Key </strong>
- </th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>navigation shortcuts</td>
- <td>
- <gr-key-binding-display> </gr-key-binding-display>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <div class="column">
- <table>
- <caption class="heading-3">
- Actions
- </caption>
- <thead>
- <tr>
- <th>
- <strong> Action </strong>
- </th>
- <th>
- <strong> Key </strong>
- </th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>navigation shortcuts</td>
- <td>
- <gr-key-binding-display> </gr-key-binding-display>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </main>
- <footer></footer>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <header>
+ <h3 class="heading-2">Keyboard shortcuts</h3>
+ <gr-button aria-disabled="false" link="" role="button" tabindex="0">
+ Close
+ </gr-button>
+ </header>
+ <main>
+ <div class="column">
+ <table>
+ <caption class="heading-3">
+ Navigation
+ </caption>
+ <thead>
+ <tr>
+ <th>
+ <strong> Action </strong>
+ </th>
+ <th>
+ <strong> Key </strong>
+ </th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>navigation shortcuts</td>
+ <td>
+ <gr-key-binding-display> </gr-key-binding-display>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ <div class="column">
+ <table>
+ <caption class="heading-3">
+ Actions
+ </caption>
+ <thead>
+ <tr>
+ <th>
+ <strong> Action </strong>
+ </th>
+ <th>
+ <strong> Key </strong>
+ </th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>navigation shortcuts</td>
+ <td>
+ <gr-key-binding-display> </gr-key-binding-display>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </main>
+ <footer></footer>
+ `
+ );
});
suite('left and right contents', () => {
diff --git a/polygerrit-ui/app/elements/core/gr-main-header/gr-main-header_test.ts b/polygerrit-ui/app/elements/core/gr-main-header/gr-main-header_test.ts
index 4f47f7a..4ea5e9c 100644
--- a/polygerrit-ui/app/elements/core/gr-main-header/gr-main-header_test.ts
+++ b/polygerrit-ui/app/elements/core/gr-main-header/gr-main-header_test.ts
@@ -4,7 +4,12 @@
* SPDX-License-Identifier: Apache-2.0
*/
import '../../../test/common-test-setup-karma';
-import {isHidden, query, stubRestApi} from '../../../test/test-utils';
+import {
+ isHidden,
+ query,
+ stubElement,
+ stubRestApi,
+} from '../../../test/test-utils';
import './gr-main-header';
import {GrMainHeader} from './gr-main-header';
import {
@@ -15,76 +20,82 @@
import {NavLink} from '../../../utils/admin-nav-util';
import {ServerInfo, TopMenuItemInfo} from '../../../types/common';
import {AuthType} from '../../../constants/constants';
-
-const basicFixture = fixtureFromElement('gr-main-header');
+import {fixture, html} from '@open-wc/testing';
suite('gr-main-header tests', () => {
let element: GrMainHeader;
setup(async () => {
stubRestApi('probePath').returns(Promise.resolve(false));
- stub('gr-main-header', 'loadAccount').callsFake(() => Promise.resolve());
- element = basicFixture.instantiate();
- await element.updateComplete;
+ stubElement('gr-main-header', 'loadAccount').callsFake(() =>
+ Promise.resolve()
+ );
+ element = await fixture(html`<gr-main-header></gr-main-header>`);
});
test('renders', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <nav>
- <a class="bigTitle" href="//localhost:9876/">
- <gr-endpoint-decorator name="header-title">
- <span class="titleText"> </span>
- </gr-endpoint-decorator>
- </a>
- <ul class="links">
- <li>
- <gr-dropdown down-arrow="" horizontal-align="left" link="">
- <span class="linksTitle" id="Changes"> Changes </span>
- </gr-dropdown>
- </li>
- <li>
- <gr-dropdown down-arrow="" horizontal-align="left" link="">
- <span class="linksTitle" id="Browse"> Browse </span>
- </gr-dropdown>
- </li>
- </ul>
- <div class="rightItems">
- <gr-endpoint-decorator
- class="hideOnMobile"
- name="header-small-banner"
- >
- </gr-endpoint-decorator>
- <gr-smart-search id="search" label="Search for changes">
- </gr-smart-search>
- <gr-endpoint-decorator
- class="hideOnMobile"
- name="header-browse-source"
- >
- </gr-endpoint-decorator>
- <gr-endpoint-decorator class="feedbackButton" name="header-feedback">
- </gr-endpoint-decorator>
- </div>
- <div class="accountContainer" id="accountContainer">
- <gr-icon
- aria-label="Hide Searchbar"
- icon="search"
- id="mobileSearch"
- role="button"
- >
- </gr-icon>
- <a class="loginButton" href="/login"> Sign in </a>
- <a
- aria-label="Settings"
- class="settingsButton"
- href="/settings/"
- role="button"
- title="Settings"
- >
- <gr-icon icon="settings" filled></gr-icon>
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <nav>
+ <a class="bigTitle" href="//localhost:9876/">
+ <gr-endpoint-decorator name="header-title">
+ <span class="titleText"> </span>
+ </gr-endpoint-decorator>
</a>
- </div>
- </nav>
- `);
+ <ul class="links">
+ <li>
+ <gr-dropdown down-arrow="" horizontal-align="left" link="">
+ <span class="linksTitle" id="Changes"> Changes </span>
+ </gr-dropdown>
+ </li>
+ <li>
+ <gr-dropdown down-arrow="" horizontal-align="left" link="">
+ <span class="linksTitle" id="Browse"> Browse </span>
+ </gr-dropdown>
+ </li>
+ </ul>
+ <div class="rightItems">
+ <gr-endpoint-decorator
+ class="hideOnMobile"
+ name="header-small-banner"
+ >
+ </gr-endpoint-decorator>
+ <gr-smart-search id="search" label="Search for changes">
+ </gr-smart-search>
+ <gr-endpoint-decorator
+ class="hideOnMobile"
+ name="header-browse-source"
+ >
+ </gr-endpoint-decorator>
+ <gr-endpoint-decorator
+ class="feedbackButton"
+ name="header-feedback"
+ >
+ </gr-endpoint-decorator>
+ </div>
+ <div class="accountContainer" id="accountContainer">
+ <gr-icon
+ aria-label="Hide Searchbar"
+ icon="search"
+ id="mobileSearch"
+ role="button"
+ >
+ </gr-icon>
+ <a class="loginButton" href="/login"> Sign in </a>
+ <a
+ aria-label="Settings"
+ class="settingsButton"
+ href="/settings/"
+ role="button"
+ title="Settings"
+ >
+ <gr-icon icon="settings" filled></gr-icon>
+ </a>
+ </div>
+ </nav>
+ `
+ );
});
test('link visibility', async () => {
diff --git a/polygerrit-ui/app/elements/core/gr-navigation/gr-navigation.ts b/polygerrit-ui/app/elements/core/gr-navigation/gr-navigation.ts
index 51e0b34..46cb2f0 100644
--- a/polygerrit-ui/app/elements/core/gr-navigation/gr-navigation.ts
+++ b/polygerrit-ui/app/elements/core/gr-navigation/gr-navigation.ts
@@ -34,7 +34,7 @@
// Navigation parameters object format:
//
-// Each object has a `view` property with a value from GerritNav.View. The
+// Each object has a `view` property with a value from GerritView. The
// remaining properties depend on the value used for view.
// GenerateUrlParameters lists all the possible view parameters.
@@ -231,14 +231,6 @@
// TODO(dmfilippov) Convert to class, extract consts, give better name and
// expose as a service from appContext
export const GerritNav = {
- View: GerritView,
-
- GroupDetailView,
-
- RepoDetailView,
-
- WeblinkType,
-
_navigate: uninitializedNavigate,
_generateUrl: uninitializedGenerateUrl,
@@ -420,15 +412,15 @@
getUrlForChangeById(
changeNum: NumericChangeId,
project: RepoName,
- patchNum?: RevisionPatchSetNum,
- usp?: string
+ usp: string,
+ patchNum?: RevisionPatchSetNum
) {
return this._getUrlFor({
view: GerritView.CHANGE,
changeNum,
project,
- patchNum,
usp,
+ patchNum,
});
},
@@ -667,7 +659,7 @@
return this._getUrlFor({
view: GerritView.REPO,
repoName,
- detail: GerritNav.RepoDetailView.BRANCHES,
+ detail: RepoDetailView.BRANCHES,
});
},
@@ -675,7 +667,7 @@
return this._getUrlFor({
view: GerritView.REPO,
repoName,
- detail: GerritNav.RepoDetailView.ACCESS,
+ detail: RepoDetailView.ACCESS,
});
},
@@ -683,7 +675,7 @@
return this._getUrlFor({
view: GerritView.REPO,
repoName,
- detail: GerritNav.RepoDetailView.COMMANDS,
+ detail: RepoDetailView.COMMANDS,
});
},
@@ -691,7 +683,7 @@
return this._getUrlFor({
view: GerritView.REPO,
repoName,
- detail: GerritNav.RepoDetailView.DASHBOARDS,
+ detail: RepoDetailView.DASHBOARDS,
});
},
@@ -706,7 +698,7 @@
return this._getUrlFor({
view: GerritView.GROUP,
groupId,
- detail: GerritNav.GroupDetailView.LOG,
+ detail: GroupDetailView.LOG,
});
},
diff --git a/polygerrit-ui/app/elements/core/gr-router/gr-router.ts b/polygerrit-ui/app/elements/core/gr-router/gr-router.ts
index 8fd01de..71d3cc0 100644
--- a/polygerrit-ui/app/elements/core/gr-router/gr-router.ts
+++ b/polygerrit-ui/app/elements/core/gr-router/gr-router.ts
@@ -1420,7 +1420,7 @@
// standard queries gain the ability to search places like commit messages
// for change IDs.
this.setParams({
- view: GerritNav.View.SEARCH,
+ view: GerritView.SEARCH,
query: data.params[0],
});
}
diff --git a/polygerrit-ui/app/elements/core/gr-router/gr-router_test.ts b/polygerrit-ui/app/elements/core/gr-router/gr-router_test.ts
index 241839c..02d312f 100644
--- a/polygerrit-ui/app/elements/core/gr-router/gr-router_test.ts
+++ b/polygerrit-ui/app/elements/core/gr-router/gr-router_test.ts
@@ -40,6 +40,7 @@
GroupDetailView,
GenerateUrlEditViewParameters,
GenerateUrlChangeViewParameters,
+ RepoDetailView,
} from '../../../utils/router-util';
suite('gr-router tests', () => {
@@ -404,16 +405,13 @@
const params = createPageContext();
router.handleNewAgreementsRoute(params);
assert.isTrue(setParamsStub.calledOnce);
- assert.equal(
- setParamsStub.lastCall.args[0].view,
- GerritNav.View.AGREEMENTS
- );
+ assert.equal(setParamsStub.lastCall.args[0].view, GerritView.AGREEMENTS);
});
test('handleSettingsLegacyRoute', () => {
const data = {...createPageContext(), params: {0: 'my-token'}};
assertDataToParams(data, 'handleSettingsLegacyRoute', {
- view: GerritNav.View.SETTINGS,
+ view: GerritView.SETTINGS,
emailToken: 'my-token',
});
});
@@ -421,7 +419,7 @@
test('handleSettingsLegacyRoute with +', () => {
const data = {...createPageContext(), params: {0: 'my-token test'}};
assertDataToParams(data, 'handleSettingsLegacyRoute', {
- view: GerritNav.View.SETTINGS,
+ view: GerritView.SETTINGS,
emailToken: 'my-token+test',
});
});
@@ -429,7 +427,7 @@
test('handleSettingsRoute', () => {
const data = createPageContext();
assertDataToParams(data, 'handleSettingsRoute', {
- view: GerritNav.View.SETTINGS,
+ view: GerritView.SETTINGS,
});
});
@@ -485,7 +483,7 @@
params: {0: 'project:foo/bar/baz'},
};
assertDataToParams(data, 'handleQueryRoute', {
- view: GerritNav.View.SEARCH,
+ view: GerritView.SEARCH,
query: 'project:foo/bar/baz',
offset: undefined,
});
@@ -493,7 +491,7 @@
data.params[1] = '123';
data.params[2] = '123';
assertDataToParams(data, 'handleQueryRoute', {
- view: GerritNav.View.SEARCH,
+ view: GerritView.SEARCH,
query: 'project:foo/bar/baz',
offset: '123',
});
@@ -512,7 +510,7 @@
params: {0: 'I0123456789abcdef0123456789abcdef01234567'},
};
assertDataToParams(data, 'handleChangeIdQueryRoute', {
- view: GerritNav.View.SEARCH,
+ view: GerritView.SEARCH,
query: 'I0123456789abcdef0123456789abcdef01234567',
});
});
@@ -697,7 +695,7 @@
assert.isFalse(redirectStub.called);
assert.isTrue(setParamsStub.calledOnce);
assert.deepEqual(setParamsStub.lastCall.args[0], {
- view: GerritNav.View.DASHBOARD,
+ view: GerritView.DASHBOARD,
user: 'foo',
});
});
@@ -736,7 +734,7 @@
assert.isFalse(redirectStub.called);
assert.isTrue(setParamsStub.calledOnce);
assert.deepEqual(setParamsStub.lastCall.args[0], {
- view: GerritNav.View.DASHBOARD,
+ view: GerritView.DASHBOARD,
user: 'self',
sections: [
{name: 'a', query: 'b'},
@@ -760,7 +758,7 @@
assert.isFalse(redirectStub.called);
assert.isTrue(setParamsStub.calledOnce);
assert.deepEqual(setParamsStub.lastCall.args[0], {
- view: GerritNav.View.DASHBOARD,
+ view: GerritView.DASHBOARD,
user: 'self',
sections: [{name: 'a', query: 'b'}],
title: 't',
@@ -781,7 +779,7 @@
assert.isFalse(redirectStub.called);
assert.isTrue(setParamsStub.calledOnce);
assert.deepEqual(setParamsStub.lastCall.args[0], {
- view: GerritNav.View.DASHBOARD,
+ view: GerritView.DASHBOARD,
user: 'self',
sections: [{name: 'a', query: 'is:open b'}],
title: 'Custom Dashboard',
@@ -837,7 +835,7 @@
data.hash = 'create';
assertDataToParams(data, 'handleGroupListOffsetRoute', {
- view: GerritNav.View.ADMIN,
+ view: GerritView.ADMIN,
adminView: 'gr-admin-group-list',
offset: '42',
filter: null,
@@ -915,7 +913,7 @@
const data = {...createPageContext(), params: {0: '4321'}};
assertDataToParams(data, 'handleRepoGeneralRoute', {
view: GerritView.REPO,
- detail: GerritNav.RepoDetailView.GENERAL,
+ detail: RepoDetailView.GENERAL,
repo: '4321' as RepoName,
});
});
@@ -924,7 +922,7 @@
const data = {...createPageContext(), params: {0: '4321'}};
assertDataToParams(data, 'handleRepoCommandsRoute', {
view: GerritView.REPO,
- detail: GerritNav.RepoDetailView.COMMANDS,
+ detail: RepoDetailView.COMMANDS,
repo: '4321' as RepoName,
});
});
@@ -933,7 +931,7 @@
const data = {...createPageContext(), params: {0: '4321'}};
assertDataToParams(data, 'handleRepoAccessRoute', {
view: GerritView.REPO,
- detail: GerritNav.RepoDetailView.ACCESS,
+ detail: RepoDetailView.ACCESS,
repo: '4321' as RepoName,
});
});
@@ -946,7 +944,7 @@
};
assertDataToParams(data, 'handleBranchListOffsetRoute', {
view: GerritView.REPO,
- detail: GerritNav.RepoDetailView.BRANCHES,
+ detail: RepoDetailView.BRANCHES,
repo: '4321' as RepoName,
offset: 0,
filter: null,
@@ -955,7 +953,7 @@
data.params[2] = '42';
assertDataToParams(data, 'handleBranchListOffsetRoute', {
view: GerritView.REPO,
- detail: GerritNav.RepoDetailView.BRANCHES,
+ detail: RepoDetailView.BRANCHES,
repo: '4321' as RepoName,
offset: '42',
filter: null,
@@ -969,7 +967,7 @@
};
assertDataToParams(data, 'handleBranchListFilterOffsetRoute', {
view: GerritView.REPO,
- detail: GerritNav.RepoDetailView.BRANCHES,
+ detail: RepoDetailView.BRANCHES,
repo: '4321' as RepoName,
offset: '42',
filter: 'foo',
@@ -983,7 +981,7 @@
};
assertDataToParams(data, 'handleBranchListFilterRoute', {
view: GerritView.REPO,
- detail: GerritNav.RepoDetailView.BRANCHES,
+ detail: RepoDetailView.BRANCHES,
repo: '4321' as RepoName,
filter: 'foo',
});
@@ -995,7 +993,7 @@
const data = {...createPageContext(), params: {0: '4321'}};
assertDataToParams(data, 'handleTagListOffsetRoute', {
view: GerritView.REPO,
- detail: GerritNav.RepoDetailView.TAGS,
+ detail: RepoDetailView.TAGS,
repo: '4321' as RepoName,
offset: 0,
filter: null,
@@ -1009,7 +1007,7 @@
};
assertDataToParams(data, 'handleTagListFilterOffsetRoute', {
view: GerritView.REPO,
- detail: GerritNav.RepoDetailView.TAGS,
+ detail: RepoDetailView.TAGS,
repo: '4321' as RepoName,
offset: '42',
filter: 'foo',
@@ -1023,7 +1021,7 @@
};
assertDataToParams(data, 'handleTagListFilterRoute', {
view: GerritView.REPO,
- detail: GerritNav.RepoDetailView.TAGS,
+ detail: RepoDetailView.TAGS,
repo: '4321' as RepoName,
filter: null,
});
@@ -1031,7 +1029,7 @@
data.params.filter = 'foo';
assertDataToParams(data, 'handleTagListFilterRoute', {
view: GerritView.REPO,
- detail: GerritNav.RepoDetailView.TAGS,
+ detail: RepoDetailView.TAGS,
repo: '4321' as RepoName,
filter: 'foo',
});
@@ -1390,7 +1388,7 @@
const appParams: GenerateUrlEditViewParameters = {
project: 'foo/bar' as RepoName,
changeNum: 1234 as NumericChangeId,
- view: GerritNav.View.EDIT,
+ view: GerritView.EDIT,
path: 'foo/bar/baz',
patchNum: 3 as RevisionPatchSetNum,
lineNum: '',
@@ -1423,7 +1421,7 @@
const appParams: GenerateUrlEditViewParameters = {
project: 'foo/bar' as RepoName,
changeNum: 1234 as NumericChangeId,
- view: GerritNav.View.EDIT,
+ view: GerritView.EDIT,
path: 'foo/bar/baz',
patchNum: 3 as RevisionPatchSetNum,
lineNum: '4',
@@ -1473,7 +1471,7 @@
test('handlePluginScreen', () => {
const ctx = {...createPageContext(), params: {0: 'foo', 1: 'bar'}};
assertDataToParams(ctx, 'handlePluginScreen', {
- view: GerritNav.View.PLUGIN_SCREEN,
+ view: GerritView.PLUGIN_SCREEN,
plugin: 'foo',
screen: 'bar',
});
diff --git a/polygerrit-ui/app/elements/core/gr-search-bar/gr-search-bar_test.ts b/polygerrit-ui/app/elements/core/gr-search-bar/gr-search-bar_test.ts
index cef4081..7802ef9 100644
--- a/polygerrit-ui/app/elements/core/gr-search-bar/gr-search-bar_test.ts
+++ b/polygerrit-ui/app/elements/core/gr-search-bar/gr-search-bar_test.ts
@@ -17,39 +17,40 @@
import {queryAndAssert} from '../../../test/test-utils';
import {GrAutocomplete} from '../../shared/gr-autocomplete/gr-autocomplete';
import {PaperInputElement} from '@polymer/paper-input/paper-input';
-
-const basicFixture = fixtureFromElement('gr-search-bar');
+import {fixture, html} from '@open-wc/testing';
suite('gr-search-bar tests', () => {
let element: GrSearchBar;
setup(async () => {
- element = basicFixture.instantiate();
- await element.updateComplete;
+ element = await fixture(html`<gr-search-bar></gr-search-bar>`);
});
test('renders', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <form>
- <gr-autocomplete
- allow-non-suggested-values=""
- id="searchInput"
- multi=""
- show-search-icon=""
- tab-complete=""
- >
- <a
- class="help"
- href="https://gerrit-review.googlesource.com/documentation/user-search.html"
- slot="suffix"
- tabindex="-1"
- target="_blank"
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <form>
+ <gr-autocomplete
+ allow-non-suggested-values=""
+ id="searchInput"
+ multi=""
+ show-search-icon=""
+ tab-complete=""
>
- <gr-icon icon="help" title="read documentation"></gr-icon>
- </a>
- </gr-autocomplete>
- </form>
- `);
+ <a
+ class="help"
+ href="https://gerrit-review.googlesource.com/documentation/user-search.html"
+ slot="suffix"
+ tabindex="-1"
+ target="_blank"
+ >
+ <gr-icon icon="help" title="read documentation"></gr-icon>
+ </a>
+ </gr-autocomplete>
+ </form>
+ `
+ );
});
test('value is propagated to inputVal', async () => {
@@ -197,7 +198,7 @@
suite('getSearchSuggestions', () => {
setup(async () => {
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-search-bar></gr-search-bar>`);
element.mergeabilityComputationBehavior =
MergeabilityComputationBehavior.NEVER;
await element.updateComplete;
@@ -259,7 +260,7 @@
].forEach(mergeability => {
suite(`mergeability as ${mergeability}`, () => {
setup(async () => {
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-search-bar></gr-search-bar>`);
element.serverConfig = {
...createServerInfo(),
change: {
@@ -284,7 +285,7 @@
suite('doc url', () => {
setup(async () => {
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-search-bar></gr-search-bar>`);
});
test('compute help doc url with correct path', async () => {
diff --git a/polygerrit-ui/app/elements/core/gr-smart-search/gr-smart-search_test.ts b/polygerrit-ui/app/elements/core/gr-smart-search/gr-smart-search_test.ts
index f269200..f468778 100644
--- a/polygerrit-ui/app/elements/core/gr-smart-search/gr-smart-search_test.ts
+++ b/polygerrit-ui/app/elements/core/gr-smart-search/gr-smart-search_test.ts
@@ -8,21 +8,20 @@
import {GrSmartSearch} from './gr-smart-search';
import {stubRestApi} from '../../../test/test-utils';
import {EmailAddress, GroupId, UrlEncodedRepoName} from '../../../types/common';
-
-const basicFixture = fixtureFromElement('gr-smart-search');
+import {fixture, html} from '@open-wc/testing';
suite('gr-smart-search tests', () => {
let element: GrSmartSearch;
setup(async () => {
- element = basicFixture.instantiate();
- await element.updateComplete;
+ element = await fixture(html`<gr-smart-search></gr-smart-search>`);
});
test('renders', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <gr-search-bar id="search"> </gr-search-bar>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ ' <gr-search-bar id="search"> </gr-search-bar> '
+ );
});
test('Autocompletes accounts', () => {
diff --git a/polygerrit-ui/app/elements/custom-dark-theme_test.ts b/polygerrit-ui/app/elements/custom-dark-theme_test.ts
index 6c3ea47..a2863a4 100644
--- a/polygerrit-ui/app/elements/custom-dark-theme_test.ts
+++ b/polygerrit-ui/app/elements/custom-dark-theme_test.ts
@@ -8,15 +8,14 @@
import './gr-app';
import {getPluginLoader} from './shared/gr-js-api-interface/gr-plugin-loader';
import {GrApp} from './gr-app';
-
-const basicFixture = fixtureFromElement('gr-app');
+import {fixture, html} from '@open-wc/testing';
suite('gr-app custom dark theme tests', () => {
let element: GrApp;
setup(async () => {
window.localStorage.setItem('dark-theme', 'true');
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-app></gr-app>`);
getPluginLoader().loadPlugins([]);
await getPluginLoader().awaitPluginsLoaded();
await flush();
diff --git a/polygerrit-ui/app/elements/custom-light-theme_test.ts b/polygerrit-ui/app/elements/custom-light-theme_test.ts
index a52f5fd..e92438e 100644
--- a/polygerrit-ui/app/elements/custom-light-theme_test.ts
+++ b/polygerrit-ui/app/elements/custom-light-theme_test.ts
@@ -14,8 +14,7 @@
createAccountDetailWithId,
createServerInfo,
} from '../test/test-data-generators';
-
-const basicFixture = fixtureFromElement('gr-app');
+import {fixture, html} from '@open-wc/testing';
suite('gr-app custom light theme tests', () => {
let element: GrApp;
@@ -28,7 +27,7 @@
stubRestApi('getDiffComments').returns(Promise.resolve({}));
stubRestApi('getDiffRobotComments').returns(Promise.resolve({}));
stubRestApi('getDiffDrafts').returns(Promise.resolve({}));
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-app></gr-app>`);
getPluginLoader().loadPlugins([]);
await getPluginLoader().awaitPluginsLoaded();
await flush();
diff --git a/polygerrit-ui/app/elements/diff/gr-apply-fix-dialog/gr-apply-fix-dialog_test.ts b/polygerrit-ui/app/elements/diff/gr-apply-fix-dialog/gr-apply-fix-dialog_test.ts
index 30b5086..8338cff 100644
--- a/polygerrit-ui/app/elements/diff/gr-apply-fix-dialog/gr-apply-fix-dialog_test.ts
+++ b/polygerrit-ui/app/elements/diff/gr-apply-fix-dialog/gr-apply-fix-dialog_test.ts
@@ -23,7 +23,7 @@
OpenFixPreviewEventDetail,
} from '../../../types/events';
import {GrButton} from '../../shared/gr-button/gr-button';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
suite('gr-apply-fix-dialog tests', () => {
let element: GrApplyFixDialog;
@@ -176,7 +176,8 @@
test('renders', async () => {
await open(TWO_FIXES);
- expect(element).shadowDom.to.equal(
+ assert.shadowDom.equal(
+ element,
/* HTML */ `
<gr-overlay id="applyFixOverlay" tabindex="-1" with-backdrop="">
<gr-dialog id="applyFixDialog" role="dialog">
diff --git a/polygerrit-ui/app/elements/diff/gr-diff-host/gr-diff-host_test.ts b/polygerrit-ui/app/elements/diff/gr-diff-host/gr-diff-host_test.ts
index 0c49c37..d4a516d 100644
--- a/polygerrit-ui/app/elements/diff/gr-diff-host/gr-diff-host_test.ts
+++ b/polygerrit-ui/app/elements/diff/gr-diff-host/gr-diff-host_test.ts
@@ -44,7 +44,7 @@
UrlEncodedCommentId,
} from '../../../types/common';
import {CoverageType} from '../../../types/types';
-import {GerritNav} from '../../core/gr-navigation/gr-navigation';
+import {GerritNav, WeblinkType} from '../../core/gr-navigation/gr-navigation';
import {GrDiffBuilderImage} from '../../../embed/diff/gr-diff-builder/gr-diff-builder-image';
import {GrDiffHost, LineInfo} from './gr-diff-host';
import {DiffInfo, DiffViewMode, IgnoreWhitespaceType} from '../../../api/diff';
@@ -54,8 +54,7 @@
import {GrCommentThread} from '../../shared/gr-comment-thread/gr-comment-thread';
import {assertIsDefined} from '../../../utils/common-util';
import {GrAnnotationActionsInterface} from '../../shared/gr-js-api-interface/gr-annotation-actions-js-api';
-
-const basicFixture = fixtureFromElement('gr-diff-host');
+import {fixture, html} from '@open-wc/testing';
suite('gr-diff-host tests', () => {
let element: GrDiffHost;
@@ -64,7 +63,7 @@
setup(async () => {
stubRestApi('getAccount').callsFake(() => Promise.resolve(account));
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-diff-host></gr-diff-host>`);
element.changeNum = 123 as NumericChangeId;
element.path = 'some/path';
element.change = createChange();
@@ -79,7 +78,7 @@
let getDiffLayersStub: sinon.SinonStub;
const pluginLayers = [{annotate: () => {}}, {annotate: () => {}}];
setup(async () => {
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-diff-host></gr-diff-host>`);
getDiffLayersStub = sinon
.stub(element.jsAPI, 'getDiffLayers')
.returns(pluginLayers);
@@ -196,7 +195,7 @@
weblinks: undefined,
},
repo: 'test-project' as RepoName,
- type: GerritNav.WeblinkType.EDIT,
+ type: WeblinkType.EDIT,
});
assert.deepEqual(element.editWeblinks, [
{
@@ -211,7 +210,7 @@
weblinks: undefined,
},
repo: 'test-project' as RepoName,
- type: GerritNav.WeblinkType.FILE,
+ type: WeblinkType.FILE,
});
assert.deepEqual(weblinksStub.thirdCall.args[0], {
commit: 'test-commit' as CommitId,
@@ -220,7 +219,7 @@
weblinks: undefined,
},
repo: 'test-project' as RepoName,
- type: GerritNav.WeblinkType.FILE,
+ type: WeblinkType.FILE,
});
assert.deepEqual(element.filesWeblinks, {
meta_a: [{name: 'stubb', url: '#s'}],
@@ -699,7 +698,7 @@
suite('blame', () => {
setup(async () => {
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-diff-host></gr-diff-host>`);
element.changeNum = 123 as NumericChangeId;
element.path = 'some/path';
await element.updateComplete;
@@ -891,7 +890,7 @@
let reportStub: SinonStub;
setup(async () => {
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-diff-host></gr-diff-host>`);
element.changeNum = 123 as NumericChangeId;
element.path = 'file.txt';
element.patchRange = createPatchRange(1, 2);
@@ -1652,9 +1651,7 @@
coverageProviderStub = sinon
.stub()
.returns(Promise.resolve(exampleRanges));
-
- element = basicFixture.instantiate();
-
+ element = await fixture(html`<gr-diff-host></gr-diff-host>`);
element.changeNum = 123 as NumericChangeId;
element.change = createChange();
element.path = 'some/path';
@@ -1667,6 +1664,8 @@
};
element.patchRange = createPatchRange();
element.prefs = prefs;
+ await element.updateComplete;
+
getDiffRestApiStub.returns(
Promise.resolve({
...createDiff(),
@@ -1685,6 +1684,7 @@
} as unknown as GrAnnotationActionsInterface,
])
);
+ await element.reload();
});
test('getCoverageAnnotationApis should be called', async () => {
@@ -1705,6 +1705,8 @@
test('provider is called with appropriate params', async () => {
element.patchRange = createPatchRange(1, 3);
+ await element.updateComplete;
+ await element.reload();
await element.waitForReloadToRender();
assert.isTrue(
coverageProviderStub.calledWithExactly(
diff --git a/polygerrit-ui/app/elements/diff/gr-diff-preferences-dialog/gr-diff-preferences-dialog_test.ts b/polygerrit-ui/app/elements/diff/gr-diff-preferences-dialog/gr-diff-preferences-dialog_test.ts
index d5d50b8..fe4517e 100644
--- a/polygerrit-ui/app/elements/diff/gr-diff-preferences-dialog/gr-diff-preferences-dialog_test.ts
+++ b/polygerrit-ui/app/elements/diff/gr-diff-preferences-dialog/gr-diff-preferences-dialog_test.ts
@@ -11,7 +11,7 @@
import {DiffPreferencesInfo} from '../../../api/diff';
import {ParsedJSON} from '../../../types/common';
import {GrButton} from '../../shared/gr-button/gr-button';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
suite('gr-diff-preferences-dialog', () => {
let element: GrDiffPreferencesDialog;
diff --git a/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view_test.ts b/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view_test.ts
index 6bf2470..c6fbb83 100644
--- a/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view_test.ts
+++ b/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view_test.ts
@@ -65,8 +65,7 @@
import {ParsedChangeInfo} from '../../../types/types';
import {assertIsDefined} from '../../../utils/common-util';
import {GrDiffModeSelector} from '../../../embed/diff/gr-diff-mode-selector/gr-diff-mode-selector';
-
-const basicFixture = fixtureFromElement('gr-diff-view');
+import {fixture, html} from '@open-wc/testing';
function createComment(
id: string,
@@ -119,7 +118,7 @@
stubRestApi('getDiffDrafts').returns(Promise.resolve({}));
stubRestApi('getPortedComments').returns(Promise.resolve({}));
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-diff-view></gr-diff-view>`);
element.changeNum = 42 as NumericChangeId;
element.path = 'some/path.txt';
element.change = createParsedChange();
@@ -159,7 +158,7 @@
sinon.stub(element, 'fetchFiles');
const paramsChangedSpy = sinon.spy(element, 'paramsChanged');
element.params = {
- view: GerritNav.View.DIFF,
+ view: GerritView.DIFF,
changeNum: 42 as NumericChangeId,
patchNum: 2 as RevisionPatchSetNum,
basePatchNum: 1 as BasePatchSetNum,
@@ -213,7 +212,7 @@
discardedDrafts: [],
});
element.params = {
- view: GerritNav.View.DIFF,
+ view: GerritView.DIFF,
changeNum: 42 as NumericChangeId,
commentLink: true,
commentId: 'c1' as UrlEncodedCommentId,
@@ -258,7 +257,7 @@
sinon.stub(element, 'initPatchRange');
sinon.stub(element, 'fetchFiles');
element.params = {
- view: GerritNav.View.DIFF,
+ view: GerritView.DIFF,
changeNum: 42 as NumericChangeId,
patchNum: 2 as RevisionPatchSetNum,
basePatchNum: 1 as BasePatchSetNum,
@@ -301,7 +300,7 @@
loadingStatus: LoadingStatus.LOADED,
});
element.params = {
- view: GerritNav.View.DIFF,
+ view: GerritView.DIFF,
changeNum: 42 as NumericChangeId,
path: '/COMMIT_MSG',
commentLink: true,
@@ -353,7 +352,7 @@
loadingStatus: LoadingStatus.LOADED,
});
element.params = {
- view: GerritNav.View.DIFF,
+ view: GerritView.DIFF,
changeNum: 42 as NumericChangeId,
path: '/COMMIT_MSG',
commentLink: true,
@@ -435,7 +434,7 @@
sinon.stub(element, 'isFileUnchanged').returns(false);
const toastStub = sinon.stub(element, 'displayDiffBaseAgainstLeftToast');
element.params = {
- view: GerritNav.View.DIFF,
+ view: GerritView.DIFF,
changeNum: 42 as NumericChangeId,
project: 'p' as RepoName,
commentId: 'c1' as UrlEncodedCommentId,
@@ -475,146 +474,154 @@
element.path = 'glados.txt';
element.loggedIn = true;
await element.updateComplete;
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div class="stickyHeader">
- <h1 class="assistive-tech-only">Diff of glados.txt</h1>
- <header>
- <div>
- <a href=""> 42 </a>
- <span class="changeNumberColon"> : </span>
- <span class="headerSubject"> Test subject </span>
- <input
- aria-label="file reviewed"
- class="hideOnEdit reviewed"
- id="reviewed"
- title="Toggle reviewed status of file"
- type="checkbox"
- />
- <div class="jumpToFileContainer">
- <gr-dropdown-list id="dropdown" show-copy-for-trigger-text="">
- </gr-dropdown-list>
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div class="stickyHeader">
+ <h1 class="assistive-tech-only">Diff of glados.txt</h1>
+ <header>
+ <div>
+ <a href=""> 42 </a>
+ <span class="changeNumberColon"> : </span>
+ <span class="headerSubject"> Test subject </span>
+ <input
+ aria-label="file reviewed"
+ class="hideOnEdit reviewed"
+ id="reviewed"
+ title="Toggle reviewed status of file"
+ type="checkbox"
+ />
+ <div class="jumpToFileContainer">
+ <gr-dropdown-list id="dropdown" show-copy-for-trigger-text="">
+ </gr-dropdown-list>
+ </div>
</div>
- </div>
- <div class="desktop navLinks">
- <span class="fileNum show">
- File 2 of 3
- <span class="separator"> </span>
- </span>
- <a
- class="navLink"
- href=""
- title="Go to previous file (shortcut: [)"
- >
- Prev
- </a>
- <span class="separator"> </span>
- <a class="navLink" href="" title="Up to change (shortcut: u)">
- Up
- </a>
- <span class="separator"> </span>
- <a class="navLink" href="" title="Go to next file (shortcut: ])">
- Next
- </a>
- </div>
- </header>
- <div class="subHeader">
- <div class="patchRangeLeft">
- <gr-patch-range-select id="rangeSelect"> </gr-patch-range-select>
- <span class="desktop download">
- <span class="separator"> </span>
- <gr-dropdown down-arrow="" horizontal-align="left" link="">
- <span class="downloadTitle"> Download </span>
- </gr-dropdown>
- </span>
- </div>
- <div class="rightControls">
- <span class="blameLoader show">
- <gr-button
- aria-disabled="false"
- id="toggleBlame"
- link=""
- role="button"
- tabindex="0"
- title="Toggle blame (shortcut: b)"
+ <div class="desktop navLinks">
+ <span class="fileNum show">
+ File 2 of 3
+ <span class="separator"> </span>
+ </span>
+ <a
+ class="navLink"
+ href=""
+ title="Go to previous file (shortcut: [)"
>
- Show blame
- </gr-button>
- </span>
- <span class="separator"> </span>
- <span class="editButton">
- <gr-button
- aria-disabled="false"
- link=""
- role="button"
- tabindex="0"
- title="Edit current file"
+ Prev
+ </a>
+ <span class="separator"> </span>
+ <a class="navLink" href="" title="Up to change (shortcut: u)">
+ Up
+ </a>
+ <span class="separator"> </span>
+ <a
+ class="navLink"
+ href=""
+ title="Go to next file (shortcut: ])"
>
- edit
- </gr-button>
- </span>
- <span class="separator"> </span>
- <div class="diffModeSelector">
- <span> Diff view: </span>
- <gr-diff-mode-selector id="modeSelect" show-tooltip-below="">
- </gr-diff-mode-selector>
+ Next
+ </a>
</div>
- <span id="diffPrefsContainer">
- <span class="desktop preferences">
- <gr-tooltip-content
- has-tooltip=""
- position-below=""
- title="Diff preferences"
+ </header>
+ <div class="subHeader">
+ <div class="patchRangeLeft">
+ <gr-patch-range-select id="rangeSelect">
+ </gr-patch-range-select>
+ <span class="desktop download">
+ <span class="separator"> </span>
+ <gr-dropdown down-arrow="" horizontal-align="left" link="">
+ <span class="downloadTitle"> Download </span>
+ </gr-dropdown>
+ </span>
+ </div>
+ <div class="rightControls">
+ <span class="blameLoader show">
+ <gr-button
+ aria-disabled="false"
+ id="toggleBlame"
+ link=""
+ role="button"
+ tabindex="0"
+ title="Toggle blame (shortcut: b)"
>
- <gr-button
- aria-disabled="false"
- class="prefsButton"
- link=""
- role="button"
- tabindex="0"
+ Show blame
+ </gr-button>
+ </span>
+ <span class="separator"> </span>
+ <span class="editButton">
+ <gr-button
+ aria-disabled="false"
+ link=""
+ role="button"
+ tabindex="0"
+ title="Edit current file"
+ >
+ edit
+ </gr-button>
+ </span>
+ <span class="separator"> </span>
+ <div class="diffModeSelector">
+ <span> Diff view: </span>
+ <gr-diff-mode-selector id="modeSelect" show-tooltip-below="">
+ </gr-diff-mode-selector>
+ </div>
+ <span id="diffPrefsContainer">
+ <span class="desktop preferences">
+ <gr-tooltip-content
+ has-tooltip=""
+ position-below=""
+ title="Diff preferences"
>
- <gr-icon icon="settings" filled></gr-icon>
- </gr-button>
- </gr-tooltip-content>
+ <gr-button
+ aria-disabled="false"
+ class="prefsButton"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ <gr-icon icon="settings" filled></gr-icon>
+ </gr-button>
+ </gr-tooltip-content>
+ </span>
</span>
- </span>
- <gr-endpoint-decorator name="annotation-toggler">
- <span hidden="" id="annotation-span">
- <label for="annotation-checkbox" id="annotation-label">
- </label>
- <iron-input>
- <input
- disabled=""
- id="annotation-checkbox"
- is="iron-input"
- type="checkbox"
- value=""
- />
- </iron-input>
- </span>
- </gr-endpoint-decorator>
+ <gr-endpoint-decorator name="annotation-toggler">
+ <span hidden="" id="annotation-span">
+ <label for="annotation-checkbox" id="annotation-label">
+ </label>
+ <iron-input>
+ <input
+ disabled=""
+ id="annotation-checkbox"
+ is="iron-input"
+ type="checkbox"
+ value=""
+ />
+ </iron-input>
+ </span>
+ </gr-endpoint-decorator>
+ </div>
+ </div>
+ <div class="fileNav mobile">
+ <a class="mobileNavLink" href=""> < </a>
+ <div class="fullFileName mobile">glados.txt</div>
+ <a class="mobileNavLink" href=""> > </a>
</div>
</div>
- <div class="fileNav mobile">
- <a class="mobileNavLink" href=""> < </a>
- <div class="fullFileName mobile">glados.txt</div>
- <a class="mobileNavLink" href=""> > </a>
- </div>
- </div>
- <div class="loading">Loading...</div>
- <h2 class="assistive-tech-only">Diff view</h2>
- <gr-diff-host hidden="" id="diffHost"> </gr-diff-host>
- <gr-apply-fix-dialog id="applyFixDialog"> </gr-apply-fix-dialog>
- <gr-diff-preferences-dialog id="diffPreferencesDialog">
- </gr-diff-preferences-dialog>
- <gr-overlay
- aria-hidden="true"
- id="downloadOverlay"
- style="outline: none; display: none;"
- >
- <gr-download-dialog id="downloadDialog" role="dialog">
- </gr-download-dialog>
- </gr-overlay>
- `);
+ <div class="loading">Loading...</div>
+ <h2 class="assistive-tech-only">Diff view</h2>
+ <gr-diff-host hidden="" id="diffHost"> </gr-diff-host>
+ <gr-apply-fix-dialog id="applyFixDialog"> </gr-apply-fix-dialog>
+ <gr-diff-preferences-dialog id="diffPreferencesDialog">
+ </gr-diff-preferences-dialog>
+ <gr-overlay
+ aria-hidden="true"
+ id="downloadOverlay"
+ style="outline: none; display: none;"
+ >
+ <gr-download-dialog id="downloadDialog" role="dialog">
+ </gr-download-dialog>
+ </gr-overlay>
+ `
+ );
});
test('keyboard shortcuts', async () => {
@@ -1765,14 +1772,14 @@
const callCount = saveReviewedStub.callCount;
element.params = {
- view: GerritNav.View.CHANGE,
+ view: GerritView.CHANGE,
changeNum: 42 as NumericChangeId,
project: 'test' as RepoName,
};
await element.updateComplete;
// saveReviewedState observer observes params, but should not fire when
- // view !== GerritNav.View.DIFF.
+ // view !== GerritView.DIFF.
assert.equal(saveReviewedStub.callCount, callCount);
});
@@ -1800,7 +1807,7 @@
element.loggedIn = true;
element.params = {
- view: GerritNav.View.DIFF,
+ view: GerritView.DIFF,
changeNum: 42 as NumericChangeId,
patchNum: 2 as RevisionPatchSetNum,
basePatchNum: 1 as BasePatchSetNum,
@@ -1888,7 +1895,7 @@
test('uses the patchNum and basePatchNum ', async () => {
element.params = {
- view: GerritNav.View.DIFF,
+ view: GerritView.DIFF,
changeNum: 42 as NumericChangeId,
patchNum: 4 as RevisionPatchSetNum,
basePatchNum: 2 as BasePatchSetNum,
@@ -1905,7 +1912,7 @@
test('uses the parent when there is no base patch num ', async () => {
element.params = {
- view: GerritNav.View.DIFF,
+ view: GerritView.DIFF,
changeNum: 42 as NumericChangeId,
patchNum: 5 as RevisionPatchSetNum,
path: '/COMMIT_MSG',
@@ -2457,7 +2464,7 @@
// Load file1
element.params = {
- view: GerritNav.View.DIFF,
+ view: GerritView.DIFF,
patchNum: 1 as RevisionPatchSetNum,
changeNum: 101 as NumericChangeId,
project: 'test-project' as RepoName,
@@ -2482,7 +2489,7 @@
// This is to mock the param change triggered by above navigate
element.params = {
- view: GerritNav.View.DIFF,
+ view: GerritView.DIFF,
patchNum: 1 as RevisionPatchSetNum,
changeNum: 101 as NumericChangeId,
project: 'test-project' as RepoName,
@@ -2618,7 +2625,8 @@
suite('unmodified files with comments', () => {
let element: GrDiffView;
- setup(() => {
+
+ setup(async () => {
const changedFiles = {
'file1.txt': createFileInfo(),
'a/b/test.c': createFileInfo(),
@@ -2631,7 +2639,7 @@
stubRestApi('getDiffRobotComments').returns(Promise.resolve({}));
stubRestApi('getDiffDrafts').returns(Promise.resolve({}));
stubRestApi('getReviewedFiles').returns(Promise.resolve([]));
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-diff-view></gr-diff-view>`);
element.changeNum = 42 as NumericChangeId;
});
diff --git a/polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select_test.ts b/polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select_test.ts
index 2fe3de0..c4b2a60 100644
--- a/polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select_test.ts
+++ b/polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select_test.ts
@@ -35,8 +35,7 @@
} from '../../shared/gr-dropdown-list/gr-dropdown-list';
import {queryAndAssert} from '../../../test/test-utils';
import {fire} from '../../../utils/event-util';
-
-const basicFixture = fixtureFromElement('gr-patch-range-select');
+import {fixture, html} from '@open-wc/testing';
type RevIdToRevisionInfo = {
[revisionId: string]: RevisionInfo | EditRevisionInfo;
@@ -60,7 +59,9 @@
// Element must be wrapped in an element with direct access to the
// comment API.
- element = basicFixture.instantiate();
+ element = await fixture(
+ html`<gr-patch-range-select></gr-patch-range-select>`
+ );
// Stub methods on the changeComments object after changeComments has
// been initialized.
diff --git a/polygerrit-ui/app/elements/documentation/gr-documentation-search/gr-documentation-search_test.ts b/polygerrit-ui/app/elements/documentation/gr-documentation-search/gr-documentation-search_test.ts
index a902dc4..221886a 100644
--- a/polygerrit-ui/app/elements/documentation/gr-documentation-search/gr-documentation-search_test.ts
+++ b/polygerrit-ui/app/elements/documentation/gr-documentation-search/gr-documentation-search_test.ts
@@ -9,8 +9,7 @@
import {page} from '../../../utils/page-wrapper-utils';
import {queryAndAssert, stubRestApi} from '../../../test/test-utils';
import {DocResult} from '../../../types/common';
-
-const basicFixture = fixtureFromElement('gr-documentation-search');
+import {fixture, html} from '@open-wc/testing';
function documentationGenerator(counter: number) {
return {
@@ -33,8 +32,9 @@
setup(async () => {
sinon.stub(page, 'show');
- element = basicFixture.instantiate();
- await element.updateComplete;
+ element = await fixture(
+ html`<gr-documentation-search></gr-documentation-search>`
+ );
});
suite('list with searches for documentation', () => {
@@ -59,258 +59,261 @@
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <gr-list-view>
- <table class="genericList" id="list">
- <tbody>
- <tr class="headerRow">
- <th class="name topHeader">Name</th>
- <th class="name topHeader"></th>
- <th class="name topHeader"></th>
- </tr>
- <tr class="loadingMsg" id="loading">
- <td>Loading...</td>
- </tr>
- </tbody>
- <tbody>
- <tr class="table">
- <td class="name">
- <a href="/Documentation/dev-rest-api.html">
- Gerrit Code Review - REST API Developers Notes0
- </a>
- </td>
- <td></td>
- <td></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/Documentation/dev-rest-api.html">
- Gerrit Code Review - REST API Developers Notes1
- </a>
- </td>
- <td></td>
- <td></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/Documentation/dev-rest-api.html">
- Gerrit Code Review - REST API Developers Notes2
- </a>
- </td>
- <td></td>
- <td></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/Documentation/dev-rest-api.html">
- Gerrit Code Review - REST API Developers Notes3
- </a>
- </td>
- <td></td>
- <td></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/Documentation/dev-rest-api.html">
- Gerrit Code Review - REST API Developers Notes4
- </a>
- </td>
- <td></td>
- <td></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/Documentation/dev-rest-api.html">
- Gerrit Code Review - REST API Developers Notes5
- </a>
- </td>
- <td></td>
- <td></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/Documentation/dev-rest-api.html">
- Gerrit Code Review - REST API Developers Notes6
- </a>
- </td>
- <td></td>
- <td></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/Documentation/dev-rest-api.html">
- Gerrit Code Review - REST API Developers Notes7
- </a>
- </td>
- <td></td>
- <td></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/Documentation/dev-rest-api.html">
- Gerrit Code Review - REST API Developers Notes8
- </a>
- </td>
- <td></td>
- <td></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/Documentation/dev-rest-api.html">
- Gerrit Code Review - REST API Developers Notes9
- </a>
- </td>
- <td></td>
- <td></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/Documentation/dev-rest-api.html">
- Gerrit Code Review - REST API Developers Notes10
- </a>
- </td>
- <td></td>
- <td></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/Documentation/dev-rest-api.html">
- Gerrit Code Review - REST API Developers Notes11
- </a>
- </td>
- <td></td>
- <td></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/Documentation/dev-rest-api.html">
- Gerrit Code Review - REST API Developers Notes12
- </a>
- </td>
- <td></td>
- <td></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/Documentation/dev-rest-api.html">
- Gerrit Code Review - REST API Developers Notes13
- </a>
- </td>
- <td></td>
- <td></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/Documentation/dev-rest-api.html">
- Gerrit Code Review - REST API Developers Notes14
- </a>
- </td>
- <td></td>
- <td></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/Documentation/dev-rest-api.html">
- Gerrit Code Review - REST API Developers Notes15
- </a>
- </td>
- <td></td>
- <td></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/Documentation/dev-rest-api.html">
- Gerrit Code Review - REST API Developers Notes16
- </a>
- </td>
- <td></td>
- <td></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/Documentation/dev-rest-api.html">
- Gerrit Code Review - REST API Developers Notes17
- </a>
- </td>
- <td></td>
- <td></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/Documentation/dev-rest-api.html">
- Gerrit Code Review - REST API Developers Notes18
- </a>
- </td>
- <td></td>
- <td></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/Documentation/dev-rest-api.html">
- Gerrit Code Review - REST API Developers Notes19
- </a>
- </td>
- <td></td>
- <td></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/Documentation/dev-rest-api.html">
- Gerrit Code Review - REST API Developers Notes20
- </a>
- </td>
- <td></td>
- <td></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/Documentation/dev-rest-api.html">
- Gerrit Code Review - REST API Developers Notes21
- </a>
- </td>
- <td></td>
- <td></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/Documentation/dev-rest-api.html">
- Gerrit Code Review - REST API Developers Notes22
- </a>
- </td>
- <td></td>
- <td></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/Documentation/dev-rest-api.html">
- Gerrit Code Review - REST API Developers Notes23
- </a>
- </td>
- <td></td>
- <td></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/Documentation/dev-rest-api.html">
- Gerrit Code Review - REST API Developers Notes24
- </a>
- </td>
- <td></td>
- <td></td>
- </tr>
- <tr class="table">
- <td class="name">
- <a href="/Documentation/dev-rest-api.html">
- Gerrit Code Review - REST API Developers Notes25
- </a>
- </td>
- <td></td>
- <td></td>
- </tr>
- </tbody>
- </table>
- </gr-list-view>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <gr-list-view>
+ <table class="genericList" id="list">
+ <tbody>
+ <tr class="headerRow">
+ <th class="name topHeader">Name</th>
+ <th class="name topHeader"></th>
+ <th class="name topHeader"></th>
+ </tr>
+ <tr class="loadingMsg" id="loading">
+ <td>Loading...</td>
+ </tr>
+ </tbody>
+ <tbody>
+ <tr class="table">
+ <td class="name">
+ <a href="/Documentation/dev-rest-api.html">
+ Gerrit Code Review - REST API Developers Notes0
+ </a>
+ </td>
+ <td></td>
+ <td></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/Documentation/dev-rest-api.html">
+ Gerrit Code Review - REST API Developers Notes1
+ </a>
+ </td>
+ <td></td>
+ <td></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/Documentation/dev-rest-api.html">
+ Gerrit Code Review - REST API Developers Notes2
+ </a>
+ </td>
+ <td></td>
+ <td></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/Documentation/dev-rest-api.html">
+ Gerrit Code Review - REST API Developers Notes3
+ </a>
+ </td>
+ <td></td>
+ <td></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/Documentation/dev-rest-api.html">
+ Gerrit Code Review - REST API Developers Notes4
+ </a>
+ </td>
+ <td></td>
+ <td></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/Documentation/dev-rest-api.html">
+ Gerrit Code Review - REST API Developers Notes5
+ </a>
+ </td>
+ <td></td>
+ <td></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/Documentation/dev-rest-api.html">
+ Gerrit Code Review - REST API Developers Notes6
+ </a>
+ </td>
+ <td></td>
+ <td></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/Documentation/dev-rest-api.html">
+ Gerrit Code Review - REST API Developers Notes7
+ </a>
+ </td>
+ <td></td>
+ <td></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/Documentation/dev-rest-api.html">
+ Gerrit Code Review - REST API Developers Notes8
+ </a>
+ </td>
+ <td></td>
+ <td></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/Documentation/dev-rest-api.html">
+ Gerrit Code Review - REST API Developers Notes9
+ </a>
+ </td>
+ <td></td>
+ <td></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/Documentation/dev-rest-api.html">
+ Gerrit Code Review - REST API Developers Notes10
+ </a>
+ </td>
+ <td></td>
+ <td></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/Documentation/dev-rest-api.html">
+ Gerrit Code Review - REST API Developers Notes11
+ </a>
+ </td>
+ <td></td>
+ <td></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/Documentation/dev-rest-api.html">
+ Gerrit Code Review - REST API Developers Notes12
+ </a>
+ </td>
+ <td></td>
+ <td></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/Documentation/dev-rest-api.html">
+ Gerrit Code Review - REST API Developers Notes13
+ </a>
+ </td>
+ <td></td>
+ <td></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/Documentation/dev-rest-api.html">
+ Gerrit Code Review - REST API Developers Notes14
+ </a>
+ </td>
+ <td></td>
+ <td></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/Documentation/dev-rest-api.html">
+ Gerrit Code Review - REST API Developers Notes15
+ </a>
+ </td>
+ <td></td>
+ <td></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/Documentation/dev-rest-api.html">
+ Gerrit Code Review - REST API Developers Notes16
+ </a>
+ </td>
+ <td></td>
+ <td></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/Documentation/dev-rest-api.html">
+ Gerrit Code Review - REST API Developers Notes17
+ </a>
+ </td>
+ <td></td>
+ <td></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/Documentation/dev-rest-api.html">
+ Gerrit Code Review - REST API Developers Notes18
+ </a>
+ </td>
+ <td></td>
+ <td></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/Documentation/dev-rest-api.html">
+ Gerrit Code Review - REST API Developers Notes19
+ </a>
+ </td>
+ <td></td>
+ <td></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/Documentation/dev-rest-api.html">
+ Gerrit Code Review - REST API Developers Notes20
+ </a>
+ </td>
+ <td></td>
+ <td></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/Documentation/dev-rest-api.html">
+ Gerrit Code Review - REST API Developers Notes21
+ </a>
+ </td>
+ <td></td>
+ <td></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/Documentation/dev-rest-api.html">
+ Gerrit Code Review - REST API Developers Notes22
+ </a>
+ </td>
+ <td></td>
+ <td></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/Documentation/dev-rest-api.html">
+ Gerrit Code Review - REST API Developers Notes23
+ </a>
+ </td>
+ <td></td>
+ <td></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/Documentation/dev-rest-api.html">
+ Gerrit Code Review - REST API Developers Notes24
+ </a>
+ </td>
+ <td></td>
+ <td></td>
+ </tr>
+ <tr class="table">
+ <td class="name">
+ <a href="/Documentation/dev-rest-api.html">
+ Gerrit Code Review - REST API Developers Notes25
+ </a>
+ </td>
+ <td></td>
+ <td></td>
+ </tr>
+ </tbody>
+ </table>
+ </gr-list-view>
+ `
+ );
});
});
diff --git a/polygerrit-ui/app/elements/edit/gr-default-editor/gr-default-editor_test.ts b/polygerrit-ui/app/elements/edit/gr-default-editor/gr-default-editor_test.ts
index bd69c7f..39c74ee 100644
--- a/polygerrit-ui/app/elements/edit/gr-default-editor/gr-default-editor_test.ts
+++ b/polygerrit-ui/app/elements/edit/gr-default-editor/gr-default-editor_test.ts
@@ -7,22 +7,22 @@
import './gr-default-editor';
import {GrDefaultEditor} from './gr-default-editor';
import {mockPromise, queryAndAssert} from '../../../test/test-utils';
-
-const basicFixture = fixtureFromElement('gr-default-editor');
+import {fixture, html} from '@open-wc/testing';
suite('gr-default-editor tests', () => {
let element: GrDefaultEditor;
setup(async () => {
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-default-editor></gr-default-editor>`);
element.fileContent = '';
await flush();
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <textarea id="textarea"></textarea>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ ' <textarea id="textarea"></textarea> '
+ );
});
test('fires content-change event', async () => {
diff --git a/polygerrit-ui/app/elements/edit/gr-edit-controls/gr-edit-controls_test.ts b/polygerrit-ui/app/elements/edit/gr-edit-controls/gr-edit-controls_test.ts
index 7c1a0ab..7605e41 100644
--- a/polygerrit-ui/app/elements/edit/gr-edit-controls/gr-edit-controls_test.ts
+++ b/polygerrit-ui/app/elements/edit/gr-edit-controls/gr-edit-controls_test.ts
@@ -19,7 +19,7 @@
import {RepoName} from '../../../api/rest-api';
import {queryAndAssert} from '../../../test/test-utils';
import * as MockInteractions from '@polymer/iron-test-helpers/mock-interactions';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import {GrButton} from '../../shared/gr-button/gr-button';
import '../../shared/gr-dialog/gr-dialog';
@@ -45,140 +45,143 @@
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <gr-button
- aria-disabled="false"
- id="open"
- link=""
- role="button"
- tabindex="0"
- >
- Add/Open/Upload
- </gr-button>
- <gr-button
- aria-disabled="false"
- id="delete"
- link=""
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- <gr-button
- aria-disabled="false"
- id="rename"
- link=""
- role="button"
- tabindex="0"
- >
- Rename
- </gr-button>
- <gr-button
- aria-disabled="false"
- class="invisible"
- id="restore"
- link=""
- role="button"
- tabindex="0"
- >
- Restore
- </gr-button>
- <gr-overlay
- aria-hidden="true"
- id="overlay"
- style="outline: none; display: none;"
- tabindex="-1"
- with-backdrop=""
- >
- <gr-dialog
- class="dialog invisible"
- confirm-label="Confirm"
- confirm-on-enter=""
- disabled=""
- id="openDialog"
- role="dialog"
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <gr-button
+ aria-disabled="false"
+ id="open"
+ link=""
+ role="button"
+ tabindex="0"
>
- <div class="header" slot="header">
- Add a new file or open an existing file
- </div>
- <div class="main" slot="main">
- <gr-autocomplete
- placeholder="Enter an existing or new full file path."
- >
- </gr-autocomplete>
- <div contenteditable="true" id="dragDropArea">
- <p>Drag and drop a file here</p>
- <p>or</p>
- <p>
- <iron-input>
- <input
- hidden=""
- id="fileUploadInput"
- multiple=""
- type="file"
- />
- </iron-input>
- <label for="fileUploadInput">
- <gr-button
- aria-disabled="false"
- id="fileUploadBrowse"
- role="button"
- tabindex="0"
- >
- Browse
- </gr-button>
- </label>
- </p>
+ Add/Open/Upload
+ </gr-button>
+ <gr-button
+ aria-disabled="false"
+ id="delete"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Delete
+ </gr-button>
+ <gr-button
+ aria-disabled="false"
+ id="rename"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Rename
+ </gr-button>
+ <gr-button
+ aria-disabled="false"
+ class="invisible"
+ id="restore"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Restore
+ </gr-button>
+ <gr-overlay
+ aria-hidden="true"
+ id="overlay"
+ style="outline: none; display: none;"
+ tabindex="-1"
+ with-backdrop=""
+ >
+ <gr-dialog
+ class="dialog invisible"
+ confirm-label="Confirm"
+ confirm-on-enter=""
+ disabled=""
+ id="openDialog"
+ role="dialog"
+ >
+ <div class="header" slot="header">
+ Add a new file or open an existing file
</div>
- </div>
- </gr-dialog>
- <gr-dialog
- class="dialog invisible"
- confirm-label="Delete"
- confirm-on-enter=""
- disabled=""
- id="deleteDialog"
- role="dialog"
- >
- <div class="header" slot="header">Delete a file from the repo</div>
- <div class="main" slot="main">
- <gr-autocomplete placeholder="Enter an existing full file path.">
- </gr-autocomplete>
- </div>
- </gr-dialog>
- <gr-dialog
- class="dialog invisible"
- confirm-label="Rename"
- confirm-on-enter=""
- disabled=""
- id="renameDialog"
- role="dialog"
- >
- <div class="header" slot="header">Rename a file in the repo</div>
- <div class="main" slot="main">
- <gr-autocomplete placeholder="Enter an existing full file path.">
- </gr-autocomplete>
- <iron-input id="newPathIronInput">
- <input id="newPathInput" placeholder="Enter the new path." />
- </iron-input>
- </div>
- </gr-dialog>
- <gr-dialog
- class="dialog invisible"
- confirm-label="Restore"
- confirm-on-enter=""
- id="restoreDialog"
- role="dialog"
- >
- <div class="header" slot="header">Restore this file?</div>
- <div class="main" slot="main">
- <iron-input>
- <input />
- </iron-input>
- </div>
- </gr-dialog>
- </gr-overlay>
- `);
+ <div class="main" slot="main">
+ <gr-autocomplete
+ placeholder="Enter an existing or new full file path."
+ >
+ </gr-autocomplete>
+ <div contenteditable="true" id="dragDropArea">
+ <p>Drag and drop a file here</p>
+ <p>or</p>
+ <p>
+ <iron-input>
+ <input
+ hidden=""
+ id="fileUploadInput"
+ multiple=""
+ type="file"
+ />
+ </iron-input>
+ <label for="fileUploadInput">
+ <gr-button
+ aria-disabled="false"
+ id="fileUploadBrowse"
+ role="button"
+ tabindex="0"
+ >
+ Browse
+ </gr-button>
+ </label>
+ </p>
+ </div>
+ </div>
+ </gr-dialog>
+ <gr-dialog
+ class="dialog invisible"
+ confirm-label="Delete"
+ confirm-on-enter=""
+ disabled=""
+ id="deleteDialog"
+ role="dialog"
+ >
+ <div class="header" slot="header">Delete a file from the repo</div>
+ <div class="main" slot="main">
+ <gr-autocomplete placeholder="Enter an existing full file path.">
+ </gr-autocomplete>
+ </div>
+ </gr-dialog>
+ <gr-dialog
+ class="dialog invisible"
+ confirm-label="Rename"
+ confirm-on-enter=""
+ disabled=""
+ id="renameDialog"
+ role="dialog"
+ >
+ <div class="header" slot="header">Rename a file in the repo</div>
+ <div class="main" slot="main">
+ <gr-autocomplete placeholder="Enter an existing full file path.">
+ </gr-autocomplete>
+ <iron-input id="newPathIronInput">
+ <input id="newPathInput" placeholder="Enter the new path." />
+ </iron-input>
+ </div>
+ </gr-dialog>
+ <gr-dialog
+ class="dialog invisible"
+ confirm-label="Restore"
+ confirm-on-enter=""
+ id="restoreDialog"
+ role="dialog"
+ >
+ <div class="header" slot="header">Restore this file?</div>
+ <div class="main" slot="main">
+ <iron-input>
+ <input />
+ </iron-input>
+ </div>
+ </gr-dialog>
+ </gr-overlay>
+ `
+ );
});
test('all actions exist', () => {
diff --git a/polygerrit-ui/app/elements/edit/gr-edit-file-controls/gr-edit-file-controls_test.ts b/polygerrit-ui/app/elements/edit/gr-edit-file-controls/gr-edit-file-controls_test.ts
index c6d7117..90b6d93 100644
--- a/polygerrit-ui/app/elements/edit/gr-edit-file-controls/gr-edit-file-controls_test.ts
+++ b/polygerrit-ui/app/elements/edit/gr-edit-file-controls/gr-edit-file-controls_test.ts
@@ -10,8 +10,7 @@
import {queryAndAssert} from '../../../test/test-utils';
import {GrDropdown} from '../../shared/gr-dropdown/gr-dropdown';
import * as MockInteractions from '@polymer/iron-test-helpers/mock-interactions';
-
-const basicFixture = fixtureFromElement('gr-edit-file-controls');
+import {fixture, html} from '@open-wc/testing';
suite('gr-edit-file-controls tests', () => {
let element: GrEditFileControls;
@@ -19,18 +18,23 @@
let fileActionHandler: sinon.SinonStub;
setup(async () => {
- element = basicFixture.instantiate();
+ element = await fixture(
+ html`<gr-edit-file-controls></gr-edit-file-controls>`
+ );
fileActionHandler = sinon.stub();
element.addEventListener('file-action-tap', fileActionHandler);
await element.updateComplete;
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <gr-dropdown down-arrow="" id="actions" link="" vertical-offset="20">
- Actions
- </gr-dropdown>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <gr-dropdown down-arrow="" id="actions" link="" vertical-offset="20">
+ Actions
+ </gr-dropdown>
+ `
+ );
});
test('open tap emits event', async () => {
diff --git a/polygerrit-ui/app/elements/edit/gr-editor-view/gr-editor-view.ts b/polygerrit-ui/app/elements/edit/gr-editor-view/gr-editor-view.ts
index e3314a2..0980ebb 100644
--- a/polygerrit-ui/app/elements/edit/gr-editor-view/gr-editor-view.ts
+++ b/polygerrit-ui/app/elements/edit/gr-editor-view/gr-editor-view.ts
@@ -16,6 +16,7 @@
Base64FileContent,
NumericChangeId,
EDIT,
+ PatchSetNumber,
} from '../../../types/common';
import {ParsedChangeInfo} from '../../../types/types';
import {HttpMethod, NotifyType} from '../../../constants/constants';
@@ -27,10 +28,13 @@
import {changeIsMerged, changeIsAbandoned} from '../../../utils/change-util';
import {addShortcut, Modifier} from '../../../utils/dom-util';
import {sharedStyles} from '../../../styles/shared-styles';
-import {LitElement, PropertyValues, html, css} from 'lit';
+import {LitElement, PropertyValues, html, css, nothing} from 'lit';
import {customElement, property, state} from 'lit/decorators.js';
import {subscribe} from '../../lit/subscription-controller';
import {GenerateUrlEditViewParameters} from '../../../utils/router-util';
+import {GerritView} from '../../../services/router/router-model';
+import {resolve} from '../../../models/dependency';
+import {changeModelToken} from '../../../models/change/change-model';
const RESTORED_MESSAGE = 'Content restored from a previous edit.';
const SAVING_MESSAGE = 'Saving changes...';
@@ -89,6 +93,8 @@
@state() private lineNum?: number;
+ @state() private latestPatchsetNumber?: PatchSetNumber;
+
private readonly restApiService = getAppContext().restApiService;
private readonly storage = getAppContext().storageService;
@@ -97,6 +103,8 @@
private readonly userModel = getAppContext().userModel;
+ private readonly getChangeModel = resolve(this, changeModelToken);
+
// Tests use this so needs to be non private
storeTask?: DelayedTask;
@@ -115,6 +123,11 @@
this.editPrefs = editPreferences;
}
);
+ subscribe(
+ this,
+ () => this.getChangeModel().latestPatchNum$,
+ x => (this.latestPatchsetNumber = x)
+ );
}
override connectedCallback() {
@@ -192,6 +205,9 @@
.rightControls {
justify-content: flex-end;
}
+ .warning {
+ color: var(--error-text-color);
+ }
`,
];
}
@@ -206,6 +222,7 @@
<header>
<span class="controlGroup">
<span>Edit mode</span>
+ ${this.renderEditingOldPatchsetWarning()}
<span class="separator"></span>
<gr-editable-label
labelText="File path"
@@ -242,6 +259,12 @@
`;
}
+ private renderEditingOldPatchsetWarning() {
+ const patchset = this.params?.patchNum;
+ if (patchset === this.latestPatchsetNumber) return nothing;
+ return html`<span class="warning"> (Old Patchset)</span>`;
+ }
+
private renderEndpoint() {
return html`
<div class="textareaWrapper">
@@ -293,7 +316,7 @@
paramsChanged() {
if (!this.params) return;
- if (this.params.view !== GerritNav.View.EDIT) {
+ if (this.params.view !== GerritView.EDIT) {
return;
}
diff --git a/polygerrit-ui/app/elements/edit/gr-editor-view/gr-editor-view_test.ts b/polygerrit-ui/app/elements/edit/gr-editor-view/gr-editor-view_test.ts
index 48ce5ed8..57293d2 100644
--- a/polygerrit-ui/app/elements/edit/gr-editor-view/gr-editor-view_test.ts
+++ b/polygerrit-ui/app/elements/edit/gr-editor-view/gr-editor-view_test.ts
@@ -23,8 +23,7 @@
import {GrEndpointDecorator} from '../../plugins/gr-endpoint-decorator/gr-endpoint-decorator';
import {GrDefaultEditor} from '../gr-default-editor/gr-default-editor';
import {GrButton} from '../../shared/gr-button/gr-button';
-
-const basicFixture = fixtureFromElement('gr-editor-view');
+import {fixture, html} from '@open-wc/testing';
suite('gr-editor-view tests', () => {
let element: GrEditorView;
@@ -35,7 +34,7 @@
let navigateStub: sinon.SinonStub;
setup(async () => {
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-editor-view></gr-editor-view>`);
savePathStub = stubRestApi('renameFileInChangeEdit');
saveFileStub = stubRestApi('saveChangeEdit');
changeDetailStub = stubRestApi('getChangeDetail');
@@ -44,68 +43,71 @@
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div class="stickyHeader">
- <header>
- <span class="controlGroup">
- <span> Edit mode </span>
- <span class="separator"> </span>
- <gr-editable-label
- id="global"
- labeltext="File path"
- placeholder="File path..."
- tabindex="0"
- title="File path..."
- >
- </gr-editable-label>
- </span>
- <span class="controlGroup rightControls">
- <gr-button
- aria-disabled="false"
- id="close"
- link=""
- role="button"
- tabindex="0"
- >
- Cancel
- </gr-button>
- <gr-button
- aria-disabled="true"
- disabled=""
- id="save"
- link=""
- primary=""
- role="button"
- tabindex="-1"
- title="Save and Close the file"
- >
- Save
- </gr-button>
- <gr-button
- aria-disabled="true"
- disabled=""
- id="publish"
- link=""
- primary=""
- role="button"
- tabindex="-1"
- title="Publish your edit. A new patchset will be created."
- >
- Save & Publish
- </gr-button>
- </span>
- </header>
- </div>
- <div class="textareaWrapper">
- <gr-endpoint-decorator id="editorEndpoint" name="editor">
- <gr-endpoint-param name="fileContent"> </gr-endpoint-param>
- <gr-endpoint-param name="prefs"> </gr-endpoint-param>
- <gr-endpoint-param name="fileType"> </gr-endpoint-param>
- <gr-endpoint-param name="lineNum"> </gr-endpoint-param>
- <gr-default-editor id="file"> </gr-default-editor>
- </gr-endpoint-decorator>
- </div>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div class="stickyHeader">
+ <header>
+ <span class="controlGroup">
+ <span> Edit mode </span>
+ <span class="separator"> </span>
+ <gr-editable-label
+ id="global"
+ labeltext="File path"
+ placeholder="File path..."
+ tabindex="0"
+ title="File path..."
+ >
+ </gr-editable-label>
+ </span>
+ <span class="controlGroup rightControls">
+ <gr-button
+ aria-disabled="false"
+ id="close"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Cancel
+ </gr-button>
+ <gr-button
+ aria-disabled="true"
+ disabled=""
+ id="save"
+ link=""
+ primary=""
+ role="button"
+ tabindex="-1"
+ title="Save and Close the file"
+ >
+ Save
+ </gr-button>
+ <gr-button
+ aria-disabled="true"
+ disabled=""
+ id="publish"
+ link=""
+ primary=""
+ role="button"
+ tabindex="-1"
+ title="Publish your edit. A new patchset will be created."
+ >
+ Save & Publish
+ </gr-button>
+ </span>
+ </header>
+ </div>
+ <div class="textareaWrapper">
+ <gr-endpoint-decorator id="editorEndpoint" name="editor">
+ <gr-endpoint-param name="fileContent"> </gr-endpoint-param>
+ <gr-endpoint-param name="prefs"> </gr-endpoint-param>
+ <gr-endpoint-param name="fileType"> </gr-endpoint-param>
+ <gr-endpoint-param name="lineNum"> </gr-endpoint-param>
+ <gr-default-editor id="file"> </gr-default-editor>
+ </gr-endpoint-decorator>
+ </div>
+ `
+ );
});
suite('paramsChanged', () => {
diff --git a/polygerrit-ui/app/elements/gr-app_test.ts b/polygerrit-ui/app/elements/gr-app_test.ts
index 2b84344..6327ad2 100644
--- a/polygerrit-ui/app/elements/gr-app_test.ts
+++ b/polygerrit-ui/app/elements/gr-app_test.ts
@@ -6,8 +6,8 @@
import '../test/common-test-setup-karma';
import './gr-app';
import {getAppContext} from '../services/app-context';
-import {fixture, html} from '@open-wc/testing-helpers';
-import {queryAndAssert, stubRestApi} from '../test/test-utils';
+import {fixture, html} from '@open-wc/testing';
+import {queryAndAssert, stubElement, stubRestApi} from '../test/test-utils';
import {GrApp} from './gr-app';
import {
createAppElementChangeViewParams,
@@ -26,7 +26,7 @@
setup(async () => {
appStartedStub = sinon.stub(getAppContext().reportingService, 'appStarted');
- stub('gr-account-dropdown', '_getTopContent');
+ stubElement('gr-account-dropdown', '_getTopContent');
routerStartStub = sinon.stub(GrRouter.prototype, 'start');
stubRestApi('getAccount').returns(Promise.resolve(undefined));
stubRestApi('getAccountCapabilities').returns(Promise.resolve({}));
diff --git a/polygerrit-ui/app/elements/plugins/gr-attribute-helper/gr-attribute-helper_test.js b/polygerrit-ui/app/elements/plugins/gr-attribute-helper/gr-attribute-helper_test.js
index ae4cabc..c17fc5d 100644
--- a/polygerrit-ui/app/elements/plugins/gr-attribute-helper/gr-attribute-helper_test.js
+++ b/polygerrit-ui/app/elements/plugins/gr-attribute-helper/gr-attribute-helper_test.js
@@ -5,6 +5,8 @@
*/
import '../../../test/common-test-setup-karma.js';
import {Polymer} from '@polymer/polymer/lib/legacy/polymer-fn.js';
+// eslint-disable-next-line import/named
+import {fixture, html} from '@open-wc/testing';
Polymer({
is: 'gr-attribute-helper-some-element',
@@ -16,17 +18,24 @@
},
});
-const basicFixture = fixtureFromElement('gr-attribute-helper-some-element');
-
suite('gr-attribute-helper tests', () => {
let element;
let instance;
- setup(() => {
+ setup(async () => {
let plugin;
- window.Gerrit.install(p => { plugin = p; }, '0.1',
- 'http://test.com/plugins/testplugin/static/test.js');
- element = basicFixture.instantiate();
+ window.Gerrit.install(
+ p => {
+ plugin = p;
+ },
+ '0.1',
+ 'http://test.com/plugins/testplugin/static/test.js'
+ );
+ element = await fixture(
+ html`
+ <gr-attribute-helper-some-element></gr-attribute-helper-some-element>
+ `
+ );
instance = plugin.attributeHelper(element);
});
diff --git a/polygerrit-ui/app/elements/plugins/gr-endpoint-decorator/gr-endpoint-decorator_test.ts b/polygerrit-ui/app/elements/plugins/gr-endpoint-decorator/gr-endpoint-decorator_test.ts
index d7acc61..aba804c 100644
--- a/polygerrit-ui/app/elements/plugins/gr-endpoint-decorator/gr-endpoint-decorator_test.ts
+++ b/polygerrit-ui/app/elements/plugins/gr-endpoint-decorator/gr-endpoint-decorator_test.ts
@@ -7,7 +7,7 @@
import './gr-endpoint-decorator';
import '../gr-endpoint-param/gr-endpoint-param';
import '../gr-endpoint-slot/gr-endpoint-slot';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import {
mockPromise,
queryAndAssert,
diff --git a/polygerrit-ui/app/elements/plugins/gr-event-helper/gr-event-helper.ts b/polygerrit-ui/app/elements/plugins/gr-event-helper/gr-event-helper.ts
index ebe0e41..ecac9bc 100644
--- a/polygerrit-ui/app/elements/plugins/gr-event-helper/gr-event-helper.ts
+++ b/polygerrit-ui/app/elements/plugins/gr-event-helper/gr-event-helper.ts
@@ -31,10 +31,10 @@
*/
onClick(callback: (event: Event) => boolean) {
this.reporting.trackApi(this.plugin, 'event', 'onClick');
- return this._listen(this.element, callback);
+ return this.listen(this.element, callback);
}
- _listen(
+ private listen(
container: HTMLElement,
callback: (event: Event) => boolean
): UnsubscribeCallback {
diff --git a/polygerrit-ui/app/elements/plugins/gr-event-helper/gr-event-helper_test.js b/polygerrit-ui/app/elements/plugins/gr-event-helper/gr-event-helper_test.js
deleted file mode 100644
index e3f3835..0000000
--- a/polygerrit-ui/app/elements/plugins/gr-event-helper/gr-event-helper_test.js
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * @license
- * Copyright 2017 Google LLC
- * SPDX-License-Identifier: Apache-2.0
- */
-import '../../../test/common-test-setup-karma.js';
-import {addListener} from '@polymer/polymer/lib/utils/gestures.js';
-import {Polymer} from '@polymer/polymer/lib/legacy/polymer-fn.js';
-import {mockPromise} from '../../../test/test-utils.js';
-
-Polymer({
- is: 'gr-event-helper-some-element',
-
- properties: {
- fooBar: {
- type: Object,
- notify: true,
- },
- },
-});
-
-const basicFixture = fixtureFromElement('gr-event-helper-some-element');
-
-suite('gr-event-helper tests', () => {
- let element;
- let instance;
-
- setup(() => {
- let plugin;
- window.Gerrit.install(p => { plugin = p; }, '0.1',
- 'http://test.com/plugins/testplugin/static/test.js');
- element = basicFixture.instantiate();
- instance = plugin.eventHelper(element);
- });
-
- test('onTap()', async () => {
- const promise = mockPromise();
- instance.onTap(() => {
- promise.resolve();
- });
- MockInteractions.tap(element);
- await promise;
- });
-
- test('onTap() cancel', () => {
- const tapStub = sinon.stub();
- addListener(element.parentElement, 'tap', tapStub);
- instance.onTap(() => false);
- MockInteractions.tap(element);
- flush();
- assert.isFalse(tapStub.called);
- });
-
- test('onClick() cancel', () => {
- const tapStub = sinon.stub();
- element.parentElement.addEventListener('click', tapStub);
- instance.onTap(() => false);
- MockInteractions.tap(element);
- flush();
- assert.isFalse(tapStub.called);
- });
-});
-
diff --git a/polygerrit-ui/app/elements/plugins/gr-event-helper/gr-event-helper_test.ts b/polygerrit-ui/app/elements/plugins/gr-event-helper/gr-event-helper_test.ts
new file mode 100644
index 0000000..8eb450a
--- /dev/null
+++ b/polygerrit-ui/app/elements/plugins/gr-event-helper/gr-event-helper_test.ts
@@ -0,0 +1,88 @@
+/**
+ * @license
+ * Copyright 2017 Google LLC
+ * SPDX-License-Identifier: Apache-2.0
+ */
+import '../../../test/common-test-setup-karma';
+// eslint-disable-next-line import/named
+import {fixture, html} from '@open-wc/testing';
+import {PluginApi} from '../../../api/plugin';
+import {EventHelperPluginApi} from '../../../api/event-helper';
+
+suite('gr-event-helper tests', () => {
+ let element: HTMLDivElement;
+ let eventHelper: EventHelperPluginApi;
+
+ setup(async () => {
+ let plugin: PluginApi;
+ window.Gerrit.install(
+ p => (plugin = p),
+ '0.1',
+ 'http://test.com/plugins/testplugin/static/test.js'
+ );
+ element = await fixture(html`<div></div>`);
+ eventHelper = plugin!.eventHelper(element);
+ });
+
+ test('listens via onTap', async () => {
+ let parentReceivedClick = false;
+ element.parentElement!.addEventListener(
+ 'click',
+ () => (parentReceivedClick = true)
+ );
+ let helperReceivedClick = false;
+
+ eventHelper.onTap(() => {
+ helperReceivedClick = true;
+ return true;
+ });
+ element.click();
+
+ assert.isTrue(helperReceivedClick);
+ assert.isTrue(parentReceivedClick);
+ });
+
+ test('listens via onClick', async () => {
+ let parentReceivedClick = false;
+ element.parentElement!.addEventListener(
+ 'click',
+ () => (parentReceivedClick = true)
+ );
+ let helperReceivedClick = false;
+
+ eventHelper.onClick(() => {
+ helperReceivedClick = true;
+ return true;
+ });
+ element.click();
+
+ assert.isTrue(helperReceivedClick);
+ assert.isTrue(parentReceivedClick);
+ });
+
+ test('onTap false blocks event to parent', async () => {
+ let parentReceivedTap = false;
+ element.parentElement!.addEventListener(
+ 'tap',
+ () => (parentReceivedTap = true)
+ );
+
+ eventHelper.onTap(() => false);
+ element.click();
+
+ assert.isFalse(parentReceivedTap);
+ });
+
+ test('onClick false blocks event to parent', async () => {
+ let parentReceivedTap = false;
+ element.parentElement!.addEventListener(
+ 'tap',
+ () => (parentReceivedTap = true)
+ );
+
+ eventHelper.onClick(() => false);
+ element.click();
+
+ assert.isFalse(parentReceivedTap);
+ });
+});
diff --git a/polygerrit-ui/app/elements/plugins/gr-external-style/gr-external-style_test.ts b/polygerrit-ui/app/elements/plugins/gr-external-style/gr-external-style_test.ts
index 9a40c27..59475ed 100644
--- a/polygerrit-ui/app/elements/plugins/gr-external-style/gr-external-style_test.ts
+++ b/polygerrit-ui/app/elements/plugins/gr-external-style/gr-external-style_test.ts
@@ -4,22 +4,19 @@
* SPDX-License-Identifier: Apache-2.0
*/
import '../../../test/common-test-setup-karma';
-import {resetPlugins} from '../../../test/test-utils';
-import './gr-external-style.js';
-import {GrExternalStyle} from './gr-external-style.js';
+import {mockPromise, MockPromise, resetPlugins} from '../../../test/test-utils';
+import './gr-external-style';
+import {GrExternalStyle} from './gr-external-style';
import {getPluginLoader} from '../../shared/gr-js-api-interface/gr-plugin-loader';
-import {html} from '@polymer/polymer/lib/utils/html-tag';
import {PluginApi} from '../../../api/plugin';
-
-const basicFixture = fixtureFromTemplate(
- html`<gr-external-style name="foo"></gr-external-style>`
-);
+import {fixture, html} from '@open-wc/testing';
suite('gr-external-style integration tests', () => {
const TEST_URL = 'http://some.com/plugins/url.js';
let element: GrExternalStyle;
let plugin: PluginApi;
+ let pluginsLoaded: MockPromise<void>;
let applyStyleSpy: sinon.SinonSpy;
const installPlugin = () => {
@@ -36,33 +33,34 @@
};
const createElement = async () => {
- element = basicFixture.instantiate() as GrExternalStyle;
- applyStyleSpy = sinon.spy(element, 'applyStyle');
+ applyStyleSpy = sinon.spy(GrExternalStyle.prototype, 'applyStyle');
+ element = await fixture(
+ html`<gr-external-style .name=${'foo'}></gr-external-style>`
+ );
await element.updateComplete;
};
/**
* Installs the plugin, creates the element, registers style module.
*/
- const lateRegister = () => {
+ const lateRegister = async () => {
installPlugin();
- createElement();
+ await createElement();
plugin.registerStyleModule('foo', 'some-module');
};
/**
* Installs the plugin, registers style module, creates the element.
*/
- const earlyRegister = () => {
+ const earlyRegister = async () => {
installPlugin();
plugin.registerStyleModule('foo', 'some-module');
- createElement();
+ await createElement();
};
setup(() => {
- sinon
- .stub(getPluginLoader(), 'awaitPluginsLoaded')
- .returns(Promise.resolve());
+ pluginsLoaded = mockPromise();
+ sinon.stub(getPluginLoader(), 'awaitPluginsLoaded').returns(pluginsLoaded);
});
teardown(() => {
@@ -73,13 +71,14 @@
});
test('applies plugin-provided styles', async () => {
- lateRegister();
+ await lateRegister();
+ pluginsLoaded.resolve();
await element.updateComplete;
assert.isTrue(applyStyleSpy.calledWith('some-module'));
});
test('does not double apply', async () => {
- earlyRegister();
+ await earlyRegister();
await element.updateComplete;
plugin.registerStyleModule('foo', 'some-module');
await element.updateComplete;
@@ -90,7 +89,7 @@
});
test('loads and applies preloaded modules', async () => {
- earlyRegister();
+ await earlyRegister();
await element.updateComplete;
assert.isTrue(applyStyleSpy.calledWith('some-module'));
});
diff --git a/polygerrit-ui/app/elements/plugins/gr-plugin-host/gr-plugin-host_test.ts b/polygerrit-ui/app/elements/plugins/gr-plugin-host/gr-plugin-host_test.ts
index 756221e..520af04 100644
--- a/polygerrit-ui/app/elements/plugins/gr-plugin-host/gr-plugin-host_test.ts
+++ b/polygerrit-ui/app/elements/plugins/gr-plugin-host/gr-plugin-host_test.ts
@@ -7,7 +7,7 @@
import './gr-plugin-host';
import {getPluginLoader} from '../../shared/gr-js-api-interface/gr-plugin-loader';
import {GrPluginHost} from './gr-plugin-host';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import {SinonStub} from 'sinon';
import {createServerInfo} from '../../../test/test-data-generators';
diff --git a/polygerrit-ui/app/elements/plugins/gr-popup-interface/gr-plugin-popup_test.ts b/polygerrit-ui/app/elements/plugins/gr-popup-interface/gr-plugin-popup_test.ts
index d51eeed..4cf468f 100644
--- a/polygerrit-ui/app/elements/plugins/gr-popup-interface/gr-plugin-popup_test.ts
+++ b/polygerrit-ui/app/elements/plugins/gr-popup-interface/gr-plugin-popup_test.ts
@@ -3,22 +3,24 @@
* Copyright 2017 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
+import {fixture, html} from '@open-wc/testing';
import '../../../test/common-test-setup-karma';
+import {stubElement} from '../../../test/test-utils';
import './gr-plugin-popup';
import {GrPluginPopup} from './gr-plugin-popup';
-const basicFixture = fixtureFromElement('gr-plugin-popup');
-
suite('gr-plugin-popup tests', () => {
let element: GrPluginPopup;
let overlayOpen: sinon.SinonStub;
let overlayClose: sinon.SinonStub;
setup(async () => {
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-plugin-popup></gr-plugin-popup>`);
await element.updateComplete;
- overlayOpen = stub('gr-overlay', 'open').callsFake(() => Promise.resolve());
- overlayClose = stub('gr-overlay', 'close');
+ overlayOpen = stubElement('gr-overlay', 'open').callsFake(() =>
+ Promise.resolve()
+ );
+ overlayClose = stubElement('gr-overlay', 'close');
});
test('exists', () => {
diff --git a/polygerrit-ui/app/elements/plugins/gr-popup-interface/gr-popup-interface_test.ts b/polygerrit-ui/app/elements/plugins/gr-popup-interface/gr-popup-interface_test.ts
index 77bc11e..1bd581e 100644
--- a/polygerrit-ui/app/elements/plugins/gr-popup-interface/gr-popup-interface_test.ts
+++ b/polygerrit-ui/app/elements/plugins/gr-popup-interface/gr-popup-interface_test.ts
@@ -11,6 +11,7 @@
import {queryAndAssert} from '../../../test/test-utils';
import {LitElement, html} from 'lit';
import {customElement} from 'lit/decorators.js';
+import {fixture} from '@open-wc/testing';
@customElement('gr-user-test-popup')
class GrUserTestPopupElement extends LitElement {
@@ -24,14 +25,12 @@
}
}
-const containerFixture = fixtureFromElement('div');
-
suite('gr-popup-interface tests', () => {
let container: HTMLElement;
let instance: GrPopupInterface;
let plugin: PluginApi;
- setup(() => {
+ setup(async () => {
window.Gerrit.install(
p => {
plugin = p;
@@ -39,7 +38,7 @@
'0.1',
'http://test.com/plugins/testplugin/static/test.js'
);
- container = containerFixture.instantiate();
+ container = await fixture(html`<div></div>`);
sinon.stub(plugin, 'hook').returns({
getLastAttached() {
return Promise.resolve(container);
diff --git a/polygerrit-ui/app/elements/settings/gr-account-info/gr-account-info_test.ts b/polygerrit-ui/app/elements/settings/gr-account-info/gr-account-info_test.ts
index 745e3de..50c87b4 100644
--- a/polygerrit-ui/app/elements/settings/gr-account-info/gr-account-info_test.ts
+++ b/polygerrit-ui/app/elements/settings/gr-account-info/gr-account-info_test.ts
@@ -19,8 +19,7 @@
import {SinonStubbedMember} from 'sinon';
import {RestApiService} from '../../../services/gr-rest-api/gr-rest-api';
import {EditableAccountField} from '../../../api/rest-api';
-
-const basicFixture = fixtureFromElement('gr-account-info');
+import {fixture, html} from '@open-wc/testing';
suite('gr-account-info tests', () => {
let element!: GrAccountInfo;
@@ -54,62 +53,65 @@
stubRestApi('getConfig').resolves(config);
stubRestApi('getPreferences').resolves(createPreferences());
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-account-info></gr-account-info>`);
await element.loadData();
await element.updateComplete;
});
test('renders', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div class="gr-form-styles">
- <section>
- <span class="title"></span>
- <span class="value">
- <gr-avatar hidden="" imagesize="120"></gr-avatar>
- </span>
- </section>
- <section>
- <span class="title">ID</span>
- <span class="value">123</span>
- </section>
- <section>
- <span class="title">Email</span>
- <span class="value">user-123@</span>
- </section>
- <section>
- <span class="title">Registered</span>
- <span class="value">
- <gr-date-formatter withtooltip=""></gr-date-formatter>
- </span>
- </section>
- <section id="usernameSection">
- <span class="title">Username</span>
- <span class="value"></span>
- </section>
- <section id="nameSection">
- <label class="title" for="nameInput">Full name</label>
- <span class="value">User-123</span>
- </section>
- <section>
- <label class="title" for="displayNameInput">Display name</label>
- <span class="value">
- <iron-input>
- <input id="displayNameInput" />
- </iron-input>
- </span>
- </section>
- <section>
- <label class="title" for="statusInput">
- About me (e.g. employer)
- </label>
- <span class="value">
- <iron-input id="statusIronInput">
- <input id="statusInput" />
- </iron-input>
- </span>
- </section>
- </div>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div class="gr-form-styles">
+ <section>
+ <span class="title"></span>
+ <span class="value">
+ <gr-avatar hidden="" imagesize="120"></gr-avatar>
+ </span>
+ </section>
+ <section>
+ <span class="title">ID</span>
+ <span class="value">123</span>
+ </section>
+ <section>
+ <span class="title">Email</span>
+ <span class="value">user-123@</span>
+ </section>
+ <section>
+ <span class="title">Registered</span>
+ <span class="value">
+ <gr-date-formatter withtooltip=""></gr-date-formatter>
+ </span>
+ </section>
+ <section id="usernameSection">
+ <span class="title">Username</span>
+ <span class="value"></span>
+ </section>
+ <section id="nameSection">
+ <label class="title" for="nameInput">Full name</label>
+ <span class="value">User-123</span>
+ </section>
+ <section>
+ <label class="title" for="displayNameInput">Display name</label>
+ <span class="value">
+ <iron-input>
+ <input id="displayNameInput" />
+ </iron-input>
+ </span>
+ </section>
+ <section>
+ <label class="title" for="statusInput">
+ About me (e.g. employer)
+ </label>
+ <span class="value">
+ <iron-input id="statusIronInput">
+ <input id="statusInput" />
+ </iron-input>
+ </span>
+ </section>
+ </div>
+ `
+ );
});
test('basic account info render', () => {
diff --git a/polygerrit-ui/app/elements/settings/gr-agreements-list/gr-agreements-list_test.ts b/polygerrit-ui/app/elements/settings/gr-agreements-list/gr-agreements-list_test.ts
index 604bde4..003e29d 100644
--- a/polygerrit-ui/app/elements/settings/gr-agreements-list/gr-agreements-list_test.ts
+++ b/polygerrit-ui/app/elements/settings/gr-agreements-list/gr-agreements-list_test.ts
@@ -8,8 +8,7 @@
import {stubRestApi} from '../../../test/test-utils';
import {GrAgreementsList} from './gr-agreements-list';
import {ContributorAgreementInfo} from '../../../types/common';
-
-const basicFixture = fixtureFromElement('gr-agreements-list');
+import {fixture, html} from '@open-wc/testing';
suite('gr-agreements-list tests', () => {
let element: GrAgreementsList;
@@ -25,33 +24,36 @@
stubRestApi('getAccountAgreements').returns(Promise.resolve(agreements));
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-agreements-list></gr-agreements-list>`);
await element.loadData();
await flush();
});
test('renders', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div class="gr-form-styles">
- <table id="agreements">
- <thead>
- <tr>
- <th class="nameColumn">Name</th>
- <th class="descriptionColumn">Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td class="nameColumn">
- <a href="/some url" rel="external"> Agreements 1 </a>
- </td>
- <td class="descriptionColumn">Agreements 1 description</td>
- </tr>
- </tbody>
- </table>
- <a href="/settings/new-agreement"> New Contributor Agreement </a>
- </div>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div class="gr-form-styles">
+ <table id="agreements">
+ <thead>
+ <tr>
+ <th class="nameColumn">Name</th>
+ <th class="descriptionColumn">Description</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td class="nameColumn">
+ <a href="/some url" rel="external"> Agreements 1 </a>
+ </td>
+ <td class="descriptionColumn">Agreements 1 description</td>
+ </tr>
+ </tbody>
+ </table>
+ <a href="/settings/new-agreement"> New Contributor Agreement </a>
+ </div>
+ `
+ );
});
});
diff --git a/polygerrit-ui/app/elements/settings/gr-change-table-editor/gr-change-table-editor_test.ts b/polygerrit-ui/app/elements/settings/gr-change-table-editor/gr-change-table-editor_test.ts
index 21778f7..14a27c9 100644
--- a/polygerrit-ui/app/elements/settings/gr-change-table-editor/gr-change-table-editor_test.ts
+++ b/polygerrit-ui/app/elements/settings/gr-change-table-editor/gr-change-table-editor_test.ts
@@ -8,7 +8,7 @@
import {GrChangeTableEditor} from './gr-change-table-editor';
import {queryAndAssert} from '../../../test/test-utils';
import {createServerInfo} from '../../../test/test-data-generators';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import {ColumnNames} from '../../../constants/constants';
suite('gr-change-table-editor tests', () => {
@@ -38,77 +38,80 @@
});
test('renders', () => {
- expect(element).shadowDom.to.equal(/* HTML */ ` <div class="gr-form-styles">
- <table id="changeCols">
- <thead>
- <tr>
- <th class="nameHeader">Column</th>
- <th class="visibleHeader">Visible</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><label for="numberCheckbox"> Number </label></td>
- <td class="checkboxContainer">
- <input id="numberCheckbox" name="number" type="checkbox" />
- </td>
- </tr>
- <tr>
- <td><label for="Subject"> Subject </label></td>
- <td class="checkboxContainer">
- <input checked="" id="Subject" name="Subject" type="checkbox" />
- </td>
- </tr>
- <tr>
- <td><label for="Owner"> Owner </label></td>
- <td class="checkboxContainer">
- <input checked="" id="Owner" name="Owner" type="checkbox" />
- </td>
- </tr>
- <tr>
- <td><label for="Reviewers"> Reviewers </label></td>
- <td class="checkboxContainer">
- <input
- checked=""
- id="Reviewers"
- name="Reviewers"
- type="checkbox"
- />
- </td>
- </tr>
- <tr>
- <td><label for="Repo"> Repo </label></td>
- <td class="checkboxContainer">
- <input checked="" id="Repo" name="Repo" type="checkbox" />
- </td>
- </tr>
- <tr>
- <td><label for="Branch"> Branch </label></td>
- <td class="checkboxContainer">
- <input checked="" id="Branch" name="Branch" type="checkbox" />
- </td>
- </tr>
- <tr>
- <td><label for="Updated"> Updated </label></td>
- <td class="checkboxContainer">
- <input checked="" id="Updated" name="Updated" type="checkbox" />
- </td>
- </tr>
- <tr>
- <td><label for="Size"> Size </label></td>
- <td class="checkboxContainer">
- <input id="Size" name="Size" type="checkbox" />
- </td>
- </tr>
- <tr>
- <td><label for=" Status "> Status </label></td>
- <td class="checkboxContainer">
- <input id=" Status " name=" Status " type="checkbox" />
- </td>
- </tr>
- </tbody>
- </table>
- </div>`);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ ` <div class="gr-form-styles">
+ <table id="changeCols">
+ <thead>
+ <tr>
+ <th class="nameHeader">Column</th>
+ <th class="visibleHeader">Visible</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><label for="numberCheckbox"> Number </label></td>
+ <td class="checkboxContainer">
+ <input id="numberCheckbox" name="number" type="checkbox" />
+ </td>
+ </tr>
+ <tr>
+ <td><label for="Subject"> Subject </label></td>
+ <td class="checkboxContainer">
+ <input checked="" id="Subject" name="Subject" type="checkbox" />
+ </td>
+ </tr>
+ <tr>
+ <td><label for="Owner"> Owner </label></td>
+ <td class="checkboxContainer">
+ <input checked="" id="Owner" name="Owner" type="checkbox" />
+ </td>
+ </tr>
+ <tr>
+ <td><label for="Reviewers"> Reviewers </label></td>
+ <td class="checkboxContainer">
+ <input
+ checked=""
+ id="Reviewers"
+ name="Reviewers"
+ type="checkbox"
+ />
+ </td>
+ </tr>
+ <tr>
+ <td><label for="Repo"> Repo </label></td>
+ <td class="checkboxContainer">
+ <input checked="" id="Repo" name="Repo" type="checkbox" />
+ </td>
+ </tr>
+ <tr>
+ <td><label for="Branch"> Branch </label></td>
+ <td class="checkboxContainer">
+ <input checked="" id="Branch" name="Branch" type="checkbox" />
+ </td>
+ </tr>
+ <tr>
+ <td><label for="Updated"> Updated </label></td>
+ <td class="checkboxContainer">
+ <input checked="" id="Updated" name="Updated" type="checkbox" />
+ </td>
+ </tr>
+ <tr>
+ <td><label for="Size"> Size </label></td>
+ <td class="checkboxContainer">
+ <input id="Size" name="Size" type="checkbox" />
+ </td>
+ </tr>
+ <tr>
+ <td><label for=" Status "> Status </label></td>
+ <td class="checkboxContainer">
+ <input id=" Status " name=" Status " type="checkbox" />
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>`
+ );
});
test('renders', () => {
diff --git a/polygerrit-ui/app/elements/settings/gr-cla-view/gr-cla-view_test.ts b/polygerrit-ui/app/elements/settings/gr-cla-view/gr-cla-view_test.ts
index 51b38ae..2111277 100644
--- a/polygerrit-ui/app/elements/settings/gr-cla-view/gr-cla-view_test.ts
+++ b/polygerrit-ui/app/elements/settings/gr-cla-view/gr-cla-view_test.ts
@@ -16,7 +16,7 @@
} from '../../../types/common';
import {AuthType} from '../../../constants/constants';
import {createServerInfo} from '../../../test/test-data-generators';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
suite('gr-cla-view tests', () => {
let element: GrClaView;
@@ -125,36 +125,39 @@
});
test('renders', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <main>
- <h1 class="heading-1">New Contributor Agreement</h1>
- <h3 class="heading-3">Select an agreement type:</h3>
- <span class="contributorAgreementButton">
- <input
- data-name="Individual"
- data-url="static/cla_individual.html"
- id="claNewAgreementsInputIndividual"
- name="claNewAgreementsRadio"
- type="radio"
- />
- <label id="claNewAgreementsLabel"> Individual </label>
- </span>
- <div class="agreementsUrl">test-description</div>
- <span class="contributorAgreementButton">
- <input
- data-name="CLA"
- data-url="static/cla.html"
- disabled=""
- id="claNewAgreementsInputCLA"
- name="claNewAgreementsRadio"
- type="radio"
- />
- <label id="claNewAgreementsLabel"> CLA </label>
- </span>
- <div class="alreadySubmittedText">Agreement already submitted.</div>
- <div class="agreementsUrl">Contributor License Agreement</div>
- </main>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <main>
+ <h1 class="heading-1">New Contributor Agreement</h1>
+ <h3 class="heading-3">Select an agreement type:</h3>
+ <span class="contributorAgreementButton">
+ <input
+ data-name="Individual"
+ data-url="static/cla_individual.html"
+ id="claNewAgreementsInputIndividual"
+ name="claNewAgreementsRadio"
+ type="radio"
+ />
+ <label id="claNewAgreementsLabel"> Individual </label>
+ </span>
+ <div class="agreementsUrl">test-description</div>
+ <span class="contributorAgreementButton">
+ <input
+ data-name="CLA"
+ data-url="static/cla.html"
+ disabled=""
+ id="claNewAgreementsInputCLA"
+ name="claNewAgreementsRadio"
+ type="radio"
+ />
+ <label id="claNewAgreementsLabel"> CLA </label>
+ </span>
+ <div class="alreadySubmittedText">Agreement already submitted.</div>
+ <div class="agreementsUrl">Contributor License Agreement</div>
+ </main>
+ `
+ );
});
test('disableAgreements', () => {
diff --git a/polygerrit-ui/app/elements/settings/gr-edit-preferences/gr-edit-preferences_test.ts b/polygerrit-ui/app/elements/settings/gr-edit-preferences/gr-edit-preferences_test.ts
index 9e969dd..6f16273 100644
--- a/polygerrit-ui/app/elements/settings/gr-edit-preferences/gr-edit-preferences_test.ts
+++ b/polygerrit-ui/app/elements/settings/gr-edit-preferences/gr-edit-preferences_test.ts
@@ -10,8 +10,7 @@
import {EditPreferencesInfo, ParsedJSON} from '../../../types/common';
import {IronInputElement} from '@polymer/iron-input';
import {createDefaultEditPrefs} from '../../../constants/constants';
-
-const basicFixture = fixtureFromElement('gr-edit-preferences');
+import {fixture, html} from '@open-wc/testing';
suite('gr-edit-preferences tests', () => {
let element: GrEditPreferences;
@@ -35,110 +34,113 @@
stubRestApi('getEditPreferences').returns(Promise.resolve(editPreferences));
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-edit-preferences></gr-edit-preferences>`);
await element.updateComplete;
});
test('renders', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <h2 id="EditPreferences">Edit Preferences</h2>
- <fieldset id="editPreferences">
- <div class="gr-form-styles" id="editPreferences">
- <section>
- <label class="title" for="editTabWidth"> Tab width </label>
- <span class="value">
- <iron-input>
- <input id="editTabWidth" type="number" />
- </iron-input>
- </span>
- </section>
- <section>
- <label class="title" for="editColumns"> Columns </label>
- <span class="value">
- <iron-input>
- <input id="editColumns" type="number" />
- </iron-input>
- </span>
- </section>
- <section>
- <label class="title" for="editIndentUnit"> Indent unit </label>
- <span class="value">
- <iron-input>
- <input id="editIndentUnit" type="number" />
- </iron-input>
- </span>
- </section>
- <section>
- <label class="title" for="editSyntaxHighlighting">
- Syntax highlighting
- </label>
- <span class="value">
- <input checked="" id="editSyntaxHighlighting" type="checkbox" />
- </span>
- </section>
- <section>
- <label class="title" for="editShowTabs"> Show tabs </label>
- <span class="value">
- <input checked="" id="editShowTabs" type="checkbox" />
- </span>
- </section>
- <section>
- <label class="title" for="showTrailingWhitespaceInput">
- Show trailing whitespace
- </label>
- <span class="value">
- <input
- checked=""
- id="editShowTrailingWhitespaceInput"
- type="checkbox"
- />
- </span>
- </section>
- <section>
- <label class="title" for="showMatchBrackets">
- Match brackets
- </label>
- <span class="value">
- <input checked="" id="showMatchBrackets" type="checkbox" />
- </span>
- </section>
- <section>
- <label class="title" for="editShowLineWrapping">
- Line wrapping
- </label>
- <span class="value">
- <input id="editShowLineWrapping" type="checkbox" />
- </span>
- </section>
- <section>
- <label class="title" for="showIndentWithTabs">
- Indent with tabs
- </label>
- <span class="value">
- <input id="showIndentWithTabs" type="checkbox" />
- </span>
- </section>
- <section>
- <label class="title" for="showAutoCloseBrackets">
- Auto close brackets
- </label>
- <span class="value">
- <input id="showAutoCloseBrackets" type="checkbox" />
- </span>
- </section>
- </div>
- <gr-button
- aria-disabled="true"
- disabled=""
- id="saveEditPrefs"
- role="button"
- tabindex="-1"
- >
- Save changes
- </gr-button>
- </fieldset>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <h2 id="EditPreferences">Edit Preferences</h2>
+ <fieldset id="editPreferences">
+ <div class="gr-form-styles" id="editPreferences">
+ <section>
+ <label class="title" for="editTabWidth"> Tab width </label>
+ <span class="value">
+ <iron-input>
+ <input id="editTabWidth" type="number" />
+ </iron-input>
+ </span>
+ </section>
+ <section>
+ <label class="title" for="editColumns"> Columns </label>
+ <span class="value">
+ <iron-input>
+ <input id="editColumns" type="number" />
+ </iron-input>
+ </span>
+ </section>
+ <section>
+ <label class="title" for="editIndentUnit"> Indent unit </label>
+ <span class="value">
+ <iron-input>
+ <input id="editIndentUnit" type="number" />
+ </iron-input>
+ </span>
+ </section>
+ <section>
+ <label class="title" for="editSyntaxHighlighting">
+ Syntax highlighting
+ </label>
+ <span class="value">
+ <input checked="" id="editSyntaxHighlighting" type="checkbox" />
+ </span>
+ </section>
+ <section>
+ <label class="title" for="editShowTabs"> Show tabs </label>
+ <span class="value">
+ <input checked="" id="editShowTabs" type="checkbox" />
+ </span>
+ </section>
+ <section>
+ <label class="title" for="showTrailingWhitespaceInput">
+ Show trailing whitespace
+ </label>
+ <span class="value">
+ <input
+ checked=""
+ id="editShowTrailingWhitespaceInput"
+ type="checkbox"
+ />
+ </span>
+ </section>
+ <section>
+ <label class="title" for="showMatchBrackets">
+ Match brackets
+ </label>
+ <span class="value">
+ <input checked="" id="showMatchBrackets" type="checkbox" />
+ </span>
+ </section>
+ <section>
+ <label class="title" for="editShowLineWrapping">
+ Line wrapping
+ </label>
+ <span class="value">
+ <input id="editShowLineWrapping" type="checkbox" />
+ </span>
+ </section>
+ <section>
+ <label class="title" for="showIndentWithTabs">
+ Indent with tabs
+ </label>
+ <span class="value">
+ <input id="showIndentWithTabs" type="checkbox" />
+ </span>
+ </section>
+ <section>
+ <label class="title" for="showAutoCloseBrackets">
+ Auto close brackets
+ </label>
+ <span class="value">
+ <input id="showAutoCloseBrackets" type="checkbox" />
+ </span>
+ </section>
+ </div>
+ <gr-button
+ aria-disabled="true"
+ disabled=""
+ id="saveEditPrefs"
+ role="button"
+ tabindex="-1"
+ >
+ Save changes
+ </gr-button>
+ </fieldset>
+ `
+ );
});
test('input values match preferences', () => {
diff --git a/polygerrit-ui/app/elements/settings/gr-email-editor/gr-email-editor_test.ts b/polygerrit-ui/app/elements/settings/gr-email-editor/gr-email-editor_test.ts
index b9322cd..e8b0f79 100644
--- a/polygerrit-ui/app/elements/settings/gr-email-editor/gr-email-editor_test.ts
+++ b/polygerrit-ui/app/elements/settings/gr-email-editor/gr-email-editor_test.ts
@@ -7,7 +7,7 @@
import './gr-email-editor';
import {GrEmailEditor} from './gr-email-editor';
import {spyRestApi, stubRestApi} from '../../../test/test-utils';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
suite('gr-email-editor tests', () => {
let element: GrEmailEditor;
@@ -30,93 +30,96 @@
});
test('renders', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `<div class="gr-form-styles">
- <table id="emailTable">
- <thead>
- <tr>
- <th class="emailColumn">Email</th>
- <th class="preferredHeader">Preferred</th>
- <th></th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td class="emailColumn">email@one.com</td>
- <td class="preferredControl">
- <iron-input class="preferredRadio">
- <input
- class="preferredRadio"
- name="preferred"
- type="radio"
- value="email@one.com"
- />
- </iron-input>
- </td>
- <td>
- <gr-button
- aria-disabled="false"
- class="remove-button"
- data-index="0"
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- <tr>
- <td class="emailColumn">email@two.com</td>
- <td class="preferredControl">
- <iron-input class="preferredRadio">
- <input
- checked=""
- class="preferredRadio"
- name="preferred"
- type="radio"
- value="email@two.com"
- />
- </iron-input>
- </td>
- <td>
- <gr-button
- aria-disabled="true"
- class="remove-button"
- data-index="1"
- disabled=""
- role="button"
- tabindex="-1"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- <tr>
- <td class="emailColumn">email@three.com</td>
- <td class="preferredControl">
- <iron-input class="preferredRadio">
- <input
- class="preferredRadio"
- name="preferred"
- type="radio"
- value="email@three.com"
- />
- </iron-input>
- </td>
- <td>
- <gr-button
- aria-disabled="false"
- class="remove-button"
- data-index="2"
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- </tbody>
- </table>
- </div>`);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `<div class="gr-form-styles">
+ <table id="emailTable">
+ <thead>
+ <tr>
+ <th class="emailColumn">Email</th>
+ <th class="preferredHeader">Preferred</th>
+ <th></th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td class="emailColumn">email@one.com</td>
+ <td class="preferredControl">
+ <iron-input class="preferredRadio">
+ <input
+ class="preferredRadio"
+ name="preferred"
+ type="radio"
+ value="email@one.com"
+ />
+ </iron-input>
+ </td>
+ <td>
+ <gr-button
+ aria-disabled="false"
+ class="remove-button"
+ data-index="0"
+ role="button"
+ tabindex="0"
+ >
+ Delete
+ </gr-button>
+ </td>
+ </tr>
+ <tr>
+ <td class="emailColumn">email@two.com</td>
+ <td class="preferredControl">
+ <iron-input class="preferredRadio">
+ <input
+ checked=""
+ class="preferredRadio"
+ name="preferred"
+ type="radio"
+ value="email@two.com"
+ />
+ </iron-input>
+ </td>
+ <td>
+ <gr-button
+ aria-disabled="true"
+ class="remove-button"
+ data-index="1"
+ disabled=""
+ role="button"
+ tabindex="-1"
+ >
+ Delete
+ </gr-button>
+ </td>
+ </tr>
+ <tr>
+ <td class="emailColumn">email@three.com</td>
+ <td class="preferredControl">
+ <iron-input class="preferredRadio">
+ <input
+ class="preferredRadio"
+ name="preferred"
+ type="radio"
+ value="email@three.com"
+ />
+ </iron-input>
+ </td>
+ <td>
+ <gr-button
+ aria-disabled="false"
+ class="remove-button"
+ data-index="2"
+ role="button"
+ tabindex="0"
+ >
+ Delete
+ </gr-button>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>`
+ );
});
test('renders', () => {
diff --git a/polygerrit-ui/app/elements/settings/gr-gpg-editor/gr-gpg-editor_test.ts b/polygerrit-ui/app/elements/settings/gr-gpg-editor/gr-gpg-editor_test.ts
index 2cbc75d..b41169f 100644
--- a/polygerrit-ui/app/elements/settings/gr-gpg-editor/gr-gpg-editor_test.ts
+++ b/polygerrit-ui/app/elements/settings/gr-gpg-editor/gr-gpg-editor_test.ts
@@ -19,8 +19,7 @@
OpenPgpUserIds,
} from '../../../api/rest-api';
import {GrButton} from '../../shared/gr-button/gr-button';
-
-const basicFixture = fixtureFromElement('gr-gpg-editor');
+import {fixture, html} from '@open-wc/testing';
suite('gr-gpg-editor tests', () => {
let element: GrGpgEditor;
@@ -54,141 +53,149 @@
stubRestApi('getAccountGPGKeys').returns(Promise.resolve(keys));
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-gpg-editor></gr-gpg-editor>`);
await element.loadData();
await element.updateComplete;
});
test('renders', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `<div class="gr-form-styles">
- <fieldset id="existing">
- <table>
- <thead>
- <tr>
- <th class="idColumn">ID</th>
- <th class="fingerPrintColumn">Fingerprint</th>
- <th class="userIdHeader">User IDs</th>
- <th class="keyHeader">Public Key</th>
- <th></th>
- <th></th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td class="idColumn">AFC8A49B</td>
- <td class="fingerPrintColumn">
- 0192 723D 42D1 0C5B 32A6 E1E0 9350 9E4B AFC8 A49B
- </td>
- <td class="userIdHeader">John Doe john.doe@example.com</td>
- <td class="keyHeader">
- <gr-button
- aria-disabled="false"
- link=""
- role="button"
- tabindex="0"
- >
- Click to View
- </gr-button>
- </td>
- <td>
- <gr-copy-clipboard
- buttontitle="Copy GPG public key to clipboard"
- hastooltip=""
- hideinput=""
- >
- </gr-copy-clipboard>
- </td>
- <td>
- <gr-button aria-disabled="false" role="button" tabindex="0">
- Delete
- </gr-button>
- </td>
- </tr>
- <tr>
- <td class="idColumn">AED9B59C</td>
- <td class="fingerPrintColumn">
- 0196 723D 42D1 0C5B 32A6 E1E0 9350 9E4B AFC8 A49B
- </td>
- <td class="userIdHeader">Gerrit gerrit@example.com</td>
- <td class="keyHeader">
- <gr-button
- aria-disabled="false"
- link=""
- role="button"
- tabindex="0"
- >
- Click to View
- </gr-button>
- </td>
- <td>
- <gr-copy-clipboard
- buttontitle="Copy GPG public key to clipboard"
- hastooltip=""
- hideinput=""
- >
- </gr-copy-clipboard>
- </td>
- <td>
- <gr-button aria-disabled="false" role="button" tabindex="0">
- Delete
- </gr-button>
- </td>
- </tr>
- </tbody>
- </table>
- <gr-overlay
- aria-hidden="true"
- id="viewKeyOverlay"
- style="outline: none; display: none;"
- tabindex="-1"
- with-backdrop=""
- >
- <fieldset>
- <section>
- <span class="title"> Status </span> <span class="value"> </span>
- </section>
- <section>
- <span class="title"> Key </span> <span class="value"> </span>
- </section>
- </fieldset>
- <gr-button
- aria-disabled="false"
- class="closeButton"
- role="button"
- tabindex="0"
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `<div class="gr-form-styles">
+ <fieldset id="existing">
+ <table>
+ <thead>
+ <tr>
+ <th class="idColumn">ID</th>
+ <th class="fingerPrintColumn">Fingerprint</th>
+ <th class="userIdHeader">User IDs</th>
+ <th class="keyHeader">Public Key</th>
+ <th></th>
+ <th></th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td class="idColumn">AFC8A49B</td>
+ <td class="fingerPrintColumn">
+ 0192 723D 42D1 0C5B 32A6 E1E0 9350 9E4B AFC8 A49B
+ </td>
+ <td class="userIdHeader">John Doe john.doe@example.com</td>
+ <td class="keyHeader">
+ <gr-button
+ aria-disabled="false"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Click to View
+ </gr-button>
+ </td>
+ <td>
+ <gr-copy-clipboard
+ buttontitle="Copy GPG public key to clipboard"
+ hastooltip=""
+ hideinput=""
+ >
+ </gr-copy-clipboard>
+ </td>
+ <td>
+ <gr-button aria-disabled="false" role="button" tabindex="0">
+ Delete
+ </gr-button>
+ </td>
+ </tr>
+ <tr>
+ <td class="idColumn">AED9B59C</td>
+ <td class="fingerPrintColumn">
+ 0196 723D 42D1 0C5B 32A6 E1E0 9350 9E4B AFC8 A49B
+ </td>
+ <td class="userIdHeader">Gerrit gerrit@example.com</td>
+ <td class="keyHeader">
+ <gr-button
+ aria-disabled="false"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Click to View
+ </gr-button>
+ </td>
+ <td>
+ <gr-copy-clipboard
+ buttontitle="Copy GPG public key to clipboard"
+ hastooltip=""
+ hideinput=""
+ >
+ </gr-copy-clipboard>
+ </td>
+ <td>
+ <gr-button aria-disabled="false" role="button" tabindex="0">
+ Delete
+ </gr-button>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ <gr-overlay
+ aria-hidden="true"
+ id="viewKeyOverlay"
+ style="outline: none; display: none;"
+ tabindex="-1"
+ with-backdrop=""
>
- Close
- </gr-button>
- </gr-overlay>
- <gr-button aria-disabled="true" disabled="" role="button" tabindex="-1">
- Save changes
- </gr-button>
- </fieldset>
- <fieldset>
- <section>
- <span class="title"> New GPG key </span>
- <span class="value">
- <iron-autogrow-textarea
+ <fieldset>
+ <section>
+ <span class="title"> Status </span> <span class="value"> </span>
+ </section>
+ <section>
+ <span class="title"> Key </span> <span class="value"> </span>
+ </section>
+ </fieldset>
+ <gr-button
aria-disabled="false"
- autocomplete="on"
- id="newKey"
- placeholder="New GPG Key"
+ class="closeButton"
+ role="button"
+ tabindex="0"
>
- </iron-autogrow-textarea>
- </span>
- </section>
- <gr-button
- aria-disabled="true"
- disabled=""
- id="addButton"
- role="button"
- tabindex="-1"
- >
- Add new GPG key
- </gr-button>
- </fieldset>
- </div> `);
+ Close
+ </gr-button>
+ </gr-overlay>
+ <gr-button
+ aria-disabled="true"
+ disabled=""
+ role="button"
+ tabindex="-1"
+ >
+ Save changes
+ </gr-button>
+ </fieldset>
+ <fieldset>
+ <section>
+ <span class="title"> New GPG key </span>
+ <span class="value">
+ <iron-autogrow-textarea
+ aria-disabled="false"
+ autocomplete="on"
+ id="newKey"
+ placeholder="New GPG Key"
+ >
+ </iron-autogrow-textarea>
+ </span>
+ </section>
+ <gr-button
+ aria-disabled="true"
+ disabled=""
+ id="addButton"
+ role="button"
+ tabindex="-1"
+ >
+ Add new GPG key
+ </gr-button>
+ </fieldset>
+ </div> `
+ );
});
test('renders', () => {
diff --git a/polygerrit-ui/app/elements/settings/gr-group-list/gr-group-list_test.ts b/polygerrit-ui/app/elements/settings/gr-group-list/gr-group-list_test.ts
index 0b1b294..2e26b1b 100644
--- a/polygerrit-ui/app/elements/settings/gr-group-list/gr-group-list_test.ts
+++ b/polygerrit-ui/app/elements/settings/gr-group-list/gr-group-list_test.ts
@@ -9,8 +9,7 @@
import {GerritNav} from '../../core/gr-navigation/gr-navigation';
import {GroupId, GroupInfo, GroupName} from '../../../types/common';
import {stubRestApi} from '../../../test/test-utils';
-
-const basicFixture = fixtureFromElement('gr-group-list');
+import {fixture, html} from '@open-wc/testing';
suite('gr-group-list tests', () => {
let element: GrGroupList;
@@ -44,49 +43,52 @@
stubRestApi('getAccountGroups').returns(Promise.resolve(groups));
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-group-list></gr-group-list>`);
await element.loadData();
await flush();
});
test('renders', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div class="gr-form-styles">
- <table id="groups">
- <thead>
- <tr>
- <th class="nameHeader">Name</th>
- <th class="descriptionHeader">Description</th>
- <th class="visibleCell">Visible to all</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td class="nameColumn">
- <a href=""> Group 1 </a>
- </td>
- <td>Group 1 description</td>
- <td class="visibleCell">No</td>
- </tr>
- <tr>
- <td class="nameColumn">
- <a href=""> Group 2 </a>
- </td>
- <td></td>
- <td class="visibleCell">Yes</td>
- </tr>
- <tr>
- <td class="nameColumn">
- <a href=""> Group 3 </a>
- </td>
- <td></td>
- <td class="visibleCell">No</td>
- </tr>
- </tbody>
- </table>
- </div>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div class="gr-form-styles">
+ <table id="groups">
+ <thead>
+ <tr>
+ <th class="nameHeader">Name</th>
+ <th class="descriptionHeader">Description</th>
+ <th class="visibleCell">Visible to all</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td class="nameColumn">
+ <a href=""> Group 1 </a>
+ </td>
+ <td>Group 1 description</td>
+ <td class="visibleCell">No</td>
+ </tr>
+ <tr>
+ <td class="nameColumn">
+ <a href=""> Group 2 </a>
+ </td>
+ <td></td>
+ <td class="visibleCell">Yes</td>
+ </tr>
+ <tr>
+ <td class="nameColumn">
+ <a href=""> Group 3 </a>
+ </td>
+ <td></td>
+ <td class="visibleCell">No</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ `
+ );
});
test('_computeGroupPath', () => {
diff --git a/polygerrit-ui/app/elements/settings/gr-http-password/gr-http-password_test.ts b/polygerrit-ui/app/elements/settings/gr-http-password/gr-http-password_test.ts
index 1a097ac..5c1fa7e 100644
--- a/polygerrit-ui/app/elements/settings/gr-http-password/gr-http-password_test.ts
+++ b/polygerrit-ui/app/elements/settings/gr-http-password/gr-http-password_test.ts
@@ -15,8 +15,7 @@
import {AccountDetailInfo, ServerInfo} from '../../../types/common';
import {queryAndAssert} from '../../../test/test-utils';
import {GrButton} from '../../shared/gr-button/gr-button';
-
-const basicFixture = fixtureFromElement('gr-http-password');
+import {fixture, html} from '@open-wc/testing';
suite('gr-http-password tests', () => {
let element: GrHttpPassword;
@@ -30,68 +29,71 @@
stubRestApi('getAccount').returns(Promise.resolve(account));
stubRestApi('getConfig').returns(Promise.resolve(config));
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-http-password></gr-http-password>`);
await element.loadData();
await flush();
});
test('renders', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div class="gr-form-styles">
- <div>
- <section>
- <span class="title"> Username </span>
- <span class="value"> user name </span>
- </section>
- <gr-button
- aria-disabled="false"
- id="generateButton"
- role="button"
- tabindex="0"
- >
- Generate new password
- </gr-button>
- </div>
- <span hidden="">
- <a href="" rel="noopener" target="_blank"> Obtain password </a>
- (opens in a new tab)
- </span>
- </div>
- <gr-overlay
- aria-hidden="true"
- id="generatedPasswordOverlay"
- style="outline: none; display: none;"
- tabindex="-1"
- with-backdrop=""
- >
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
<div class="gr-form-styles">
- <section id="generatedPasswordDisplay">
- <span class="title"> New Password: </span>
- <span class="value"> </span>
- <gr-copy-clipboard
- buttontitle="Copy password to clipboard"
- hastooltip=""
- hideinput=""
+ <div>
+ <section>
+ <span class="title"> Username </span>
+ <span class="value"> user name </span>
+ </section>
+ <gr-button
+ aria-disabled="false"
+ id="generateButton"
+ role="button"
+ tabindex="0"
>
- </gr-copy-clipboard>
- </section>
- <section id="passwordWarning">
- This password will not be displayed again.
- <br />
- If you lose it, you will need to generate a new one.
- </section>
- <gr-button
- aria-disabled="false"
- class="closeButton"
- link=""
- role="button"
- tabindex="0"
- >
- Close
- </gr-button>
+ Generate new password
+ </gr-button>
+ </div>
+ <span hidden="">
+ <a href="" rel="noopener" target="_blank"> Obtain password </a>
+ (opens in a new tab)
+ </span>
</div>
- </gr-overlay>
- `);
+ <gr-overlay
+ aria-hidden="true"
+ id="generatedPasswordOverlay"
+ style="outline: none; display: none;"
+ tabindex="-1"
+ with-backdrop=""
+ >
+ <div class="gr-form-styles">
+ <section id="generatedPasswordDisplay">
+ <span class="title"> New Password: </span>
+ <span class="value"> </span>
+ <gr-copy-clipboard
+ buttontitle="Copy password to clipboard"
+ hastooltip=""
+ hideinput=""
+ >
+ </gr-copy-clipboard>
+ </section>
+ <section id="passwordWarning">
+ This password will not be displayed again.
+ <br />
+ If you lose it, you will need to generate a new one.
+ </section>
+ <gr-button
+ aria-disabled="false"
+ class="closeButton"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Close
+ </gr-button>
+ </div>
+ </gr-overlay>
+ `
+ );
});
test('generate password', () => {
diff --git a/polygerrit-ui/app/elements/settings/gr-identities/gr-identities_test.ts b/polygerrit-ui/app/elements/settings/gr-identities/gr-identities_test.ts
index b4e4d8e..77af8a0 100644
--- a/polygerrit-ui/app/elements/settings/gr-identities/gr-identities_test.ts
+++ b/polygerrit-ui/app/elements/settings/gr-identities/gr-identities_test.ts
@@ -12,7 +12,7 @@
import {createServerInfo} from '../../../test/test-data-generators';
import {queryAll, queryAndAssert} from '../../../test/test-utils';
import {GrButton} from '../../shared/gr-button/gr-button';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
suite('gr-identities tests', () => {
let element: GrIdentities;
@@ -46,64 +46,70 @@
});
test('renders', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `<div class="gr-form-styles">
- <fieldset class="space">
- <table>
- <thead>
- <tr>
- <th class="statusHeader">Status</th>
- <th class="emailAddressHeader">Email Address</th>
- <th class="identityHeader">Identity</th>
- <th class="deleteHeader"></th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td class="statusColumn">Untrusted</td>
- <td class="emailAddressColumn">gerrit@example.com</td>
- <td class="identityColumn">gerrit:gerrit</td>
- <td class="deleteColumn">
- <gr-button
- aria-disabled="false"
- class="deleteButton"
- data-index="0"
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- <tr>
- <td class="statusColumn"></td>
- <td class="emailAddressColumn">gerrit2@example.com</td>
- <td class="identityColumn"></td>
- <td class="deleteColumn">
- <gr-button
- aria-disabled="false"
- class="deleteButton show"
- data-index="1"
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- </tbody>
- </table>
- </fieldset>
- </div>
- <gr-overlay
- aria-hidden="true"
- id="overlay"
- style="outline: none; display: none;"
- tabindex="-1"
- with-backdrop=""
- >
- <gr-confirm-delete-item-dialog class="confirmDialog" itemtypename="ID">
- </gr-confirm-delete-item-dialog
- ></gr-overlay>`);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `<div class="gr-form-styles">
+ <fieldset class="space">
+ <table>
+ <thead>
+ <tr>
+ <th class="statusHeader">Status</th>
+ <th class="emailAddressHeader">Email Address</th>
+ <th class="identityHeader">Identity</th>
+ <th class="deleteHeader"></th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td class="statusColumn">Untrusted</td>
+ <td class="emailAddressColumn">gerrit@example.com</td>
+ <td class="identityColumn">gerrit:gerrit</td>
+ <td class="deleteColumn">
+ <gr-button
+ aria-disabled="false"
+ class="deleteButton"
+ data-index="0"
+ role="button"
+ tabindex="0"
+ >
+ Delete
+ </gr-button>
+ </td>
+ </tr>
+ <tr>
+ <td class="statusColumn"></td>
+ <td class="emailAddressColumn">gerrit2@example.com</td>
+ <td class="identityColumn"></td>
+ <td class="deleteColumn">
+ <gr-button
+ aria-disabled="false"
+ class="deleteButton show"
+ data-index="1"
+ role="button"
+ tabindex="0"
+ >
+ Delete
+ </gr-button>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </fieldset>
+ </div>
+ <gr-overlay
+ aria-hidden="true"
+ id="overlay"
+ style="outline: none; display: none;"
+ tabindex="-1"
+ with-backdrop=""
+ >
+ <gr-confirm-delete-item-dialog
+ class="confirmDialog"
+ itemtypename="ID"
+ >
+ </gr-confirm-delete-item-dialog
+ ></gr-overlay>`
+ );
});
test('renders', () => {
diff --git a/polygerrit-ui/app/elements/settings/gr-menu-editor/gr-menu-editor_test.ts b/polygerrit-ui/app/elements/settings/gr-menu-editor/gr-menu-editor_test.ts
index c6130df..2bcb38f 100644
--- a/polygerrit-ui/app/elements/settings/gr-menu-editor/gr-menu-editor_test.ts
+++ b/polygerrit-ui/app/elements/settings/gr-menu-editor/gr-menu-editor_test.ts
@@ -11,7 +11,7 @@
import {PaperButtonElement} from '@polymer/paper-button';
import {TopMenuItemInfo} from '../../../types/common';
import {GrButton} from '../../shared/gr-button/gr-button';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import {createDefaultPreferences} from '../../../constants/constants';
suite('gr-menu-editor tests', () => {
@@ -56,189 +56,192 @@
});
test('renders', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div class="gr-form-styles">
- <h2 class="heading-2" id="Menu">Menu</h2>
- <fieldset id="menu">
- <table>
- <thead>
- <tr>
- <th>Name</th>
- <th>URL</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>first name</td>
- <td class="urlCell">/first/url</td>
- <td class="buttonColumn">
- <gr-button
- aria-disabled="false"
- class="moveUpButton"
- data-index="0"
- link=""
- role="button"
- tabindex="0"
- >
- ↑
- </gr-button>
- </td>
- <td class="buttonColumn">
- <gr-button
- aria-disabled="false"
- class="moveDownButton"
- data-index="0"
- link=""
- role="button"
- tabindex="0"
- >
- ↓
- </gr-button>
- </td>
- <td>
- <gr-button
- aria-disabled="false"
- class="remove-button"
- data-index="0"
- link=""
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- <tr>
- <td>second name</td>
- <td class="urlCell">/second/url</td>
- <td class="buttonColumn">
- <gr-button
- aria-disabled="false"
- class="moveUpButton"
- data-index="1"
- link=""
- role="button"
- tabindex="0"
- >
- ↑
- </gr-button>
- </td>
- <td class="buttonColumn">
- <gr-button
- aria-disabled="false"
- class="moveDownButton"
- data-index="1"
- link=""
- role="button"
- tabindex="0"
- >
- ↓
- </gr-button>
- </td>
- <td>
- <gr-button
- aria-disabled="false"
- class="remove-button"
- data-index="1"
- link=""
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- <tr>
- <td>third name</td>
- <td class="urlCell">/third/url</td>
- <td class="buttonColumn">
- <gr-button
- aria-disabled="false"
- class="moveUpButton"
- data-index="2"
- link=""
- role="button"
- tabindex="0"
- >
- ↑
- </gr-button>
- </td>
- <td class="buttonColumn">
- <gr-button
- aria-disabled="false"
- class="moveDownButton"
- data-index="2"
- link=""
- role="button"
- tabindex="0"
- >
- ↓
- </gr-button>
- </td>
- <td>
- <gr-button
- aria-disabled="false"
- class="remove-button"
- data-index="2"
- link=""
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- </tbody>
- <tfoot>
- <tr>
- <th>
- <iron-input>
- <input is="iron-input" placeholder="New Title" />
- </iron-input>
- </th>
- <th>
- <iron-input>
- <input class="newUrlInput" placeholder="New URL" />
- </iron-input>
- </th>
- <th></th>
- <th></th>
- <th>
- <gr-button
- aria-disabled="true"
- disabled=""
- id="add"
- link=""
- role="button"
- tabindex="-1"
- >
- Add
- </gr-button>
- </th>
- </tr>
- </tfoot>
- </table>
- <gr-button
- aria-disabled="true"
- disabled=""
- id="save"
- role="button"
- tabindex="-1"
- >
- Save changes
- </gr-button>
- <gr-button
- aria-disabled="false"
- id="reset"
- link=""
- role="button"
- tabindex="0"
- >
- Reset
- </gr-button>
- </fieldset>
- </div>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div class="gr-form-styles">
+ <h2 class="heading-2" id="Menu">Menu</h2>
+ <fieldset id="menu">
+ <table>
+ <thead>
+ <tr>
+ <th>Name</th>
+ <th>URL</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>first name</td>
+ <td class="urlCell">/first/url</td>
+ <td class="buttonColumn">
+ <gr-button
+ aria-disabled="false"
+ class="moveUpButton"
+ data-index="0"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ ↑
+ </gr-button>
+ </td>
+ <td class="buttonColumn">
+ <gr-button
+ aria-disabled="false"
+ class="moveDownButton"
+ data-index="0"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ ↓
+ </gr-button>
+ </td>
+ <td>
+ <gr-button
+ aria-disabled="false"
+ class="remove-button"
+ data-index="0"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Delete
+ </gr-button>
+ </td>
+ </tr>
+ <tr>
+ <td>second name</td>
+ <td class="urlCell">/second/url</td>
+ <td class="buttonColumn">
+ <gr-button
+ aria-disabled="false"
+ class="moveUpButton"
+ data-index="1"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ ↑
+ </gr-button>
+ </td>
+ <td class="buttonColumn">
+ <gr-button
+ aria-disabled="false"
+ class="moveDownButton"
+ data-index="1"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ ↓
+ </gr-button>
+ </td>
+ <td>
+ <gr-button
+ aria-disabled="false"
+ class="remove-button"
+ data-index="1"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Delete
+ </gr-button>
+ </td>
+ </tr>
+ <tr>
+ <td>third name</td>
+ <td class="urlCell">/third/url</td>
+ <td class="buttonColumn">
+ <gr-button
+ aria-disabled="false"
+ class="moveUpButton"
+ data-index="2"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ ↑
+ </gr-button>
+ </td>
+ <td class="buttonColumn">
+ <gr-button
+ aria-disabled="false"
+ class="moveDownButton"
+ data-index="2"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ ↓
+ </gr-button>
+ </td>
+ <td>
+ <gr-button
+ aria-disabled="false"
+ class="remove-button"
+ data-index="2"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Delete
+ </gr-button>
+ </td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <th>
+ <iron-input>
+ <input is="iron-input" placeholder="New Title" />
+ </iron-input>
+ </th>
+ <th>
+ <iron-input>
+ <input class="newUrlInput" placeholder="New URL" />
+ </iron-input>
+ </th>
+ <th></th>
+ <th></th>
+ <th>
+ <gr-button
+ aria-disabled="true"
+ disabled=""
+ id="add"
+ link=""
+ role="button"
+ tabindex="-1"
+ >
+ Add
+ </gr-button>
+ </th>
+ </tr>
+ </tfoot>
+ </table>
+ <gr-button
+ aria-disabled="true"
+ disabled=""
+ id="save"
+ role="button"
+ tabindex="-1"
+ >
+ Save changes
+ </gr-button>
+ <gr-button
+ aria-disabled="false"
+ id="reset"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Reset
+ </gr-button>
+ </fieldset>
+ </div>
+ `
+ );
});
test('add button disabled', async () => {
diff --git a/polygerrit-ui/app/elements/settings/gr-registration-dialog/gr-registration-dialog_test.ts b/polygerrit-ui/app/elements/settings/gr-registration-dialog/gr-registration-dialog_test.ts
index cb953d9..c8ffea5 100644
--- a/polygerrit-ui/app/elements/settings/gr-registration-dialog/gr-registration-dialog_test.ts
+++ b/polygerrit-ui/app/elements/settings/gr-registration-dialog/gr-registration-dialog_test.ts
@@ -13,7 +13,7 @@
createAccountWithId,
createServerInfo,
} from '../../../test/test-data-generators';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import {GrButton} from '../../shared/gr-button/gr-button';
suite('gr-registration-dialog tests', () => {
@@ -102,7 +102,9 @@
test('renders', () => {
// cannot format with /* HTML */, because it breaks test
- expect(element).shadowDom.to.equal(/* HTML*/ `<div
+ assert.shadowDom.equal(
+ element,
+ /* HTML*/ `<div
class="container gr-form-styles"
>
<header>Please confirm your contact information</header>
@@ -164,7 +166,8 @@
Save
</gr-button>
</footer>
- </div>`);
+ </div>`
+ );
});
test('fires the close event on close', async () => {
diff --git a/polygerrit-ui/app/elements/settings/gr-settings-view/gr-settings-view_test.ts b/polygerrit-ui/app/elements/settings/gr-settings-view/gr-settings-view_test.ts
index d407de1..5caa922 100644
--- a/polygerrit-ui/app/elements/settings/gr-settings-view/gr-settings-view_test.ts
+++ b/polygerrit-ui/app/elements/settings/gr-settings-view/gr-settings-view_test.ts
@@ -33,9 +33,7 @@
} from '../../../test/test-data-generators';
import {GrSelect} from '../../shared/gr-select/gr-select';
import {AppElementSettingsParam} from '../../gr-app-types';
-
-const basicFixture = fixtureFromElement('gr-settings-view');
-const blankFixture = fixtureFromElement('div');
+import {fixture, html} from '@open-wc/testing';
suite('gr-settings-view tests', () => {
let element: GrSettingsView;
@@ -109,8 +107,7 @@
stubRestApi('getPreferences').returns(Promise.resolve(preferences));
stubRestApi('getAccountEmails').returns(Promise.resolve(undefined));
stubRestApi('getConfig').returns(Promise.resolve(config));
- element = basicFixture.instantiate();
- await element.updateComplete;
+ element = await fixture(html`<gr-settings-view></gr-settings-view>`);
// Allow the element to render.
if (element._testOnly_loadingPromise)
@@ -125,7 +122,9 @@
element.docsBaseUrl = 'https://test.com';
await element.updateComplete;
// this cannot be formatted with /* HTML */, because it breaks test
- expect(element).shadowDom.to.equal(/* HTML*/ `<div
+ assert.shadowDom.equal(
+ element,
+ /* HTML*/ `<div
class="loading"
hidden=""
>
@@ -512,7 +511,8 @@
<gr-endpoint-decorator name="settings-screen">
</gr-endpoint-decorator>
</div>
- </div>`);
+ </div>`
+ );
});
test('theme changing', async () => {
@@ -535,15 +535,15 @@
assert.isTrue(reloadStub.calledTwice);
});
- test('calls the title-change event', () => {
+ test('calls the title-change event', async () => {
const titleChangedStub = sinon.stub();
// Create a new view.
const newElement = document.createElement('gr-settings-view');
newElement.addEventListener('title-change', titleChangedStub);
- const blank = blankFixture.instantiate();
- blank.appendChild(newElement);
+ const div = await fixture(html`<div></div>`);
+ div.appendChild(newElement);
flush();
diff --git a/polygerrit-ui/app/elements/settings/gr-ssh-editor/gr-ssh-editor_test.ts b/polygerrit-ui/app/elements/settings/gr-ssh-editor/gr-ssh-editor_test.ts
index 09e952c..4f7f8b6 100644
--- a/polygerrit-ui/app/elements/settings/gr-ssh-editor/gr-ssh-editor_test.ts
+++ b/polygerrit-ui/app/elements/settings/gr-ssh-editor/gr-ssh-editor_test.ts
@@ -10,8 +10,7 @@
import {SshKeyInfo} from '../../../types/common';
import {GrButton} from '../../shared/gr-button/gr-button';
import * as MockInteractions from '@polymer/iron-test-helpers/mock-interactions';
-
-const basicFixture = fixtureFromElement('gr-ssh-editor');
+import {fixture, html} from '@open-wc/testing';
suite('gr-ssh-editor tests', () => {
let element: GrSshEditor;
@@ -39,154 +38,157 @@
stubRestApi('getAccountSSHKeys').returns(Promise.resolve(keys));
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-ssh-editor></gr-ssh-editor>`);
await element.loadData();
await flush();
});
test('renders', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div class="gr-form-styles">
- <fieldset id="existing">
- <table>
- <thead>
- <tr>
- <th class="commentColumn">Comment</th>
- <th class="statusHeader">Status</th>
- <th class="keyHeader">Public key</th>
- <th></th>
- <th></th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td class="commentColumn">comment-one@machine-one</td>
- <td>Valid</td>
- <td>
- <gr-button
- aria-disabled="false"
- data-index="0"
- link=""
- role="button"
- tabindex="0"
- >
- Click to View
- </gr-button>
- </td>
- <td>
- <gr-copy-clipboard hastooltip="" hideinput="">
- </gr-copy-clipboard>
- </td>
- <td>
- <gr-button
- aria-disabled="false"
- data-index="0"
- link=""
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- <tr>
- <td class="commentColumn">comment-two@machine-two</td>
- <td>Valid</td>
- <td>
- <gr-button
- aria-disabled="false"
- data-index="1"
- link=""
- role="button"
- tabindex="0"
- >
- Click to View
- </gr-button>
- </td>
- <td>
- <gr-copy-clipboard hastooltip="" hideinput="">
- </gr-copy-clipboard>
- </td>
- <td>
- <gr-button
- aria-disabled="false"
- data-index="1"
- link=""
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- </tbody>
- </table>
- <gr-overlay
- aria-hidden="true"
- id="viewKeyOverlay"
- style="outline: none; display: none;"
- tabindex="-1"
- with-backdrop=""
- >
- <fieldset>
- <section>
- <span class="title"> Algorithm </span>
- <span class="value"> </span>
- </section>
- <section>
- <span class="title"> Public key </span>
- <span class="publicKey value"> </span>
- </section>
- <section>
- <span class="title"> Comment </span>
- <span class="value"> </span>
- </section>
- </fieldset>
- <gr-button
- aria-disabled="false"
- class="closeButton"
- role="button"
- tabindex="0"
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div class="gr-form-styles">
+ <fieldset id="existing">
+ <table>
+ <thead>
+ <tr>
+ <th class="commentColumn">Comment</th>
+ <th class="statusHeader">Status</th>
+ <th class="keyHeader">Public key</th>
+ <th></th>
+ <th></th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td class="commentColumn">comment-one@machine-one</td>
+ <td>Valid</td>
+ <td>
+ <gr-button
+ aria-disabled="false"
+ data-index="0"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Click to View
+ </gr-button>
+ </td>
+ <td>
+ <gr-copy-clipboard hastooltip="" hideinput="">
+ </gr-copy-clipboard>
+ </td>
+ <td>
+ <gr-button
+ aria-disabled="false"
+ data-index="0"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Delete
+ </gr-button>
+ </td>
+ </tr>
+ <tr>
+ <td class="commentColumn">comment-two@machine-two</td>
+ <td>Valid</td>
+ <td>
+ <gr-button
+ aria-disabled="false"
+ data-index="1"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Click to View
+ </gr-button>
+ </td>
+ <td>
+ <gr-copy-clipboard hastooltip="" hideinput="">
+ </gr-copy-clipboard>
+ </td>
+ <td>
+ <gr-button
+ aria-disabled="false"
+ data-index="1"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Delete
+ </gr-button>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ <gr-overlay
+ aria-hidden="true"
+ id="viewKeyOverlay"
+ style="outline: none; display: none;"
+ tabindex="-1"
+ with-backdrop=""
>
- Close
- </gr-button>
- </gr-overlay>
- <gr-button
- aria-disabled="true"
- disabled=""
- role="button"
- tabindex="-1"
- >
- Save changes
- </gr-button>
- </fieldset>
- <fieldset>
- <section>
- <span class="title"> New SSH key </span>
- <span class="value">
- <iron-autogrow-textarea
+ <fieldset>
+ <section>
+ <span class="title"> Algorithm </span>
+ <span class="value"> </span>
+ </section>
+ <section>
+ <span class="title"> Public key </span>
+ <span class="publicKey value"> </span>
+ </section>
+ <section>
+ <span class="title"> Comment </span>
+ <span class="value"> </span>
+ </section>
+ </fieldset>
+ <gr-button
aria-disabled="false"
- autocomplete="on"
- id="newKey"
- placeholder="New SSH Key"
+ class="closeButton"
+ role="button"
+ tabindex="0"
>
- </iron-autogrow-textarea>
- </span>
- </section>
- <gr-button
- aria-disabled="true"
- disabled=""
- id="addButton"
- link=""
- role="button"
- tabindex="-1"
- >
- Add new SSH key
- </gr-button>
- </fieldset>
- </div>
- `);
+ Close
+ </gr-button>
+ </gr-overlay>
+ <gr-button
+ aria-disabled="true"
+ disabled=""
+ role="button"
+ tabindex="-1"
+ >
+ Save changes
+ </gr-button>
+ </fieldset>
+ <fieldset>
+ <section>
+ <span class="title"> New SSH key </span>
+ <span class="value">
+ <iron-autogrow-textarea
+ aria-disabled="false"
+ autocomplete="on"
+ id="newKey"
+ placeholder="New SSH Key"
+ >
+ </iron-autogrow-textarea>
+ </span>
+ </section>
+ <gr-button
+ aria-disabled="true"
+ disabled=""
+ id="addButton"
+ link=""
+ role="button"
+ tabindex="-1"
+ >
+ Add new SSH key
+ </gr-button>
+ </fieldset>
+ </div>
+ `
+ );
});
test('remove key', async () => {
diff --git a/polygerrit-ui/app/elements/settings/gr-watched-projects-editor/gr-watched-projects-editor_test.ts b/polygerrit-ui/app/elements/settings/gr-watched-projects-editor/gr-watched-projects-editor_test.ts
index 0c2c2ef..60dcb44 100644
--- a/polygerrit-ui/app/elements/settings/gr-watched-projects-editor/gr-watched-projects-editor_test.ts
+++ b/polygerrit-ui/app/elements/settings/gr-watched-projects-editor/gr-watched-projects-editor_test.ts
@@ -12,8 +12,7 @@
import * as MockInteractions from '@polymer/iron-test-helpers/mock-interactions';
import {IronInputElement} from '@polymer/iron-input';
import {assertIsDefined} from '../../../utils/common-util';
-
-const basicFixture = fixtureFromElement('gr-watched-projects-editor');
+import {fixture, html} from '@open-wc/testing';
suite('gr-watched-projects-editor tests', () => {
let element: GrWatchedProjectsEditor;
@@ -57,208 +56,213 @@
}
});
- element = basicFixture.instantiate();
+ element = await fixture(
+ html`<gr-watched-projects-editor></gr-watched-projects-editor>`
+ );
await element.loadData();
await element.updateComplete;
});
test('renders', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div class="gr-form-styles">
- <table id="watchedProjects">
- <thead>
- <tr>
- <th>Repo</th>
- <th class="notifType">Changes</th>
- <th class="notifType">Patches</th>
- <th class="notifType">Comments</th>
- <th class="notifType">Submits</th>
- <th class="notifType">Abandons</th>
- <th></th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>project a</td>
- <td class="notifControl">
- <input data-key="notify_new_changes" type="checkbox" />
- </td>
- <td class="notifControl">
- <input data-key="notify_new_patch_sets" type="checkbox" />
- </td>
- <td class="notifControl">
- <input data-key="notify_all_comments" type="checkbox" />
- </td>
- <td class="notifControl">
- <input
- checked=""
- data-key="notify_submitted_changes"
- type="checkbox"
- />
- </td>
- <td class="notifControl">
- <input
- checked=""
- data-key="notify_abandoned_changes"
- type="checkbox"
- />
- </td>
- <td>
- <gr-button
- aria-disabled="false"
- link=""
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- <tr>
- <td>
- project b
- <div class="projectFilter">filter 1</div>
- </td>
- <td class="notifControl">
- <input
- checked=""
- data-key="notify_new_changes"
- type="checkbox"
- />
- </td>
- <td class="notifControl">
- <input data-key="notify_new_patch_sets" type="checkbox" />
- </td>
- <td class="notifControl">
- <input data-key="notify_all_comments" type="checkbox" />
- </td>
- <td class="notifControl">
- <input data-key="notify_submitted_changes" type="checkbox" />
- </td>
- <td class="notifControl">
- <input data-key="notify_abandoned_changes" type="checkbox" />
- </td>
- <td>
- <gr-button
- aria-disabled="false"
- link=""
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- <tr>
- <td>
- project b
- <div class="projectFilter">filter 2</div>
- </td>
- <td class="notifControl">
- <input data-key="notify_new_changes" type="checkbox" />
- </td>
- <td class="notifControl">
- <input data-key="notify_new_patch_sets" type="checkbox" />
- </td>
- <td class="notifControl">
- <input data-key="notify_all_comments" type="checkbox" />
- </td>
- <td class="notifControl">
- <input data-key="notify_submitted_changes" type="checkbox" />
- </td>
- <td class="notifControl">
- <input data-key="notify_abandoned_changes" type="checkbox" />
- </td>
- <td>
- <gr-button
- aria-disabled="false"
- link=""
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- <tr>
- <td>project c</td>
- <td class="notifControl">
- <input
- checked=""
- data-key="notify_new_changes"
- type="checkbox"
- />
- </td>
- <td class="notifControl">
- <input
- checked=""
- data-key="notify_new_patch_sets"
- type="checkbox"
- />
- </td>
- <td class="notifControl">
- <input
- checked=""
- data-key="notify_all_comments"
- type="checkbox"
- />
- </td>
- <td class="notifControl">
- <input data-key="notify_submitted_changes" type="checkbox" />
- </td>
- <td class="notifControl">
- <input data-key="notify_abandoned_changes" type="checkbox" />
- </td>
- <td>
- <gr-button
- aria-disabled="false"
- link=""
- role="button"
- tabindex="0"
- >
- Delete
- </gr-button>
- </td>
- </tr>
- </tbody>
- <tfoot>
- <tr>
- <th>
- <gr-autocomplete
- allow-non-suggested-values=""
- id="newProject"
- placeholder="Repo"
- query="input => this.getProjectSuggestions(input)"
- tab-complete=""
- threshold="1"
- >
- </gr-autocomplete>
- </th>
- <th colspan="5">
- <iron-input class="newFilterInput" id="newFilterInput">
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div class="gr-form-styles">
+ <table id="watchedProjects">
+ <thead>
+ <tr>
+ <th>Repo</th>
+ <th class="notifType">Changes</th>
+ <th class="notifType">Patches</th>
+ <th class="notifType">Comments</th>
+ <th class="notifType">Submits</th>
+ <th class="notifType">Abandons</th>
+ <th></th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>project a</td>
+ <td class="notifControl">
+ <input data-key="notify_new_changes" type="checkbox" />
+ </td>
+ <td class="notifControl">
+ <input data-key="notify_new_patch_sets" type="checkbox" />
+ </td>
+ <td class="notifControl">
+ <input data-key="notify_all_comments" type="checkbox" />
+ </td>
+ <td class="notifControl">
<input
- class="newFilterInput"
- id="newFilter"
- placeholder="branch:name, or other search expression"
+ checked=""
+ data-key="notify_submitted_changes"
+ type="checkbox"
/>
- </iron-input>
- </th>
- <th>
- <gr-button
- aria-disabled="false"
- link=""
- role="button"
- tabindex="0"
- >
- Add
- </gr-button>
- </th>
- </tr>
- </tfoot>
- </table>
- </div>
- `);
+ </td>
+ <td class="notifControl">
+ <input
+ checked=""
+ data-key="notify_abandoned_changes"
+ type="checkbox"
+ />
+ </td>
+ <td>
+ <gr-button
+ aria-disabled="false"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Delete
+ </gr-button>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ project b
+ <div class="projectFilter">filter 1</div>
+ </td>
+ <td class="notifControl">
+ <input
+ checked=""
+ data-key="notify_new_changes"
+ type="checkbox"
+ />
+ </td>
+ <td class="notifControl">
+ <input data-key="notify_new_patch_sets" type="checkbox" />
+ </td>
+ <td class="notifControl">
+ <input data-key="notify_all_comments" type="checkbox" />
+ </td>
+ <td class="notifControl">
+ <input data-key="notify_submitted_changes" type="checkbox" />
+ </td>
+ <td class="notifControl">
+ <input data-key="notify_abandoned_changes" type="checkbox" />
+ </td>
+ <td>
+ <gr-button
+ aria-disabled="false"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Delete
+ </gr-button>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ project b
+ <div class="projectFilter">filter 2</div>
+ </td>
+ <td class="notifControl">
+ <input data-key="notify_new_changes" type="checkbox" />
+ </td>
+ <td class="notifControl">
+ <input data-key="notify_new_patch_sets" type="checkbox" />
+ </td>
+ <td class="notifControl">
+ <input data-key="notify_all_comments" type="checkbox" />
+ </td>
+ <td class="notifControl">
+ <input data-key="notify_submitted_changes" type="checkbox" />
+ </td>
+ <td class="notifControl">
+ <input data-key="notify_abandoned_changes" type="checkbox" />
+ </td>
+ <td>
+ <gr-button
+ aria-disabled="false"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Delete
+ </gr-button>
+ </td>
+ </tr>
+ <tr>
+ <td>project c</td>
+ <td class="notifControl">
+ <input
+ checked=""
+ data-key="notify_new_changes"
+ type="checkbox"
+ />
+ </td>
+ <td class="notifControl">
+ <input
+ checked=""
+ data-key="notify_new_patch_sets"
+ type="checkbox"
+ />
+ </td>
+ <td class="notifControl">
+ <input
+ checked=""
+ data-key="notify_all_comments"
+ type="checkbox"
+ />
+ </td>
+ <td class="notifControl">
+ <input data-key="notify_submitted_changes" type="checkbox" />
+ </td>
+ <td class="notifControl">
+ <input data-key="notify_abandoned_changes" type="checkbox" />
+ </td>
+ <td>
+ <gr-button
+ aria-disabled="false"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Delete
+ </gr-button>
+ </td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <th>
+ <gr-autocomplete
+ allow-non-suggested-values=""
+ id="newProject"
+ placeholder="Repo"
+ query="input => this.getProjectSuggestions(input)"
+ tab-complete=""
+ threshold="1"
+ >
+ </gr-autocomplete>
+ </th>
+ <th colspan="5">
+ <iron-input class="newFilterInput" id="newFilterInput">
+ <input
+ class="newFilterInput"
+ id="newFilter"
+ placeholder="branch:name, or other search expression"
+ />
+ </iron-input>
+ </th>
+ <th>
+ <gr-button
+ aria-disabled="false"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Add
+ </gr-button>
+ </th>
+ </tr>
+ </tfoot>
+ </table>
+ </div>
+ `
+ );
});
test('getProjectSuggestions empty', async () => {
diff --git a/polygerrit-ui/app/elements/shared/gr-account-chip/gr-account-chip_test.ts b/polygerrit-ui/app/elements/shared/gr-account-chip/gr-account-chip_test.ts
index 408bb74..f0c556e 100644
--- a/polygerrit-ui/app/elements/shared/gr-account-chip/gr-account-chip_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-account-chip/gr-account-chip_test.ts
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
import '../../../test/common-test-setup-karma';
-import {fixture} from '@open-wc/testing-helpers';
+import {fixture} from '@open-wc/testing';
import {html} from 'lit';
import './gr-account-chip';
import {GrAccountChip} from './gr-account-chip';
@@ -25,25 +25,28 @@
});
test('renders', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div class="container">
- <div>
- <gr-account-label clickable="" deselected=""></gr-account-label>
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div class="container">
+ <div>
+ <gr-account-label clickable="" deselected=""></gr-account-label>
+ </div>
+ <slot name="vote-chip"></slot>
+ <gr-button
+ aria-disabled="false"
+ aria-label="Remove"
+ class="remove"
+ hidden=""
+ id="remove"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ <gr-icon icon="close"></gr-icon>
+ </gr-button>
</div>
- <slot name="vote-chip"></slot>
- <gr-button
- aria-disabled="false"
- aria-label="Remove"
- class="remove"
- hidden=""
- id="remove"
- link=""
- role="button"
- tabindex="0"
- >
- <gr-icon icon="close"></gr-icon>
- </gr-button>
- </div>
- `);
+ `
+ );
});
});
diff --git a/polygerrit-ui/app/elements/shared/gr-account-entry/gr-account-entry_test.ts b/polygerrit-ui/app/elements/shared/gr-account-entry/gr-account-entry_test.ts
index 285380e..4fd9449 100644
--- a/polygerrit-ui/app/elements/shared/gr-account-entry/gr-account-entry_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-account-entry/gr-account-entry_test.ts
@@ -6,7 +6,7 @@
import '../../../test/common-test-setup-karma';
import './gr-account-entry';
import {GrAccountEntry} from './gr-account-entry';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import {queryAndAssert, waitUntil} from '../../../test/test-utils';
import {GrAutocomplete} from '../gr-autocomplete/gr-autocomplete';
import {PaperInputElement} from '@polymer/paper-input/paper-input';
@@ -22,15 +22,18 @@
});
test('renders', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <gr-autocomplete
- allow-non-suggested-values="false"
- clear-on-commit=""
- id="input"
- warn-uncommitted=""
- >
- </gr-autocomplete>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <gr-autocomplete
+ allow-non-suggested-values="false"
+ clear-on-commit=""
+ id="input"
+ warn-uncommitted=""
+ >
+ </gr-autocomplete>
+ `
+ );
});
test('account-text-changed fired when input text changed and allowAnyInput', async () => {
diff --git a/polygerrit-ui/app/elements/shared/gr-account-label/gr-account-label_test.ts b/polygerrit-ui/app/elements/shared/gr-account-label/gr-account-label_test.ts
index 1eb8711..9e0bf46 100644
--- a/polygerrit-ui/app/elements/shared/gr-account-label/gr-account-label_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-account-label/gr-account-label_test.ts
@@ -21,8 +21,7 @@
createServerInfo,
} from '../../../test/test-data-generators';
import * as MockInteractions from '@polymer/iron-test-helpers/mock-interactions';
-
-const basicFixture = fixtureFromElement('gr-account-label');
+import {fixture, html} from '@open-wc/testing';
suite('gr-account-label tests', () => {
let element: GrAccountLabel;
@@ -45,47 +44,18 @@
anonymous_coward_name: 'Anonymous Coward',
},
});
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-account-label></gr-account-label>`);
await element.updateComplete;
});
test('renders', async () => {
element.account = kermit;
await element.updateComplete;
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div class="container">
- <gr-hovercard-account for="hovercardTarget"></gr-hovercard-account>
- <span class="hovercardTargetWrapper">
- <gr-avatar hidden="" imagesize="32"> </gr-avatar>
- <span
- class="name"
- id="hovercardTarget"
- part="gr-account-label-text"
- role="button"
- tabindex="0"
- >
- kermit
- </span>
- <gr-endpoint-decorator
- class="accountStatusDecorator"
- name="account-status-icon"
- >
- <gr-endpoint-param name="accountId"></gr-endpoint-param>
- <span class="rightSidePadding"></span>
- </gr-endpoint-decorator>
- </span>
- </div>
- `);
- });
-
- test('renders clickable', async () => {
- element.account = kermit;
- element.clickable = true;
- await element.updateComplete;
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div class="container">
- <gr-hovercard-account for="hovercardTarget"></gr-hovercard-account>
- <a class="ownerLink" href="test" tabindex="-1">
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div class="container">
+ <gr-hovercard-account for="hovercardTarget"></gr-hovercard-account>
<span class="hovercardTargetWrapper">
<gr-avatar hidden="" imagesize="32"> </gr-avatar>
<span
@@ -105,9 +75,44 @@
<span class="rightSidePadding"></span>
</gr-endpoint-decorator>
</span>
- </a>
- </div>
- `);
+ </div>
+ `
+ );
+ });
+
+ test('renders clickable', async () => {
+ element.account = kermit;
+ element.clickable = true;
+ await element.updateComplete;
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div class="container">
+ <gr-hovercard-account for="hovercardTarget"></gr-hovercard-account>
+ <a class="ownerLink" href="test" tabindex="-1">
+ <span class="hovercardTargetWrapper">
+ <gr-avatar hidden="" imagesize="32"> </gr-avatar>
+ <span
+ class="name"
+ id="hovercardTarget"
+ part="gr-account-label-text"
+ role="button"
+ tabindex="0"
+ >
+ kermit
+ </span>
+ <gr-endpoint-decorator
+ class="accountStatusDecorator"
+ name="account-status-icon"
+ >
+ <gr-endpoint-param name="accountId"></gr-endpoint-param>
+ <span class="rightSidePadding"></span>
+ </gr-endpoint-decorator>
+ </span>
+ </a>
+ </div>
+ `
+ );
});
suite('_computeName', () => {
diff --git a/polygerrit-ui/app/elements/shared/gr-account-list/gr-account-list_test.ts b/polygerrit-ui/app/elements/shared/gr-account-list/gr-account-list_test.ts
index 873b6cf..44980f2 100644
--- a/polygerrit-ui/app/elements/shared/gr-account-list/gr-account-list_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-account-list/gr-account-list_test.ts
@@ -30,8 +30,7 @@
import {GrAccountEntry} from '../gr-account-entry/gr-account-entry';
import {createChange} from '../../../test/test-data-generators';
import {ReviewerState} from '../../../api/rest-api';
-
-const basicFixture = fixtureFromElement('gr-account-list');
+import {fixture, html} from '@open-wc/testing';
class MockSuggestionsProvider implements ReviewerSuggestionsProvider {
init() {}
@@ -93,7 +92,7 @@
existingAccount1 = makeAccount();
existingAccount2 = makeAccount();
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-account-list></gr-account-list>`);
element.accounts = [existingAccount1, existingAccount2];
element.reviewerState = ReviewerState.REVIEWER;
element.change = {...createChange()};
@@ -104,7 +103,8 @@
});
test('renders', () => {
- expect(element).shadowDom.to.equal(
+ assert.shadowDom.equal(
+ element,
/* HTML */
`<div class="list">
<gr-account-chip removable="" tabindex="-1"> </gr-account-chip>
diff --git a/polygerrit-ui/app/elements/shared/gr-alert/gr-alert_test.ts b/polygerrit-ui/app/elements/shared/gr-alert/gr-alert_test.ts
index 643d14c..173d154 100644
--- a/polygerrit-ui/app/elements/shared/gr-alert/gr-alert_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-alert/gr-alert_test.ts
@@ -27,20 +27,23 @@
element.show('Alert text');
await element.updateComplete;
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div class="content-wrapper">
- <span class="text"> Alert text </span>
- <gr-button
- aria-disabled="false"
- class="action"
- hidden=""
- link=""
- role="button"
- tabindex="0"
- >
- </gr-button>
- </div>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div class="content-wrapper">
+ <span class="text"> Alert text </span>
+ <gr-button
+ aria-disabled="false"
+ class="action"
+ hidden=""
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ </gr-button>
+ </div>
+ `
+ );
});
test('show/hide', async () => {
diff --git a/polygerrit-ui/app/elements/shared/gr-autocomplete-dropdown/gr-autocomplete-dropdown_test.ts b/polygerrit-ui/app/elements/shared/gr-autocomplete-dropdown/gr-autocomplete-dropdown_test.ts
index c9c3922..49150f0 100644
--- a/polygerrit-ui/app/elements/shared/gr-autocomplete-dropdown/gr-autocomplete-dropdown_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-autocomplete-dropdown/gr-autocomplete-dropdown_test.ts
@@ -9,8 +9,7 @@
import * as MockInteractions from '@polymer/iron-test-helpers/mock-interactions';
import {queryAll, queryAndAssert} from '../../../test/test-utils';
import {assertIsDefined} from '../../../utils/common-util';
-
-const basicFixture = fixtureFromElement('gr-autocomplete-dropdown');
+import {fixture, html} from '@open-wc/testing';
suite('gr-autocomplete-dropdown', () => {
let element: GrAutocompleteDropdown;
@@ -18,7 +17,9 @@
const suggestionsEl = () => queryAndAssert(element, '#suggestions');
setup(async () => {
- element = basicFixture.instantiate();
+ element = await fixture(
+ html`<gr-autocomplete-dropdown></gr-autocomplete-dropdown>`
+ );
element.open();
element.suggestions = [
{dataValue: 'test value 1', name: 'test name 1', text: '1', label: 'hi'},
@@ -32,42 +33,45 @@
});
test('renders', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div
- class="dropdown-content"
- id="suggestions"
- role="listbox"
- slot="dropdown-content"
- >
- <ul>
- <li
- aria-label="test name 1"
- class="autocompleteOption selected"
- data-index="0"
- data-value="test value 1"
- role="option"
- tabindex="-1"
- >
- <span> 1 </span>
- <span class="label"> hi </span>
- </li>
- <li
- aria-label="test name 2"
- class="autocompleteOption"
- data-index="1"
- data-value="test value 2"
- role="option"
- tabindex="-1"
- >
- <span> 2 </span>
- <span class="hide label"> </span>
- </li>
- <dom-repeat style="display: none;">
- <template is="dom-repeat"> </template>
- </dom-repeat>
- </ul>
- </div>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div
+ class="dropdown-content"
+ id="suggestions"
+ role="listbox"
+ slot="dropdown-content"
+ >
+ <ul>
+ <li
+ aria-label="test name 1"
+ class="autocompleteOption selected"
+ data-index="0"
+ data-value="test value 1"
+ role="option"
+ tabindex="-1"
+ >
+ <span> 1 </span>
+ <span class="label"> hi </span>
+ </li>
+ <li
+ aria-label="test name 2"
+ class="autocompleteOption"
+ data-index="1"
+ data-value="test value 2"
+ role="option"
+ tabindex="-1"
+ >
+ <span> 2 </span>
+ <span class="hide label"> </span>
+ </li>
+ <dom-repeat style="display: none;">
+ <template is="dom-repeat"> </template>
+ </dom-repeat>
+ </ul>
+ </div>
+ `
+ );
});
test('shows labels', () => {
diff --git a/polygerrit-ui/app/elements/shared/gr-autocomplete/gr-autocomplete_test.ts b/polygerrit-ui/app/elements/shared/gr-autocomplete/gr-autocomplete_test.ts
index d67637e..e41eea3 100644
--- a/polygerrit-ui/app/elements/shared/gr-autocomplete/gr-autocomplete_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-autocomplete/gr-autocomplete_test.ts
@@ -10,7 +10,7 @@
import {queryAndAssert, waitUntil} from '../../../test/test-utils';
import {GrAutocompleteDropdown} from '../gr-autocomplete-dropdown/gr-autocomplete-dropdown';
import {PaperInputElement} from '@polymer/paper-input/paper-input';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import {Key} from '../../../utils/dom-util';
suite('gr-autocomplete tests', () => {
@@ -32,7 +32,8 @@
});
test('renders', () => {
- expect(element).shadowDom.to.equal(
+ assert.shadowDom.equal(
+ element,
/* HTML */ `
<paper-input
aria-disabled="false"
@@ -83,7 +84,8 @@
await waitUntil(() => queryStub.called);
await element.updateComplete;
- expect(element).shadowDom.to.equal(
+ assert.shadowDom.equal(
+ element,
/* HTML */ `
<paper-input
aria-disabled="false"
diff --git a/polygerrit-ui/app/elements/shared/gr-avatar/gr-avatar_test.ts b/polygerrit-ui/app/elements/shared/gr-avatar/gr-avatar_test.ts
index d25b74f..43b5402 100644
--- a/polygerrit-ui/app/elements/shared/gr-avatar/gr-avatar_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-avatar/gr-avatar_test.ts
@@ -12,7 +12,7 @@
createAccountWithId,
createServerInfo,
} from '../../../test/test-data-generators';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import {isVisible, stubRestApi} from '../../../test/test-utils';
suite('gr-avatar tests', () => {
diff --git a/polygerrit-ui/app/elements/shared/gr-button/gr-button_test.ts b/polygerrit-ui/app/elements/shared/gr-button/gr-button_test.ts
index 031711f..35db0bc 100644
--- a/polygerrit-ui/app/elements/shared/gr-button/gr-button_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-button/gr-button_test.ts
@@ -7,7 +7,7 @@
import '../../../test/common-test-setup-karma';
import './gr-button';
import {addListener} from '@polymer/polymer/lib/utils/gestures';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import {GrButton} from './gr-button';
import {pressKey, queryAndAssert} from '../../../test/test-utils';
import {PaperButtonElement} from '@polymer/paper-button';
@@ -32,18 +32,21 @@
});
test('renders', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <paper-button
- animated=""
- aria-disabled="false"
- elevation="1"
- part="paper-button"
- raised=""
- role="button"
- tabindex="-1"
- ><slot></slot><i class="downArrow"></i>
- </paper-button>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <paper-button
+ animated=""
+ aria-disabled="false"
+ elevation="1"
+ part="paper-button"
+ raised=""
+ role="button"
+ tabindex="-1"
+ ><slot></slot><i class="downArrow"></i>
+ </paper-button>
+ `
+ );
});
test('disabled is set by disabled', async () => {
diff --git a/polygerrit-ui/app/elements/shared/gr-change-star/gr-change-star.ts b/polygerrit-ui/app/elements/shared/gr-change-star/gr-change-star.ts
index 13a56ba..1a0e1d9 100644
--- a/polygerrit-ui/app/elements/shared/gr-change-star/gr-change-star.ts
+++ b/polygerrit-ui/app/elements/shared/gr-change-star/gr-change-star.ts
@@ -69,7 +69,7 @@
@click=${this.toggleStar}
>
<gr-icon
- icon="grade"
+ icon="star_rate"
?filled=${!!this.change?.starred}
class=${this.change?.starred ? 'active' : ''}
></gr-icon>
diff --git a/polygerrit-ui/app/elements/shared/gr-change-star/gr-change-star_test.ts b/polygerrit-ui/app/elements/shared/gr-change-star/gr-change-star_test.ts
index cc8a471..5592f5f 100644
--- a/polygerrit-ui/app/elements/shared/gr-change-star/gr-change-star_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-change-star/gr-change-star_test.ts
@@ -9,14 +9,13 @@
import './gr-change-star';
import * as MockInteractions from '@polymer/iron-test-helpers/mock-interactions';
import {createChange} from '../../../test/test-data-generators';
-
-const basicFixture = fixtureFromElement('gr-change-star');
+import {fixture, html} from '@open-wc/testing';
suite('gr-change-star tests', () => {
let element: GrChangeStar;
setup(async () => {
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-change-star></gr-change-star>`);
element.change = {
...createChange(),
starred: true,
@@ -25,15 +24,18 @@
});
test('renders starred', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <button
- aria-label="Unstar this change"
- role="checkbox"
- title="Star/unstar change (shortcut: s)"
- >
- <gr-icon icon="grade" filled class="active"></gr-icon>
- </button>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <button
+ aria-label="Unstar this change"
+ role="checkbox"
+ title="Star/unstar change (shortcut: s)"
+ >
+ <gr-icon icon="star_rate" filled class="active"></gr-icon>
+ </button>
+ `
+ );
});
test('renders unstarred', async () => {
@@ -41,15 +43,18 @@
element.requestUpdate('change');
await element.updateComplete;
- expect(element).shadowDom.to.equal(/* HTML */ `
- <button
- aria-label="Star this change"
- role="checkbox"
- title="Star/unstar change (shortcut: s)"
- >
- <gr-icon icon="grade"></gr-icon>
- </button>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <button
+ aria-label="Star this change"
+ role="checkbox"
+ title="Star/unstar change (shortcut: s)"
+ >
+ <gr-icon icon="star_rate"></gr-icon>
+ </button>
+ `
+ );
});
test('starring', async () => {
diff --git a/polygerrit-ui/app/elements/shared/gr-change-status/gr-change-status_test.ts b/polygerrit-ui/app/elements/shared/gr-change-status/gr-change-status_test.ts
index 8bffa4c..d93fea0 100644
--- a/polygerrit-ui/app/elements/shared/gr-change-status/gr-change-status_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-change-status/gr-change-status_test.ts
@@ -9,7 +9,7 @@
import {ChangeStates, GrChangeStatus, WIP_TOOLTIP} from './gr-change-status';
import {GerritNav} from '../../core/gr-navigation/gr-navigation';
import {MERGE_CONFLICT_TOOLTIP} from './gr-change-status';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import {queryAndAssert} from '../../../test/test-utils';
const PRIVATE_TOOLTIP =
@@ -29,16 +29,19 @@
element.status = ChangeStates.WIP;
await element.updateComplete;
- expect(element).shadowDom.to.equal(/* HTML */ `
- <gr-tooltip-content
- has-tooltip=""
- max-width="40em"
- position-below=""
- title="This change isn't ready to be reviewed or submitted. It will not appear on dashboards unless you are in the attention set, and email notifications will be silenced until the review is started."
- >
- <div aria-label="Label: WIP" class="chip">Work in Progress</div>
- </gr-tooltip-content>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <gr-tooltip-content
+ has-tooltip=""
+ max-width="40em"
+ position-below=""
+ title="This change isn't ready to be reviewed or submitted. It will not appear on dashboards unless you are in the attention set, and email notifications will be silenced until the review is started."
+ >
+ <div aria-label="Label: WIP" class="chip">Work in Progress</div>
+ </gr-tooltip-content>
+ `
+ );
});
test('WIP', async () => {
diff --git a/polygerrit-ui/app/elements/shared/gr-comment-thread/gr-comment-thread_test.ts b/polygerrit-ui/app/elements/shared/gr-comment-thread/gr-comment-thread_test.ts
index 53ebf6a..7be39e7 100644
--- a/polygerrit-ui/app/elements/shared/gr-comment-thread/gr-comment-thread_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-comment-thread/gr-comment-thread_test.ts
@@ -27,9 +27,7 @@
} from '../../../test/test-data-generators';
import {tap} from '@polymer/iron-test-helpers/mock-interactions';
import {SinonStub} from 'sinon';
-import {waitUntil} from '@open-wc/testing-helpers';
-
-const basicFixture = fixtureFromElement('gr-comment-thread');
+import {fixture, html, waitUntil} from '@open-wc/testing';
const c1 = {
author: {name: 'Kermit'},
@@ -73,7 +71,7 @@
setup(async () => {
stubRestApi('getLoggedIn').returns(Promise.resolve(false));
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-comment-thread></gr-comment-thread>`);
element.changeNum = 1 as NumericChangeId;
element.showFileName = true;
element.showFilePath = true;
@@ -85,204 +83,221 @@
test('renders with draft', async () => {
element.thread = createThread(c1, c2, c3);
await element.updateComplete;
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div class="fileName">
- <span>test-path-comment-thread</span>
- <gr-copy-clipboard hideinput=""></gr-copy-clipboard>
- </div>
- <div class="pathInfo">
- <span>#314</span>
- </div>
- <div id="container">
- <h3 class="assistive-tech-only">Draft Comment thread by Kermit</h3>
- <div class="comment-box" tabindex="0">
- <gr-comment
- collapsed=""
- initially-collapsed=""
- robot-button-disabled=""
- show-patchset=""
- ></gr-comment>
- <gr-comment
- collapsed=""
- initially-collapsed=""
- robot-button-disabled=""
- show-patchset=""
- ></gr-comment>
- <gr-comment robot-button-disabled="" show-patchset=""></gr-comment>
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div class="fileName">
+ <span>test-path-comment-thread</span>
+ <gr-copy-clipboard hideinput=""></gr-copy-clipboard>
</div>
- </div>
- `);
+ <div class="pathInfo">
+ <span>#314</span>
+ </div>
+ <div id="container">
+ <h3 class="assistive-tech-only">Draft Comment thread by Kermit</h3>
+ <div class="comment-box" tabindex="0">
+ <gr-comment
+ collapsed=""
+ initially-collapsed=""
+ robot-button-disabled=""
+ show-patchset=""
+ ></gr-comment>
+ <gr-comment
+ collapsed=""
+ initially-collapsed=""
+ robot-button-disabled=""
+ show-patchset=""
+ ></gr-comment>
+ <gr-comment robot-button-disabled="" show-patchset=""></gr-comment>
+ </div>
+ </div>
+ `
+ );
});
test('renders unsaved', async () => {
element.thread = createThread();
await element.updateComplete;
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div class="fileName">
- <span>test-path-comment-thread</span>
- <gr-copy-clipboard hideinput=""></gr-copy-clipboard>
- </div>
- <div class="pathInfo">
- <span>#314</span>
- </div>
- <div id="container">
- <h3 class="assistive-tech-only">
- Unresolved Draft Comment thread by Yoda
- </h3>
- <div class="comment-box unresolved" tabindex="0">
- <gr-comment robot-button-disabled="" show-patchset=""></gr-comment>
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div class="fileName">
+ <span>test-path-comment-thread</span>
+ <gr-copy-clipboard hideinput=""></gr-copy-clipboard>
</div>
- </div>
- `);
+ <div class="pathInfo">
+ <span>#314</span>
+ </div>
+ <div id="container">
+ <h3 class="assistive-tech-only">
+ Unresolved Draft Comment thread by Yoda
+ </h3>
+ <div class="comment-box unresolved" tabindex="0">
+ <gr-comment robot-button-disabled="" show-patchset=""></gr-comment>
+ </div>
+ </div>
+ `
+ );
});
test('renders with actions resolved', async () => {
element.thread = createThread(c1, c2);
await element.updateComplete;
- expect(queryAndAssert(element, '#container')).dom.to.equal(/* HTML */ `
- <div id="container">
- <h3 class="assistive-tech-only">Comment thread by Kermit</h3>
- <div class="comment-box" tabindex="0">
- <gr-comment
- collapsed=""
- initially-collapsed=""
- show-patchset=""
- ></gr-comment>
- <gr-comment
- collapsed=""
- initially-collapsed=""
- show-patchset=""
- ></gr-comment>
- <div id="actionsContainer">
- <span id="unresolvedLabel"> Resolved </span>
- <div id="actions">
- <gr-button
- aria-disabled="false"
- class="action reply"
- id="replyBtn"
- link=""
- role="button"
- tabindex="0"
- >
- Reply
- </gr-button>
- <gr-button
- aria-disabled="false"
- class="action quote"
- id="quoteBtn"
- link=""
- role="button"
- tabindex="0"
- >
- Quote
- </gr-button>
- <gr-icon
- icon="link"
- class="copy link-icon"
- role="button"
- tabindex="0"
- title="Copy link to this comment"
- ></gr-icon>
+ assert.dom.equal(
+ queryAndAssert(element, '#container'),
+ /* HTML */ `
+ <div id="container">
+ <h3 class="assistive-tech-only">Comment thread by Kermit</h3>
+ <div class="comment-box" tabindex="0">
+ <gr-comment
+ collapsed=""
+ initially-collapsed=""
+ show-patchset=""
+ ></gr-comment>
+ <gr-comment
+ collapsed=""
+ initially-collapsed=""
+ show-patchset=""
+ ></gr-comment>
+ <div id="actionsContainer">
+ <span id="unresolvedLabel"> Resolved </span>
+ <div id="actions">
+ <gr-button
+ aria-disabled="false"
+ class="action reply"
+ id="replyBtn"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Reply
+ </gr-button>
+ <gr-button
+ aria-disabled="false"
+ class="action quote"
+ id="quoteBtn"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Quote
+ </gr-button>
+ <gr-icon
+ icon="link"
+ class="copy link-icon"
+ role="button"
+ tabindex="0"
+ title="Copy link to this comment"
+ ></gr-icon>
+ </div>
</div>
</div>
</div>
- </div>
- `);
+ `
+ );
});
test('renders with actions unresolved', async () => {
element.thread = createThread(c1, {...c2, unresolved: true});
await element.updateComplete;
- expect(queryAndAssert(element, '#container')).dom.to.equal(/* HTML */ `
- <div id="container">
- <h3 class="assistive-tech-only">Unresolved Comment thread by Kermit</h3>
- <div class="comment-box unresolved" tabindex="0">
- <gr-comment show-patchset=""></gr-comment>
- <gr-comment show-patchset=""></gr-comment>
- <div id="actionsContainer">
- <span id="unresolvedLabel"> Unresolved </span>
- <div id="actions">
- <gr-button
- aria-disabled="false"
- class="action reply"
- id="replyBtn"
- link=""
- role="button"
- tabindex="0"
- >
- Reply
- </gr-button>
- <gr-button
- aria-disabled="false"
- class="action quote"
- id="quoteBtn"
- link=""
- role="button"
- tabindex="0"
- >
- Quote
- </gr-button>
- <gr-button
- aria-disabled="false"
- class="action ack"
- id="ackBtn"
- link=""
- role="button"
- tabindex="0"
- >
- Ack
- </gr-button>
- <gr-button
- aria-disabled="false"
- class="action done"
- id="doneBtn"
- link=""
- role="button"
- tabindex="0"
- >
- Done
- </gr-button>
- <gr-icon
- icon="link"
- class="copy link-icon"
- role="button"
- tabindex="0"
- title="Copy link to this comment"
- ></gr-icon>
+ assert.dom.equal(
+ queryAndAssert(element, '#container'),
+ /* HTML */ `
+ <div id="container">
+ <h3 class="assistive-tech-only">
+ Unresolved Comment thread by Kermit
+ </h3>
+ <div class="comment-box unresolved" tabindex="0">
+ <gr-comment show-patchset=""></gr-comment>
+ <gr-comment show-patchset=""></gr-comment>
+ <div id="actionsContainer">
+ <span id="unresolvedLabel"> Unresolved </span>
+ <div id="actions">
+ <gr-button
+ aria-disabled="false"
+ class="action reply"
+ id="replyBtn"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Reply
+ </gr-button>
+ <gr-button
+ aria-disabled="false"
+ class="action quote"
+ id="quoteBtn"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Quote
+ </gr-button>
+ <gr-button
+ aria-disabled="false"
+ class="action ack"
+ id="ackBtn"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Ack
+ </gr-button>
+ <gr-button
+ aria-disabled="false"
+ class="action done"
+ id="doneBtn"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Done
+ </gr-button>
+ <gr-icon
+ icon="link"
+ class="copy link-icon"
+ role="button"
+ tabindex="0"
+ title="Copy link to this comment"
+ ></gr-icon>
+ </div>
</div>
</div>
</div>
- </div>
- `);
+ `
+ );
});
test('renders with diff', async () => {
element.showCommentContext = true;
element.thread = createThread(commentWithContext);
await element.updateComplete;
- expect(queryAndAssert(element, '.diff-container')).dom.to.equal(/* HTML */ `
- <div class="diff-container">
- <gr-diff
- class="disable-context-control-buttons hide-line-length-indicator no-left"
- id="diff"
- style="--line-limit-marker:100ch; --content-width:none; --diff-max-width:none; --font-size:12px;"
- >
- </gr-diff>
- <div class="view-diff-container">
- <a href="">
- <gr-button
- aria-disabled="false"
- class="view-diff-button"
- link=""
- role="button"
- tabindex="0"
- >
- View Diff
- </gr-button>
- </a>
+ assert.dom.equal(
+ queryAndAssert(element, '.diff-container'),
+ /* HTML */ `
+ <div class="diff-container">
+ <gr-diff
+ class="disable-context-control-buttons hide-line-length-indicator no-left"
+ id="diff"
+ style="--line-limit-marker:100ch; --content-width:none; --diff-max-width:none; --font-size:12px;"
+ >
+ </gr-diff>
+ <div class="view-diff-container">
+ <a href="">
+ <gr-button
+ aria-disabled="false"
+ class="view-diff-button"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ View Diff
+ </gr-button>
+ </a>
+ </div>
</div>
- </div>
- `);
+ `
+ );
});
suite('action button clicks', () => {
@@ -335,7 +350,7 @@
let threadEl: GrCommentThread;
setup(async () => {
- threadEl = basicFixture.instantiate();
+ threadEl = await fixture(html`<gr-comment-thread></gr-comment-thread>`);
threadEl.thread = createThread();
});
diff --git a/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.ts b/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.ts
index 0f2db23..5d380ef 100644
--- a/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.ts
+++ b/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.ts
@@ -59,7 +59,6 @@
import {classMap} from 'lit/directives/class-map.js';
import {LineNumber} from '../../../api/diff';
import {CommentSide, SpecialFilePath} from '../../../constants/constants';
-import {getRandomInt} from '../../../utils/math-util';
import {Subject} from 'rxjs';
import {debounceTime} from 'rxjs/operators';
import {configModelToken} from '../../../models/config/config-model';
@@ -938,11 +937,6 @@
});
}
- // private, but visible for testing
- getRandomInt(from: number, to: number) {
- return getRandomInt(from, to);
- }
-
private handleCopyLink() {
fireEvent(this, 'copy-comment-link');
}
diff --git a/polygerrit-ui/app/elements/shared/gr-comment/gr-comment_test.ts b/polygerrit-ui/app/elements/shared/gr-comment/gr-comment_test.ts
index a57af69..839085e 100644
--- a/polygerrit-ui/app/elements/shared/gr-comment/gr-comment_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-comment/gr-comment_test.ts
@@ -42,244 +42,272 @@
import {assertIsDefined} from '../../../utils/common-util';
import {Modifier} from '../../../utils/dom-util';
import {SinonStub} from 'sinon';
+import {fixture, html} from '@open-wc/testing';
suite('gr-comment tests', () => {
let element: GrComment;
+ const account = {
+ email: 'dhruvsri@google.com' as EmailAddress,
+ name: 'Dhruv Srivastava',
+ _account_id: 1083225 as AccountId,
+ avatars: [{url: 'abc', height: 32, width: 32}],
+ registered_on: '123' as Timestamp,
+ };
+ const comment = {
+ ...createComment(),
+ author: {
+ name: 'Mr. Peanutbutter',
+ email: 'tenn1sballchaser@aol.com' as EmailAddress,
+ },
+ id: 'baf0414d_60047215' as UrlEncodedCommentId,
+ line: 5,
+ message: 'This is the test comment message.',
+ updated: '2015-12-08 19:48:33.843000000' as Timestamp,
+ };
- setup(() => {
- element = fixtureFromElement('gr-comment').instantiate();
- element.account = {
- email: 'dhruvsri@google.com' as EmailAddress,
- name: 'Dhruv Srivastava',
- _account_id: 1083225 as AccountId,
- avatars: [{url: 'abc', height: 32, width: 32}],
- registered_on: '123' as Timestamp,
- };
- element.showPatchset = true;
- element.getRandomInt = () => 1;
- element.comment = {
- ...createComment(),
- author: {
- name: 'Mr. Peanutbutter',
- email: 'tenn1sballchaser@aol.com' as EmailAddress,
- },
- id: 'baf0414d_60047215' as UrlEncodedCommentId,
- line: 5,
- message: 'This is the test comment message.',
- updated: '2015-12-08 19:48:33.843000000' as Timestamp,
- };
+ setup(async () => {
+ element = await fixture(
+ html`<gr-comment
+ .account=${account}
+ .showPatchset=${true}
+ .comment=${comment}
+ ></gr-comment>`
+ );
});
suite('DOM rendering', () => {
test('renders collapsed', async () => {
- element.initiallyCollapsed = true;
- await element.updateComplete;
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div class="container" id="container">
- <div class="header" id="header">
- <div class="headerLeft">
- <gr-account-label deselected=""></gr-account-label>
+ const initiallyCollapsedElement = await fixture(
+ html`<gr-comment
+ .account=${account}
+ .showPatchset=${true}
+ .comment=${comment}
+ .initiallyCollapsed=${true}
+ ></gr-comment>`
+ );
+ assert.shadowDom.equal(
+ initiallyCollapsedElement,
+ /* HTML */ `
+ <div class="container" id="container">
+ <div class="header" id="header">
+ <div class="headerLeft">
+ <gr-account-label deselected=""></gr-account-label>
+ </div>
+ <div class="headerMiddle">
+ <span class="collapsedContent">
+ This is the test comment message.
+ </span>
+ </div>
+ <span class="patchset-text">Patchset 1</span>
+ <div class="show-hide" tabindex="0">
+ <label aria-label="Expand" class="show-hide">
+ <input checked="" class="show-hide" type="checkbox" />
+ <gr-icon id="icon" icon="expand_more"></gr-icon>
+ </label>
+ </div>
</div>
- <div class="headerMiddle">
- <span class="collapsedContent">
- This is the test comment message.
- </span>
- </div>
- <span class="patchset-text">Patchset 1</span>
- <div class="show-hide" tabindex="0">
- <label aria-label="Expand" class="show-hide">
- <input checked="" class="show-hide" type="checkbox" />
- <gr-icon id="icon" icon="expand_more"></gr-icon>
- </label>
- </div>
+ <div class="body"></div>
</div>
- <div class="body"></div>
- </div>
- `);
+ `
+ );
});
test('renders expanded', async () => {
element.initiallyCollapsed = false;
await element.updateComplete;
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div class="container" id="container">
- <div class="header" id="header">
- <div class="headerLeft">
- <gr-account-label deselected=""></gr-account-label>
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div class="container" id="container">
+ <div class="header" id="header">
+ <div class="headerLeft">
+ <gr-account-label deselected=""></gr-account-label>
+ </div>
+ <div class="headerMiddle"></div>
+ <span class="patchset-text">Patchset 1</span>
+ <span class="separator"></span>
+ <span class="date" tabindex="0">
+ <gr-date-formatter withtooltip=""></gr-date-formatter>
+ </span>
+ <div class="show-hide" tabindex="0">
+ <label aria-label="Collapse" class="show-hide">
+ <input class="show-hide" type="checkbox" />
+ <gr-icon id="icon" icon="expand_less"></gr-icon>
+ </label>
+ </div>
</div>
- <div class="headerMiddle"></div>
- <span class="patchset-text">Patchset 1</span>
- <span class="separator"></span>
- <span class="date" tabindex="0">
- <gr-date-formatter withtooltip=""></gr-date-formatter>
- </span>
- <div class="show-hide" tabindex="0">
- <label aria-label="Collapse" class="show-hide">
- <input class="show-hide" type="checkbox" />
- <gr-icon id="icon" icon="expand_less"></gr-icon>
- </label>
+ <div class="body">
+ <gr-formatted-text
+ class="message"
+ notrailingmargin=""
+ ></gr-formatted-text>
</div>
</div>
- <div class="body">
- <gr-formatted-text
- class="message"
- notrailingmargin=""
- ></gr-formatted-text>
- </div>
- </div>
- `);
+ `
+ );
});
test('renders expanded robot', async () => {
element.initiallyCollapsed = false;
element.comment = createRobotComment();
await element.updateComplete;
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div class="container" id="container">
- <div class="header" id="header">
- <div class="headerLeft">
- <span class="robotName">robot-id-123</span>
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div class="container" id="container">
+ <div class="header" id="header">
+ <div class="headerLeft">
+ <span class="robotName">robot-id-123</span>
+ </div>
+ <div class="headerMiddle"></div>
+ <span class="patchset-text">Patchset 1</span>
+ <span class="separator"></span>
+ <span class="date" tabindex="0">
+ <gr-date-formatter withtooltip=""></gr-date-formatter>
+ </span>
+ <div class="show-hide" tabindex="0">
+ <label aria-label="Collapse" class="show-hide">
+ <input class="show-hide" type="checkbox" />
+ <gr-icon id="icon" icon="expand_less"></gr-icon>
+ </label>
+ </div>
</div>
- <div class="headerMiddle"></div>
- <span class="patchset-text">Patchset 1</span>
- <span class="separator"></span>
- <span class="date" tabindex="0">
- <gr-date-formatter withtooltip=""></gr-date-formatter>
- </span>
- <div class="show-hide" tabindex="0">
- <label aria-label="Collapse" class="show-hide">
- <input class="show-hide" type="checkbox" />
- <gr-icon id="icon" icon="expand_less"></gr-icon>
- </label>
+ <div class="body">
+ <div class="robotId"></div>
+ <gr-formatted-text
+ class="message"
+ notrailingmargin=""
+ ></gr-formatted-text>
+ <div class="robotActions">
+ <gr-icon
+ icon="link"
+ class="copy link-icon"
+ role="button"
+ tabindex="0"
+ title="Copy link to this comment"
+ ></gr-icon>
+ <gr-endpoint-decorator name="robot-comment-controls">
+ <gr-endpoint-param name="comment"></gr-endpoint-param>
+ </gr-endpoint-decorator>
+ <gr-button
+ aria-disabled="false"
+ class="action show-fix"
+ link=""
+ role="button"
+ secondary=""
+ tabindex="0"
+ >
+ Show Fix
+ </gr-button>
+ <gr-button
+ aria-disabled="false"
+ class="action fix"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Please Fix
+ </gr-button>
+ </div>
</div>
</div>
- <div class="body">
- <div class="robotId"></div>
- <gr-formatted-text
- class="message"
- notrailingmargin=""
- ></gr-formatted-text>
- <div class="robotActions">
- <gr-icon
- icon="link"
- class="copy link-icon"
- role="button"
- tabindex="0"
- title="Copy link to this comment"
- ></gr-icon>
- <gr-endpoint-decorator name="robot-comment-controls">
- <gr-endpoint-param name="comment"></gr-endpoint-param>
- </gr-endpoint-decorator>
- <gr-button
- aria-disabled="false"
- class="action show-fix"
- link=""
- role="button"
- secondary=""
- tabindex="0"
- >
- Show Fix
- </gr-button>
- <gr-button
- aria-disabled="false"
- class="action fix"
- link=""
- role="button"
- tabindex="0"
- >
- Please Fix
- </gr-button>
- </div>
- </div>
- </div>
- `);
+ `
+ );
});
test('renders expanded admin', async () => {
element.initiallyCollapsed = false;
element.isAdmin = true;
await element.updateComplete;
- expect(queryAndAssert(element, 'gr-button.delete')).dom.to
- .equal(/* HTML */ `
- <gr-button
- aria-disabled="false"
- class="action delete"
- id="deleteBtn"
- link=""
- role="button"
- tabindex="0"
- title="Delete Comment"
- >
- <gr-icon id="icon" icon="delete" filled></gr-icon>
- </gr-button>
- `);
+ assert.dom.equal(
+ queryAndAssert(element, 'gr-button.delete'),
+ /* HTML */ `
+ <gr-button
+ aria-disabled="false"
+ class="action delete"
+ id="deleteBtn"
+ link=""
+ role="button"
+ tabindex="0"
+ title="Delete Comment"
+ >
+ <gr-icon id="icon" icon="delete" filled></gr-icon>
+ </gr-button>
+ `
+ );
});
test('renders draft', async () => {
element.initiallyCollapsed = false;
(element.comment as DraftInfo).__draft = true;
await element.updateComplete;
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div class="container draft" id="container">
- <div class="header" id="header">
- <div class="headerLeft">
- <gr-account-label class="draft" deselected=""></gr-account-label>
- <gr-tooltip-content
- class="draftTooltip"
- has-tooltip=""
- max-width="20em"
- show-icon=""
- title="This draft is only visible to you. To publish drafts, click the 'Reply' or 'Start review' button at the top of the change or press the 'a' key."
- >
- <span class="draftLabel">DRAFT</span>
- </gr-tooltip-content>
- </div>
- <div class="headerMiddle"></div>
- <span class="patchset-text">Patchset 1</span>
- <span class="separator"></span>
- <span class="date" tabindex="0">
- <gr-date-formatter withtooltip=""></gr-date-formatter>
- </span>
- <div class="show-hide" tabindex="0">
- <label aria-label="Collapse" class="show-hide">
- <input class="show-hide" type="checkbox" />
- <gr-icon id="icon" icon="expand_less"></gr-icon>
- </label>
- </div>
- </div>
- <div class="body">
- <gr-formatted-text class="message"></gr-formatted-text>
- <div class="actions">
- <div class="action resolve">
- <label>
- <input checked="" id="resolvedCheckbox" type="checkbox" />
- Resolved
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div class="container draft" id="container">
+ <div class="header" id="header">
+ <div class="headerLeft">
+ <gr-account-label
+ class="draft"
+ deselected=""
+ ></gr-account-label>
+ <gr-tooltip-content
+ class="draftTooltip"
+ has-tooltip=""
+ max-width="20em"
+ show-icon=""
+ title="This draft is only visible to you. To publish drafts, click the 'Reply' or 'Start review' button at the top of the change or press the 'a' key."
+ >
+ <span class="draftLabel">DRAFT</span>
+ </gr-tooltip-content>
+ </div>
+ <div class="headerMiddle"></div>
+ <span class="patchset-text">Patchset 1</span>
+ <span class="separator"></span>
+ <span class="date" tabindex="0">
+ <gr-date-formatter withtooltip=""></gr-date-formatter>
+ </span>
+ <div class="show-hide" tabindex="0">
+ <label aria-label="Collapse" class="show-hide">
+ <input class="show-hide" type="checkbox" />
+ <gr-icon id="icon" icon="expand_less"></gr-icon>
</label>
</div>
- <div class="rightActions">
- <gr-button
- aria-disabled="false"
- class="action discard"
- link=""
- role="button"
- tabindex="0"
- >
- Discard
- </gr-button>
- <gr-button
- aria-disabled="false"
- class="action edit"
- link=""
- role="button"
- tabindex="0"
- >
- Edit
- </gr-button>
+ </div>
+ <div class="body">
+ <gr-formatted-text class="message"></gr-formatted-text>
+ <div class="actions">
+ <div class="action resolve">
+ <label>
+ <input checked="" id="resolvedCheckbox" type="checkbox" />
+ Resolved
+ </label>
+ </div>
+ <div class="rightActions">
+ <gr-button
+ aria-disabled="false"
+ class="action discard"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Discard
+ </gr-button>
+ <gr-button
+ aria-disabled="false"
+ class="action edit"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Edit
+ </gr-button>
+ </div>
</div>
</div>
</div>
- </div>
- `);
+ `
+ );
});
test('renders draft in editing mode', async () => {
@@ -287,75 +315,81 @@
(element.comment as DraftInfo).__draft = true;
element.editing = true;
await element.updateComplete;
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div class="container draft" id="container">
- <div class="header" id="header">
- <div class="headerLeft">
- <gr-account-label class="draft" deselected=""></gr-account-label>
- <gr-tooltip-content
- class="draftTooltip"
- has-tooltip=""
- max-width="20em"
- show-icon=""
- title="This draft is only visible to you. To publish drafts, click the 'Reply' or 'Start review' button at the top of the change or press the 'a' key."
- >
- <span class="draftLabel">DRAFT</span>
- </gr-tooltip-content>
- </div>
- <div class="headerMiddle"></div>
- <span class="patchset-text">Patchset 1</span>
- <span class="separator"></span>
- <span class="date" tabindex="0">
- <gr-date-formatter withtooltip=""></gr-date-formatter>
- </span>
- <div class="show-hide" tabindex="0">
- <label aria-label="Collapse" class="show-hide">
- <input class="show-hide" type="checkbox" />
- <gr-icon id="icon" icon="expand_less"></gr-icon>
- </label>
- </div>
- </div>
- <div class="body">
- <gr-textarea
- autocomplete="on"
- class="code editMessage"
- code=""
- id="editTextarea"
- rows="4"
- text="This is the test comment message."
- >
- </gr-textarea>
- <div class="actions">
- <div class="action resolve">
- <label>
- <input checked="" id="resolvedCheckbox" type="checkbox" />
- Resolved
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div class="container draft" id="container">
+ <div class="header" id="header">
+ <div class="headerLeft">
+ <gr-account-label
+ class="draft"
+ deselected=""
+ ></gr-account-label>
+ <gr-tooltip-content
+ class="draftTooltip"
+ has-tooltip=""
+ max-width="20em"
+ show-icon=""
+ title="This draft is only visible to you. To publish drafts, click the 'Reply' or 'Start review' button at the top of the change or press the 'a' key."
+ >
+ <span class="draftLabel">DRAFT</span>
+ </gr-tooltip-content>
+ </div>
+ <div class="headerMiddle"></div>
+ <span class="patchset-text">Patchset 1</span>
+ <span class="separator"></span>
+ <span class="date" tabindex="0">
+ <gr-date-formatter withtooltip=""></gr-date-formatter>
+ </span>
+ <div class="show-hide" tabindex="0">
+ <label aria-label="Collapse" class="show-hide">
+ <input class="show-hide" type="checkbox" />
+ <gr-icon id="icon" icon="expand_less"></gr-icon>
</label>
</div>
- <div class="rightActions">
- <gr-button
- aria-disabled="false"
- class="action cancel"
- link=""
- role="button"
- tabindex="0"
- >
- Cancel
- </gr-button>
- <gr-button
- aria-disabled="false"
- class="action save"
- link=""
- role="button"
- tabindex="0"
- >
- Save
- </gr-button>
+ </div>
+ <div class="body">
+ <gr-textarea
+ autocomplete="on"
+ class="code editMessage"
+ code=""
+ id="editTextarea"
+ rows="4"
+ text="This is the test comment message."
+ >
+ </gr-textarea>
+ <div class="actions">
+ <div class="action resolve">
+ <label>
+ <input checked="" id="resolvedCheckbox" type="checkbox" />
+ Resolved
+ </label>
+ </div>
+ <div class="rightActions">
+ <gr-button
+ aria-disabled="false"
+ class="action cancel"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Cancel
+ </gr-button>
+ <gr-button
+ aria-disabled="false"
+ class="action save"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Save
+ </gr-button>
+ </div>
</div>
</div>
</div>
- </div>
- `);
+ `
+ );
});
});
diff --git a/polygerrit-ui/app/elements/shared/gr-confirm-delete-comment-dialog/gr-confirm-delete-comment-dialog_test.ts b/polygerrit-ui/app/elements/shared/gr-confirm-delete-comment-dialog/gr-confirm-delete-comment-dialog_test.ts
index 496c513..9008c86 100644
--- a/polygerrit-ui/app/elements/shared/gr-confirm-delete-comment-dialog/gr-confirm-delete-comment-dialog_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-confirm-delete-comment-dialog/gr-confirm-delete-comment-dialog_test.ts
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
import '../../../test/common-test-setup-karma';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import {GrConfirmDeleteCommentDialog} from './gr-confirm-delete-comment-dialog';
import './gr-confirm-delete-comment-dialog';
@@ -19,8 +19,9 @@
test('render', () => {
// prettier and shadowDom string disagree about wrapping in <p> tag.
- expect(element).shadowDom.to
- .equal(/* prettier-ignore */ /* HTML */ `
+ assert.shadowDom.equal(
+ element,
+ /* prettier-ignore */ /* HTML */ `
<gr-dialog confirm-label="Delete" role="dialog">
<div class="header" slot="header">Delete Comment</div>
<div class="main" slot="main">
@@ -39,6 +40,7 @@
</iron-autogrow-textarea>
</div>
</gr-dialog>
- `);
+ `
+ );
});
});
diff --git a/polygerrit-ui/app/elements/shared/gr-copy-clipboard/gr-copy-clipboard_test.ts b/polygerrit-ui/app/elements/shared/gr-copy-clipboard/gr-copy-clipboard_test.ts
index 0840c3b..6c938b1 100644
--- a/polygerrit-ui/app/elements/shared/gr-copy-clipboard/gr-copy-clipboard_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-copy-clipboard/gr-copy-clipboard_test.ts
@@ -8,48 +8,50 @@
import {GrCopyClipboard} from './gr-copy-clipboard';
import {queryAndAssert} from '../../../test/test-utils';
import * as MockInteractions from '@polymer/iron-test-helpers/mock-interactions';
-
-const basicFixture = fixtureFromElement('gr-copy-clipboard');
+import {fixture, html} from '@open-wc/testing';
suite('gr-copy-clipboard tests', () => {
let element: GrCopyClipboard;
setup(async () => {
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-copy-clipboard></gr-copy-clipboard>`);
element.text = `git fetch http://gerrit@localhost:8080/a/test-project
refs/changes/05/5/1 && git checkout FETCH_HEAD`;
await flush();
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div class="text">
- <iron-input class="copyText">
- <input
- id="input"
- is="iron-input"
- part="text-container-style"
- readonly=""
- type="text"
- />
- </iron-input>
- <gr-tooltip-content>
- <gr-button
- aria-disabled="false"
- aria-label="Click to copy to clipboard"
- class="copyToClipboard"
- id="copy-clipboard-button"
- link=""
- role="button"
- tabindex="0"
- >
- <div>
- <gr-icon icon="content_copy" id="icon" small></gr-icon>
- </div>
- </gr-button>
- </gr-tooltip-content>
- </div>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div class="text">
+ <iron-input class="copyText">
+ <input
+ id="input"
+ is="iron-input"
+ part="text-container-style"
+ readonly=""
+ type="text"
+ />
+ </iron-input>
+ <gr-tooltip-content>
+ <gr-button
+ aria-disabled="false"
+ aria-label="Click to copy to clipboard"
+ class="copyToClipboard"
+ id="copy-clipboard-button"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ <div>
+ <gr-icon icon="content_copy" id="icon" small></gr-icon>
+ </div>
+ </gr-button>
+ </gr-tooltip-content>
+ </div>
+ `
+ );
});
test('copy to clipboard', () => {
diff --git a/polygerrit-ui/app/elements/shared/gr-cursor-manager/gr-cursor-manager_test.js b/polygerrit-ui/app/elements/shared/gr-cursor-manager/gr-cursor-manager_test.js
index 24ac580..0e6c954 100644
--- a/polygerrit-ui/app/elements/shared/gr-cursor-manager/gr-cursor-manager_test.js
+++ b/polygerrit-ui/app/elements/shared/gr-cursor-manager/gr-cursor-manager_test.js
@@ -5,7 +5,8 @@
*/
import '../../../test/common-test-setup-karma.js';
import './gr-cursor-manager.js';
-import {fixture, html} from '@open-wc/testing-helpers';
+// eslint-disable-next-line import/named
+import {fixture, html} from '@open-wc/testing';
import {AbortStop, CursorMoveResult} from '../../../api/core.js';
import {GrCursorManager} from './gr-cursor-manager.js';
diff --git a/polygerrit-ui/app/elements/shared/gr-date-formatter/gr-date-formatter_test.ts b/polygerrit-ui/app/elements/shared/gr-date-formatter/gr-date-formatter_test.ts
index 54518fe..5b1a896 100644
--- a/polygerrit-ui/app/elements/shared/gr-date-formatter/gr-date-formatter_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-date-formatter/gr-date-formatter_test.ts
@@ -7,7 +7,7 @@
import './gr-date-formatter';
import {GrDateFormatter} from './gr-date-formatter';
import {parseDate} from '../../../utils/date-util';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import {query, queryAndAssert, stubRestApi} from '../../../test/test-utils';
import {GrTooltipContent} from '../gr-tooltip-content/gr-tooltip-content';
import {Timestamp} from '../../../api/rest-api';
diff --git a/polygerrit-ui/app/elements/shared/gr-dialog/gr-dialog_test.ts b/polygerrit-ui/app/elements/shared/gr-dialog/gr-dialog_test.ts
index c3e3569..1fa0f1c 100644
--- a/polygerrit-ui/app/elements/shared/gr-dialog/gr-dialog_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-dialog/gr-dialog_test.ts
@@ -8,7 +8,7 @@
import './gr-dialog';
import {GrDialog} from './gr-dialog';
import {isHidden, queryAndAssert} from '../../../test/test-utils';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
suite('gr-dialog tests', () => {
let element: GrDialog;
@@ -19,81 +19,87 @@
});
test('renders', async () => {
- expect(element).shadowDom.to.equal(/* HTML */ `<div class="container">
- <header class="heading-3">
- <slot name="header"> </slot>
- </header>
- <main>
- <div class="overflow-container">
- <slot name="main"> </slot>
- </div>
- </main>
- <footer>
- <div class="flex-space"></div>
- <gr-button
- aria-disabled="false"
- id="cancel"
- link=""
- role="button"
- tabindex="0"
- >
- Cancel
- </gr-button>
- <gr-button
- aria-disabled="false"
- id="confirm"
- link=""
- primary=""
- role="button"
- tabindex="0"
- title=""
- >
- Confirm
- </gr-button>
- </footer>
- </div> `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `<div class="container">
+ <header class="heading-3">
+ <slot name="header"> </slot>
+ </header>
+ <main>
+ <div class="overflow-container">
+ <slot name="main"> </slot>
+ </div>
+ </main>
+ <footer>
+ <div class="flex-space"></div>
+ <gr-button
+ aria-disabled="false"
+ id="cancel"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Cancel
+ </gr-button>
+ <gr-button
+ aria-disabled="false"
+ id="confirm"
+ link=""
+ primary=""
+ role="button"
+ tabindex="0"
+ title=""
+ >
+ Confirm
+ </gr-button>
+ </footer>
+ </div> `
+ );
});
test('renders with loading state', async () => {
element.loading = true;
element.loadingLabel = 'Loading!!';
await element.updateComplete;
- expect(element).shadowDom.to.equal(/* HTML */ `<div class="container">
- <header class="heading-3">
- <slot name="header"> </slot>
- </header>
- <main>
- <div class="overflow-container">
- <slot name="main"> </slot>
- </div>
- </main>
- <footer>
- <span class="loadingSpin" aria-label="Loading!!" role="progressbar">
- </span>
- <span class="loadingLabel"> Loading!! </span>
- <div class="flex-space"></div>
- <gr-button
- aria-disabled="false"
- id="cancel"
- link=""
- role="button"
- tabindex="0"
- >
- Cancel
- </gr-button>
- <gr-button
- aria-disabled="false"
- id="confirm"
- link=""
- primary=""
- role="button"
- tabindex="0"
- title=""
- >
- Confirm
- </gr-button>
- </footer>
- </div> `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `<div class="container">
+ <header class="heading-3">
+ <slot name="header"> </slot>
+ </header>
+ <main>
+ <div class="overflow-container">
+ <slot name="main"> </slot>
+ </div>
+ </main>
+ <footer>
+ <span class="loadingSpin" aria-label="Loading!!" role="progressbar">
+ </span>
+ <span class="loadingLabel"> Loading!! </span>
+ <div class="flex-space"></div>
+ <gr-button
+ aria-disabled="false"
+ id="cancel"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ Cancel
+ </gr-button>
+ <gr-button
+ aria-disabled="false"
+ id="confirm"
+ link=""
+ primary=""
+ role="button"
+ tabindex="0"
+ title=""
+ >
+ Confirm
+ </gr-button>
+ </footer>
+ </div> `
+ );
});
test('events', () => {
diff --git a/polygerrit-ui/app/elements/shared/gr-diff-preferences/gr-diff-preferences_test.ts b/polygerrit-ui/app/elements/shared/gr-diff-preferences/gr-diff-preferences_test.ts
index 6e2e83f..bf439df 100644
--- a/polygerrit-ui/app/elements/shared/gr-diff-preferences/gr-diff-preferences_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-diff-preferences/gr-diff-preferences_test.ts
@@ -12,8 +12,7 @@
import {IronInputElement} from '@polymer/iron-input';
import {GrSelect} from '../gr-select/gr-select';
import {ParsedJSON} from '../../../types/common';
-
-const basicFixture = fixtureFromElement('gr-diff-preferences');
+import {fixture, html} from '@open-wc/testing';
suite('gr-diff-preferences tests', () => {
let element: GrDiffPreferences;
@@ -38,112 +37,116 @@
stubRestApi('getDiffPreferences').returns(Promise.resolve(diffPreferences));
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-diff-preferences></gr-diff-preferences>`);
await element.updateComplete;
});
test('renders', () => {
- expect(element).shadowDom.to.equal(/* HTML */ ` <div
- class="gr-form-styles"
- id="diffPreferences"
- >
- <section>
- <label class="title" for="contextLineSelect">Context</label>
- <span class="value">
- <gr-select id="contextSelect">
- <select id="contextLineSelect">
- <option value="3">3 lines</option>
- <option value="10">10 lines</option>
- <option value="25">25 lines</option>
- <option value="50">50 lines</option>
- <option value="75">75 lines</option>
- <option value="100">100 lines</option>
- <option value="-1">Whole file</option>
- </select>
- </gr-select>
- </span>
- </section>
- <section>
- <label class="title" for="lineWrappingInput">Fit to screen</label>
- <span class="value">
- <input id="lineWrappingInput" type="checkbox" />
- </span>
- </section>
- <section>
- <label class="title" for="columnsInput">Diff width</label>
- <span class="value">
- <iron-input>
- <input id="columnsInput" type="number" />
- </iron-input>
- </span>
- </section>
- <section>
- <label class="title" for="tabSizeInput">Tab width</label>
- <span class="value">
- <iron-input>
- <input id="tabSizeInput" type="number" />
- </iron-input>
- </span>
- </section>
- <section>
- <label class="title" for="fontSizeInput">Font size</label>
- <span class="value">
- <iron-input>
- <input id="fontSizeInput" type="number" />
- </iron-input>
- </span>
- </section>
- <section>
- <label class="title" for="showTabsInput">Show tabs</label>
- <span class="value">
- <input checked="" id="showTabsInput" type="checkbox" />
- </span>
- </section>
- <section>
- <label class="title" for="showTrailingWhitespaceInput">
- Show trailing whitespace
- </label>
- <span class="value">
- <input checked="" id="showTrailingWhitespaceInput" type="checkbox" />
- </span>
- </section>
- <section>
- <label class="title" for="syntaxHighlightInput">
- Syntax highlighting
- </label>
- <span class="value">
- <input checked="" id="syntaxHighlightInput" type="checkbox" />
- </span>
- </section>
- <section>
- <label class="title" for="automaticReviewInput">
- Automatically mark viewed files reviewed
- </label>
- <span class="value">
- <input checked="" id="automaticReviewInput" type="checkbox" />
- </span>
- </section>
- <section>
- <div class="pref">
- <label class="title" for="ignoreWhiteSpace">
- Ignore Whitespace
- </label>
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ ` <div class="gr-form-styles" id="diffPreferences">
+ <section>
+ <label class="title" for="contextLineSelect">Context</label>
<span class="value">
- <gr-select>
- <select id="ignoreWhiteSpace">
- <option value="IGNORE_NONE">None</option>
- <option value="IGNORE_TRAILING">Trailing</option>
- <option value="IGNORE_LEADING_AND_TRAILING">
- Leading & trailing
- </option>
- <option value="IGNORE_ALL">All</option>
+ <gr-select id="contextSelect">
+ <select id="contextLineSelect">
+ <option value="3">3 lines</option>
+ <option value="10">10 lines</option>
+ <option value="25">25 lines</option>
+ <option value="50">50 lines</option>
+ <option value="75">75 lines</option>
+ <option value="100">100 lines</option>
+ <option value="-1">Whole file</option>
</select>
</gr-select>
</span>
- </div>
- </section>
- </div>`);
+ </section>
+ <section>
+ <label class="title" for="lineWrappingInput">Fit to screen</label>
+ <span class="value">
+ <input id="lineWrappingInput" type="checkbox" />
+ </span>
+ </section>
+ <section>
+ <label class="title" for="columnsInput">Diff width</label>
+ <span class="value">
+ <iron-input>
+ <input id="columnsInput" type="number" />
+ </iron-input>
+ </span>
+ </section>
+ <section>
+ <label class="title" for="tabSizeInput">Tab width</label>
+ <span class="value">
+ <iron-input>
+ <input id="tabSizeInput" type="number" />
+ </iron-input>
+ </span>
+ </section>
+ <section>
+ <label class="title" for="fontSizeInput">Font size</label>
+ <span class="value">
+ <iron-input>
+ <input id="fontSizeInput" type="number" />
+ </iron-input>
+ </span>
+ </section>
+ <section>
+ <label class="title" for="showTabsInput">Show tabs</label>
+ <span class="value">
+ <input checked="" id="showTabsInput" type="checkbox" />
+ </span>
+ </section>
+ <section>
+ <label class="title" for="showTrailingWhitespaceInput">
+ Show trailing whitespace
+ </label>
+ <span class="value">
+ <input
+ checked=""
+ id="showTrailingWhitespaceInput"
+ type="checkbox"
+ />
+ </span>
+ </section>
+ <section>
+ <label class="title" for="syntaxHighlightInput">
+ Syntax highlighting
+ </label>
+ <span class="value">
+ <input checked="" id="syntaxHighlightInput" type="checkbox" />
+ </span>
+ </section>
+ <section>
+ <label class="title" for="automaticReviewInput">
+ Automatically mark viewed files reviewed
+ </label>
+ <span class="value">
+ <input checked="" id="automaticReviewInput" type="checkbox" />
+ </span>
+ </section>
+ <section>
+ <div class="pref">
+ <label class="title" for="ignoreWhiteSpace">
+ Ignore Whitespace
+ </label>
+ <span class="value">
+ <gr-select>
+ <select id="ignoreWhiteSpace">
+ <option value="IGNORE_NONE">None</option>
+ <option value="IGNORE_TRAILING">Trailing</option>
+ <option value="IGNORE_LEADING_AND_TRAILING">
+ Leading & trailing
+ </option>
+ <option value="IGNORE_ALL">All</option>
+ </select>
+ </gr-select>
+ </span>
+ </div>
+ </section>
+ </div>`
+ );
});
test('renders preferences', () => {
diff --git a/polygerrit-ui/app/elements/shared/gr-download-commands/gr-download-commands_test.ts b/polygerrit-ui/app/elements/shared/gr-download-commands/gr-download-commands_test.ts
index d05ab44..afcccc2 100644
--- a/polygerrit-ui/app/elements/shared/gr-download-commands/gr-download-commands_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-download-commands/gr-download-commands_test.ts
@@ -17,8 +17,7 @@
import {GrShellCommand} from '../gr-shell-command/gr-shell-command';
import {createDefaultPreferences} from '../../../constants/constants';
import {PaperTabsElement} from '@polymer/paper-tabs/paper-tabs';
-
-const basicFixture = fixtureFromElement('gr-download-commands');
+import {fixture, html} from '@open-wc/testing';
suite('gr-download-commands', () => {
let element: GrDownloadCommands;
@@ -51,7 +50,9 @@
suite('unauthenticated', () => {
setup(async () => {
stubRestApi('getLoggedIn').returns(Promise.resolve(false));
- element = basicFixture.instantiate();
+ element = await fixture(
+ html`<gr-download-commands></gr-download-commands>`
+ );
element.schemes = SCHEMES;
element.commands = COMMANDS;
element.selectedScheme = SELECTED_SCHEME;
@@ -59,45 +60,53 @@
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div class="schemes">
- <paper-tabs dir="null" id="downloadTabs" role="tablist" tabindex="0">
- <paper-tab
- aria-disabled="false"
- aria-selected="true"
- class="iron-selected"
- data-scheme="http"
- role="tab"
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div class="schemes">
+ <paper-tabs
+ dir="null"
+ id="downloadTabs"
+ role="tablist"
tabindex="0"
>
- http
- </paper-tab>
- <paper-tab
- aria-disabled="false"
- aria-selected="false"
- data-scheme="repo"
- role="tab"
- tabindex="-1"
- >
- repo
- </paper-tab>
- <paper-tab
- aria-disabled="false"
- aria-selected="false"
- data-scheme="ssh"
- role="tab"
- tabindex="-1"
- >
- ssh
- </paper-tab>
- </paper-tabs>
- </div>
- <div class="commands"></div>
- <gr-shell-command class="_label_checkout"> </gr-shell-command>
- <gr-shell-command class="_label_cherrypick"> </gr-shell-command>
- <gr-shell-command class="_label_formatpatch"> </gr-shell-command>
- <gr-shell-command class="_label_pull"> </gr-shell-command>
- `);
+ <paper-tab
+ aria-disabled="false"
+ aria-selected="true"
+ class="iron-selected"
+ data-scheme="http"
+ role="tab"
+ tabindex="0"
+ >
+ http
+ </paper-tab>
+ <paper-tab
+ aria-disabled="false"
+ aria-selected="false"
+ data-scheme="repo"
+ role="tab"
+ tabindex="-1"
+ >
+ repo
+ </paper-tab>
+ <paper-tab
+ aria-disabled="false"
+ aria-selected="false"
+ data-scheme="ssh"
+ role="tab"
+ tabindex="-1"
+ >
+ ssh
+ </paper-tab>
+ </paper-tabs>
+ </div>
+ <div class="commands"></div>
+ <gr-shell-command class="_label_checkout"> </gr-shell-command>
+ <gr-shell-command class="_label_cherrypick"> </gr-shell-command>
+ <gr-shell-command class="_label_formatpatch"> </gr-shell-command>
+ <gr-shell-command class="_label_pull"> </gr-shell-command>
+ `
+ );
});
test('focusOnCopy', async () => {
@@ -159,8 +168,9 @@
});
suite('authenticated', () => {
test('loads scheme from preferences', async () => {
- const element = basicFixture.instantiate();
- await element.updateComplete;
+ const element: GrDownloadCommands = await fixture(
+ html`<gr-download-commands></gr-download-commands>`
+ );
element.userModel.setPreferences({
...createPreferences(),
download_scheme: 'repo',
@@ -169,8 +179,9 @@
});
test('normalize scheme from preferences', async () => {
- const element = basicFixture.instantiate();
- await element.updateComplete;
+ const element: GrDownloadCommands = await fixture(
+ html`<gr-download-commands></gr-download-commands>`
+ );
element.userModel.setPreferences({
...createPreferences(),
download_scheme: 'REPO',
diff --git a/polygerrit-ui/app/elements/shared/gr-dropdown-list/gr-dropdown-list_test.ts b/polygerrit-ui/app/elements/shared/gr-dropdown-list/gr-dropdown-list_test.ts
index 76770b1..82337f5 100644
--- a/polygerrit-ui/app/elements/shared/gr-dropdown-list/gr-dropdown-list_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-dropdown-list/gr-dropdown-list_test.ts
@@ -11,7 +11,7 @@
import {PaperListboxElement} from '@polymer/paper-listbox';
import {Timestamp} from '../../../types/common';
import {assertIsDefined} from '../../../utils/common-util';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
suite('gr-dropdown-list tests', () => {
let element: GrDropdownList;
@@ -48,88 +48,91 @@
];
await element.updateComplete;
- expect(element).shadowDom.to.equal(/* HTML */ `
- <gr-button
- aria-disabled="false"
- class="dropdown-trigger"
- down-arrow=""
- id="trigger"
- link=""
- no-uppercase=""
- role="button"
- slot="dropdown-trigger"
- tabindex="0"
- >
- <span id="triggerText"> Button Text 2 </span>
- <gr-copy-clipboard hidden="" hideinput=""> </gr-copy-clipboard>
- </gr-button>
- <iron-dropdown
- aria-disabled="false"
- aria-hidden="true"
- horizontal-align="left"
- id="dropdown"
- style="outline: none; display: none;"
- vertical-align="top"
- >
- <paper-listbox
- class="dropdown-content"
- role="listbox"
- slot="dropdown-content"
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <gr-button
+ aria-disabled="false"
+ class="dropdown-trigger"
+ down-arrow=""
+ id="trigger"
+ link=""
+ no-uppercase=""
+ role="button"
+ slot="dropdown-trigger"
tabindex="0"
>
- <paper-item
- aria-disabled="false"
- aria-selected="false"
- data-value="1"
- role="option"
- tabindex="-1"
- >
- <div class="topContent">
- <div>Top Text 1</div>
- </div>
- </paper-item>
- <paper-item
- aria-disabled="false"
- aria-selected="true"
- class="iron-selected"
- data-value="2"
- role="option"
+ <span id="triggerText"> Button Text 2 </span>
+ <gr-copy-clipboard hidden="" hideinput=""> </gr-copy-clipboard>
+ </gr-button>
+ <iron-dropdown
+ aria-disabled="false"
+ aria-hidden="true"
+ horizontal-align="left"
+ id="dropdown"
+ style="outline: none; display: none;"
+ vertical-align="top"
+ >
+ <paper-listbox
+ class="dropdown-content"
+ role="listbox"
+ slot="dropdown-content"
tabindex="0"
>
- <div class="topContent">
- <div>Top Text 2</div>
- </div>
- <div class="bottomContent">
- <div>Bottom Text 2</div>
- </div>
- </paper-item>
- <paper-item
- aria-disabled="true"
- aria-selected="false"
- data-value="3"
- disabled=""
- role="option"
- style="pointer-events: none;"
- tabindex="-1"
- >
- <div class="topContent">
- <div>Top Text 3</div>
- <gr-date-formatter> </gr-date-formatter>
- </div>
- <div class="bottomContent">
- <div>Bottom Text 3</div>
- </div>
- </paper-item>
- </paper-listbox>
- </iron-dropdown>
- <gr-select>
- <select>
- <option value="1">Top Text 1</option>
- <option value="2">Mobile Text 2</option>
- <option disabled="" value="3">Mobile Text 3</option>
- </select>
- </gr-select>
- `);
+ <paper-item
+ aria-disabled="false"
+ aria-selected="false"
+ data-value="1"
+ role="option"
+ tabindex="-1"
+ >
+ <div class="topContent">
+ <div>Top Text 1</div>
+ </div>
+ </paper-item>
+ <paper-item
+ aria-disabled="false"
+ aria-selected="true"
+ class="iron-selected"
+ data-value="2"
+ role="option"
+ tabindex="0"
+ >
+ <div class="topContent">
+ <div>Top Text 2</div>
+ </div>
+ <div class="bottomContent">
+ <div>Bottom Text 2</div>
+ </div>
+ </paper-item>
+ <paper-item
+ aria-disabled="true"
+ aria-selected="false"
+ data-value="3"
+ disabled=""
+ role="option"
+ style="pointer-events: none;"
+ tabindex="-1"
+ >
+ <div class="topContent">
+ <div>Top Text 3</div>
+ <gr-date-formatter> </gr-date-formatter>
+ </div>
+ <div class="bottomContent">
+ <div>Bottom Text 3</div>
+ </div>
+ </paper-item>
+ </paper-listbox>
+ </iron-dropdown>
+ <gr-select>
+ <select>
+ <option value="1">Top Text 1</option>
+ <option value="2">Mobile Text 2</option>
+ <option disabled="" value="3">Mobile Text 3</option>
+ </select>
+ </gr-select>
+ `
+ );
});
test('hide copy by default', () => {
diff --git a/polygerrit-ui/app/elements/shared/gr-dropdown/gr-dropdown_test.ts b/polygerrit-ui/app/elements/shared/gr-dropdown/gr-dropdown_test.ts
index bc47945..bb9b620 100644
--- a/polygerrit-ui/app/elements/shared/gr-dropdown/gr-dropdown_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-dropdown/gr-dropdown_test.ts
@@ -10,15 +10,13 @@
import {queryAll, queryAndAssert} from '../../../test/test-utils';
import {GrTooltipContent} from '../gr-tooltip-content/gr-tooltip-content';
import {assertIsDefined} from '../../../utils/common-util';
-
-const basicFixture = fixtureFromElement('gr-dropdown');
+import {fixture, html} from '@open-wc/testing';
suite('gr-dropdown tests', () => {
let element: GrDropdown;
setup(async () => {
- element = basicFixture.instantiate();
- await element.updateComplete;
+ element = await fixture(html`<gr-dropdown></gr-dropdown>`);
});
test('tap on trigger opens menu, then closes', () => {
@@ -152,7 +150,9 @@
];
element.disabledIds = [];
await element.updateComplete;
- expect(element).shadowDom.to.equal(/* HTML */ `
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
<gr-button
aria-disabled="false"
class="dropdown-trigger"
@@ -220,7 +220,8 @@
</li>
</div>
</ul>
- </iron-dropdown>`);
+ </iron-dropdown>`
+ );
});
suite('keyboard navigation', () => {
diff --git a/polygerrit-ui/app/elements/shared/gr-editable-content/gr-editable-content_test.ts b/polygerrit-ui/app/elements/shared/gr-editable-content/gr-editable-content_test.ts
index d2663ed..27292b3 100644
--- a/polygerrit-ui/app/elements/shared/gr-editable-content/gr-editable-content_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-editable-content/gr-editable-content_test.ts
@@ -9,7 +9,7 @@
import {query, queryAndAssert, stubStorage} from '../../../test/test-utils';
import * as MockInteractions from '@polymer/iron-test-helpers/mock-interactions';
import {GrButton} from '../gr-button/gr-button';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
suite('gr-editable-content tests', () => {
let element: GrEditableContent;
@@ -20,43 +20,44 @@
});
test('renders', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `<gr-endpoint-decorator
- name="commit-message"
- >
- <gr-endpoint-param name="editing"> </gr-endpoint-param>
- <div class="collapsed viewer">
- <slot> </slot>
- </div>
- <div class="show-all-container font-normal">
- <gr-button
- aria-disabled="false"
- class="show-all-button"
- link=""
- role="button"
- tabindex="0"
- >
- <div>
- <gr-icon icon="expand_more" small></gr-icon>
- <span>Show all</span>
- </div>
- </gr-button>
- <div class="flex-space"></div>
- <gr-button
- aria-disabled="false"
- class="edit-commit-message"
- link=""
- role="button"
- tabindex="0"
- title="Edit commit message"
- >
- <div>
- <gr-icon icon="edit" filled small></gr-icon>
- <span>Edit</span>
- </div>
- </gr-button>
- </div>
- <gr-endpoint-slot name="above-actions"> </gr-endpoint-slot>
- </gr-endpoint-decorator> `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `<gr-endpoint-decorator name="commit-message">
+ <gr-endpoint-param name="editing"> </gr-endpoint-param>
+ <div class="collapsed viewer">
+ <slot> </slot>
+ </div>
+ <div class="show-all-container font-normal">
+ <gr-button
+ aria-disabled="false"
+ class="show-all-button"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ <div>
+ <gr-icon icon="expand_more" small></gr-icon>
+ <span>Show all</span>
+ </div>
+ </gr-button>
+ <div class="flex-space"></div>
+ <gr-button
+ aria-disabled="false"
+ class="edit-commit-message"
+ link=""
+ role="button"
+ tabindex="0"
+ title="Edit commit message"
+ >
+ <div>
+ <gr-icon icon="edit" filled small></gr-icon>
+ <span>Edit</span>
+ </div>
+ </gr-button>
+ </div>
+ <gr-endpoint-slot name="above-actions"> </gr-endpoint-slot>
+ </gr-endpoint-decorator> `
+ );
});
test('show-all-container visibility', async () => {
diff --git a/polygerrit-ui/app/elements/shared/gr-editable-label/gr-editable-label.ts b/polygerrit-ui/app/elements/shared/gr-editable-label/gr-editable-label.ts
index 2199f0c..b07f150 100644
--- a/polygerrit-ui/app/elements/shared/gr-editable-label/gr-editable-label.ts
+++ b/polygerrit-ui/app/elements/shared/gr-editable-label/gr-editable-label.ts
@@ -68,11 +68,6 @@
/* private but used in test */
@state() inputText = '';
- // This is used to push the iron-input element up on the page, so
- // the input is placed in approximately the same position as the
- // trigger.
- @state() readonly verticalOffset = -30;
-
@property({type: Boolean})
showAsEditPencil = false;
@@ -160,7 +155,6 @@
id="dropdown"
.verticalAlign=${'auto'}
.horizontalAlign=${'auto'}
- .verticalOffset=${this.verticalOffset}
.allowOutsideScroll=${true}
.noCancelOnEscKey=${true}
.noCancelOnOutsideClick=${true}
diff --git a/polygerrit-ui/app/elements/shared/gr-editable-label/gr-editable-label_test.ts b/polygerrit-ui/app/elements/shared/gr-editable-label/gr-editable-label_test.ts
index 5c1e2ccb..e0526bf 100644
--- a/polygerrit-ui/app/elements/shared/gr-editable-label/gr-editable-label_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-editable-label/gr-editable-label_test.ts
@@ -10,7 +10,7 @@
import * as MockInteractions from '@polymer/iron-test-helpers/mock-interactions';
import {PaperInputElement} from '@polymer/paper-input/paper-input';
import {GrButton} from '../gr-button/gr-button';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import {IronDropdownElement} from '@polymer/iron-dropdown';
import {
AutocompleteSuggestion,
@@ -44,7 +44,9 @@
});
test('renders', () => {
- expect(element).shadowDom.to.equal(`<label
+ assert.shadowDom.equal(
+ element,
+ `<label
aria-label="value text"
class="editable"
part="label"
@@ -89,7 +91,8 @@
</div>
</div>
</div>
- </iron-dropdown>`);
+ </iron-dropdown>`
+ );
});
test('element render', async () => {
diff --git a/polygerrit-ui/app/elements/shared/gr-file-status/gr-file-status_test.ts b/polygerrit-ui/app/elements/shared/gr-file-status/gr-file-status_test.ts
index 928ec26..9b4ddb5 100644
--- a/polygerrit-ui/app/elements/shared/gr-file-status/gr-file-status_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-file-status/gr-file-status_test.ts
@@ -6,7 +6,7 @@
import '../../../test/common-test-setup-karma';
import './gr-file-status';
import {GrFileStatus} from './gr-file-status';
-import {fixture} from '@open-wc/testing-helpers';
+import {fixture} from '@open-wc/testing';
import {FileInfoStatus} from '../../../api/rest-api';
suite('gr-file-status tests', () => {
@@ -25,36 +25,45 @@
suite('semantic dom diff tests', () => {
test('empty status', async () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <gr-tooltip-content has-tooltip="" title="">
- <div class="status" aria-label="" tabindex="0"></div>
- </gr-tooltip-content>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <gr-tooltip-content has-tooltip="" title="">
+ <div class="status" aria-label="" tabindex="0"></div>
+ </gr-tooltip-content>
+ `
+ );
});
test('added', async () => {
await setStatus(FileInfoStatus.ADDED);
- expect(element).shadowDom.to.equal(/* HTML */ `
- <gr-tooltip-content has-tooltip="" title="Added">
- <div class="A status" aria-label="Added" tabindex="0">A</div>
- </gr-tooltip-content>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <gr-tooltip-content has-tooltip="" title="Added">
+ <div class="A status" aria-label="Added" tabindex="0">A</div>
+ </gr-tooltip-content>
+ `
+ );
});
test('newly added', async () => {
await setStatus(FileInfoStatus.ADDED, true);
- expect(element).shadowDom.to.equal(/* HTML */ `
- <gr-tooltip-content has-tooltip="" title="Newly Added">
- <gr-icon
- icon="new_releases"
- class="size-16"
- aria-label="Newly Added"
- ></gr-icon>
- </gr-tooltip-content>
- <gr-tooltip-content has-tooltip="" title="Newly Added">
- <div class="A status" aria-label="Newly Added" tabindex="0">A</div>
- </gr-tooltip-content>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <gr-tooltip-content has-tooltip="" title="Newly Added">
+ <gr-icon
+ icon="new_releases"
+ class="size-16"
+ aria-label="Newly Added"
+ ></gr-icon>
+ </gr-tooltip-content>
+ <gr-tooltip-content has-tooltip="" title="Newly Added">
+ <div class="A status" aria-label="Newly Added" tabindex="0">A</div>
+ </gr-tooltip-content>
+ `
+ );
});
});
});
diff --git a/polygerrit-ui/app/elements/shared/gr-formatted-text/gr-formatted-text_test.ts b/polygerrit-ui/app/elements/shared/gr-formatted-text/gr-formatted-text_test.ts
index 6810f99..de74e2d 100644
--- a/polygerrit-ui/app/elements/shared/gr-formatted-text/gr-formatted-text_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-formatted-text/gr-formatted-text_test.ts
@@ -3,6 +3,7 @@
* Copyright 2016 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
+import {fixture, html} from '@open-wc/testing';
import '../../../test/common-test-setup-karma';
import './gr-formatted-text';
import {
@@ -19,8 +20,6 @@
LinkSpan,
} from './gr-formatted-text';
-const basicFixture = fixtureFromElement('gr-formatted-text');
-
suite('gr-formatted-text tests', () => {
let element: GrFormattedText;
@@ -70,8 +69,8 @@
return block as QuoteBlock;
}
- setup(() => {
- element = basicFixture.instantiate();
+ setup(async () => {
+ element = await fixture(html`<gr-formatted-text></gr-formatted-text>`);
});
test('parse empty', () => {
@@ -82,14 +81,17 @@
element.content = 'text `code`';
await element.updateComplete;
- expect(element).shadowDom.to.equal(/* HTML */ `
- <p>
- <gr-linked-text content="text " inline="" pre="">
- <span id="output" slot="insert"> text </span>
- </gr-linked-text>
- <span class="inline-code"> code </span>
- </p>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <p>
+ <gr-linked-text content="text " inline="" pre="">
+ <span id="output" slot="insert"> text </span>
+ </gr-linked-text>
+ <span class="inline-code"> code </span>
+ </p>
+ `
+ );
});
for (const text of [
diff --git a/polygerrit-ui/app/elements/shared/gr-hovercard-account/gr-hovercard-account_test.ts b/polygerrit-ui/app/elements/shared/gr-hovercard-account/gr-hovercard-account_test.ts
index 0ef1e69..8265017 100644
--- a/polygerrit-ui/app/elements/shared/gr-hovercard-account/gr-hovercard-account_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-hovercard-account/gr-hovercard-account_test.ts
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
import '../../../test/common-test-setup-karma';
-import {fixture} from '@open-wc/testing-helpers';
+import {fixture} from '@open-wc/testing';
import {html} from 'lit';
import './gr-hovercard-account';
import {GrHovercardAccount} from './gr-hovercard-account';
@@ -65,30 +65,33 @@
});
test('renders', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div id="container" role="tooltip" tabindex="-1">
- <div class="top">
- <div class="avatar">
- <gr-avatar hidden="" imagesize="56"></gr-avatar>
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div id="container" role="tooltip" tabindex="-1">
+ <div class="top">
+ <div class="avatar">
+ <gr-avatar hidden="" imagesize="56"></gr-avatar>
+ </div>
+ <div class="account">
+ <h3 class="heading-3 name">Kermit The Frog</h3>
+ <div class="email">kermit@gmail.com</div>
+ </div>
</div>
- <div class="account">
- <h3 class="heading-3 name">Kermit The Frog</h3>
- <div class="email">kermit@gmail.com</div>
+ <gr-endpoint-decorator name="hovercard-status">
+ <gr-endpoint-param name="account"></gr-endpoint-param>
+ </gr-endpoint-decorator>
+ <div class="status">
+ <span class="title">About me:</span>
+ <span class="value">I am a frog</span>
+ </div>
+ <div class="links">
+ <gr-icon icon="link" class="linkIcon"></gr-icon>
+ <a href="">Changes</a>·<a href="">Dashboard</a>
</div>
</div>
- <gr-endpoint-decorator name="hovercard-status">
- <gr-endpoint-param name="account"></gr-endpoint-param>
- </gr-endpoint-decorator>
- <div class="status">
- <span class="title">About me:</span>
- <span class="value">I am a frog</span>
- </div>
- <div class="links">
- <gr-icon icon="link" class="linkIcon"></gr-icon>
- <a href="">Changes</a>·<a href="">Dashboard</a>
- </div>
- </div>
- `);
+ `
+ );
});
test('account name is shown', () => {
diff --git a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-change-actions-js-api_test.ts b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-change-actions-js-api_test.ts
index b3a52be..7f26cbb 100644
--- a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-change-actions-js-api_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-change-actions-js-api_test.ts
@@ -13,7 +13,7 @@
} from '../../../test/test-utils';
import {getPluginLoader} from './gr-plugin-loader';
import {GrChangeActions} from '../../change/gr-change-actions/gr-change-actions';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import {PluginApi} from '../../../api/plugin';
import {
ActionType,
diff --git a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-change-reply-js-api_test.js b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-change-reply-js-api_test.js
index 5af53f1..d68ac6d 100644
--- a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-change-reply-js-api_test.js
+++ b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-change-reply-js-api_test.js
@@ -6,8 +6,8 @@
import '../../../test/common-test-setup-karma.js';
import '../../change/gr-reply-dialog/gr-reply-dialog.js';
import {stubRestApi} from '../../../test/test-utils.js';
-
-const basicFixture = fixtureFromElement('gr-reply-dialog');
+// eslint-disable-next-line import/named
+import {fixture, html} from '@open-wc/testing';
suite('gr-change-reply-js-api tests', () => {
let element;
@@ -19,11 +19,16 @@
});
suite('early init', () => {
- setup(() => {
- window.Gerrit.install(p => { plugin = p; }, '0.1',
- 'http://test.com/plugins/testplugin/static/test.js');
+ setup(async () => {
+ window.Gerrit.install(
+ p => {
+ plugin = p;
+ },
+ '0.1',
+ 'http://test.com/plugins/testplugin/static/test.js'
+ );
changeReply = plugin.changeReply();
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-reply-dialog></gr-reply-dialog>`);
});
teardown(() => {
@@ -37,7 +42,8 @@
sinon.stub(element, 'setLabelValue');
changeReply.setLabelValue('My-Label', '+1337');
assert.isTrue(
- element.setLabelValue.calledWithExactly('My-Label', '+1337'));
+ element.setLabelValue.calledWithExactly('My-Label', '+1337')
+ );
sinon.stub(element, 'setPluginMessage');
changeReply.showMessage('foobar');
@@ -46,10 +52,15 @@
});
suite('normal init', () => {
- setup(() => {
- element = basicFixture.instantiate();
- window.Gerrit.install(p => { plugin = p; }, '0.1',
- 'http://test.com/plugins/testplugin/static/test.js');
+ setup(async () => {
+ element = await fixture(html`<gr-reply-dialog></gr-reply-dialog>`);
+ window.Gerrit.install(
+ p => {
+ plugin = p;
+ },
+ '0.1',
+ 'http://test.com/plugins/testplugin/static/test.js'
+ );
changeReply = plugin.changeReply();
});
@@ -64,7 +75,8 @@
sinon.stub(element, 'setLabelValue');
changeReply.setLabelValue('My-Label', '+1337');
assert.isTrue(
- element.setLabelValue.calledWithExactly('My-Label', '+1337'));
+ element.setLabelValue.calledWithExactly('My-Label', '+1337')
+ );
sinon.stub(element, 'setPluginMessage');
changeReply.showMessage('foobar');
diff --git a/polygerrit-ui/app/elements/shared/gr-label-info/gr-label-info_test.ts b/polygerrit-ui/app/elements/shared/gr-label-info/gr-label-info_test.ts
index ea7d4a7..a7681f3 100644
--- a/polygerrit-ui/app/elements/shared/gr-label-info/gr-label-info_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-label-info/gr-label-info_test.ts
@@ -20,15 +20,14 @@
createParsedChange,
} from '../../../test/test-data-generators';
import {ApprovalInfo, LabelInfo} from '../../../types/common';
-
-const basicFixture = fixtureFromElement('gr-label-info');
+import {fixture, html} from '@open-wc/testing';
suite('gr-label-info tests', () => {
let element: GrLabelInfo;
const account = createAccountWithIdNameAndEmail(5);
setup(async () => {
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-label-info></gr-label-info>`);
// Needed to trigger computed bindings.
element.account = {};
@@ -52,26 +51,29 @@
});
test('renders', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `<div>
- <div class="reviewer-row">
- <gr-account-chip>
- <gr-vote-chip circle-shape="" slot="vote-chip"> </gr-vote-chip>
- </gr-account-chip>
- <gr-tooltip-content has-tooltip="" title="Remove vote">
- <gr-button
- aria-disabled="false"
- aria-label="Remove vote"
- class="deleteBtn hidden"
- data-account-id="5"
- link=""
- role="button"
- tabindex="0"
- >
- <gr-icon icon="delete" filled></gr-icon>
- </gr-button>
- </gr-tooltip-content>
- </div>
- </div>`);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `<div>
+ <div class="reviewer-row">
+ <gr-account-chip>
+ <gr-vote-chip circle-shape="" slot="vote-chip"> </gr-vote-chip>
+ </gr-account-chip>
+ <gr-tooltip-content has-tooltip="" title="Remove vote">
+ <gr-button
+ aria-disabled="false"
+ aria-label="Remove vote"
+ class="deleteBtn hidden"
+ data-account-id="5"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ <gr-icon icon="delete" filled></gr-icon>
+ </gr-button>
+ </gr-tooltip-content>
+ </div>
+ </div>`
+ );
});
suite('remove reviewer votes', () => {
diff --git a/polygerrit-ui/app/elements/shared/gr-labeled-autocomplete/gr-labeled-autocomplete_test.ts b/polygerrit-ui/app/elements/shared/gr-labeled-autocomplete/gr-labeled-autocomplete_test.ts
index 0cc9917..c55411c 100644
--- a/polygerrit-ui/app/elements/shared/gr-labeled-autocomplete/gr-labeled-autocomplete_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-labeled-autocomplete/gr-labeled-autocomplete_test.ts
@@ -7,15 +7,15 @@
import './gr-labeled-autocomplete';
import {GrLabeledAutocomplete} from './gr-labeled-autocomplete';
import {assertIsDefined} from '../../../utils/common-util';
-
-const basicFixture = fixtureFromElement('gr-labeled-autocomplete');
+import {fixture, html} from '@open-wc/testing';
suite('gr-labeled-autocomplete tests', () => {
let element: GrLabeledAutocomplete;
setup(async () => {
- element = basicFixture.instantiate();
- await element.updateComplete;
+ element = await fixture(
+ html`<gr-labeled-autocomplete></gr-labeled-autocomplete>`
+ );
});
test('tapping trigger focuses autocomplete', () => {
@@ -39,18 +39,21 @@
element.label = 'Some label';
await element.updateComplete;
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div id="container">
- <div id="header">Some label</div>
- <div id="body">
- <gr-autocomplete
- id="autocomplete"
- threshold="0"
- borderless=""
- ></gr-autocomplete>
- <div id="trigger">â–¼</div>
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div id="container">
+ <div id="header">Some label</div>
+ <div id="body">
+ <gr-autocomplete
+ id="autocomplete"
+ threshold="0"
+ borderless=""
+ ></gr-autocomplete>
+ <div id="trigger">â–¼</div>
+ </div>
</div>
- </div>
- `);
+ `
+ );
});
});
diff --git a/polygerrit-ui/app/elements/shared/gr-limited-text/gr-limited-text_test.ts b/polygerrit-ui/app/elements/shared/gr-limited-text/gr-limited-text_test.ts
index 62fcae8..8cefafd9 100644
--- a/polygerrit-ui/app/elements/shared/gr-limited-text/gr-limited-text_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-limited-text/gr-limited-text_test.ts
@@ -8,7 +8,7 @@
import {GrTooltipContent} from '../gr-tooltip-content/gr-tooltip-content';
import './gr-limited-text';
import {GrLimitedText} from './gr-limited-text';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
suite('gr-limited-text tests', () => {
let element: GrLimitedText;
@@ -25,11 +25,14 @@
element.tooltip = 'tip';
await element.updateComplete;
- expect(element).shadowDom.to.equal(/* HTML */ `
- <gr-tooltip-content has-tooltip="" title="abc 123 (tip)">
- abc …
- </gr-tooltip-content>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <gr-tooltip-content has-tooltip="" title="abc 123 (tip)">
+ abc …
+ </gr-tooltip-content>
+ `
+ );
});
test('tooltip without title input', async () => {
diff --git a/polygerrit-ui/app/elements/shared/gr-linked-chip/gr-linked-chip_test.ts b/polygerrit-ui/app/elements/shared/gr-linked-chip/gr-linked-chip_test.ts
index 4667703..b9a055a 100644
--- a/polygerrit-ui/app/elements/shared/gr-linked-chip/gr-linked-chip_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-linked-chip/gr-linked-chip_test.ts
@@ -8,32 +8,33 @@
import {GrLinkedChip} from './gr-linked-chip';
import * as MockInteractions from '@polymer/iron-test-helpers/mock-interactions';
import {queryAndAssert} from '../../../test/test-utils';
-
-const basicFixture = fixtureFromElement('gr-linked-chip');
+import {fixture, html} from '@open-wc/testing';
suite('gr-linked-chip tests', () => {
let element: GrLinkedChip;
setup(async () => {
- element = basicFixture.instantiate();
- await flush();
+ element = await fixture(html`<gr-linked-chip></gr-linked-chip>`);
});
test('renders', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `<div class="container">
- <a href=""> <gr-limited-text> </gr-limited-text> </a>
- <gr-button
- aria-disabled="false"
- class="remove"
- hidden=""
- id="remove"
- link=""
- role="button"
- tabindex="0"
- >
- <gr-icon icon="close"></gr-icon>
- </gr-button>
- </div>`);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `<div class="container">
+ <a href=""> <gr-limited-text> </gr-limited-text> </a>
+ <gr-button
+ aria-disabled="false"
+ class="remove"
+ hidden=""
+ id="remove"
+ link=""
+ role="button"
+ tabindex="0"
+ >
+ <gr-icon icon="close"></gr-icon>
+ </gr-button>
+ </div>`
+ );
});
test('remove fired', async () => {
diff --git a/polygerrit-ui/app/elements/shared/gr-linked-text/gr-linked-text_test.ts b/polygerrit-ui/app/elements/shared/gr-linked-text/gr-linked-text_test.ts
index 0d9673d..563fc57 100644
--- a/polygerrit-ui/app/elements/shared/gr-linked-text/gr-linked-text_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-linked-text/gr-linked-text_test.ts
@@ -6,7 +6,7 @@
import '../../../test/common-test-setup-karma';
import './gr-linked-text';
import {GerritNav} from '../../core/gr-navigation/gr-navigation';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import {GrLinkedText} from './gr-linked-text';
import {CommentLinks} from '../../../types/common';
import {queryAndAssert} from '../../../test/test-utils';
@@ -75,19 +75,22 @@
element.content =
'https://bugs.chromium.org/p/gerrit/issues/detail?id=3650';
await element.updateComplete;
- expect(element).lightDom.to.equal(/* HTML */ `
- <div id="output"></div>
- <span id="output" slot="insert">
- <a
- href="https://bugs.chromium.org/p/gerrit/issues/detail?id=3650"
- rel="noopener"
- style="color: var(--link-color)"
- target="_blank"
- >
- https://bugs.chromium.org/p/gerrit/issues/detail?id=3650
- </a>
- </span>
- `);
+ assert.lightDom.equal(
+ element,
+ /* HTML */ `
+ <div id="output"></div>
+ <span id="output" slot="insert">
+ <a
+ href="https://bugs.chromium.org/p/gerrit/issues/detail?id=3650"
+ rel="noopener"
+ style="color: var(--link-color)"
+ target="_blank"
+ >
+ https://bugs.chromium.org/p/gerrit/issues/detail?id=3650
+ </a>
+ </span>
+ `
+ );
});
test('URL pattern was parsed and linked.', async () => {
diff --git a/polygerrit-ui/app/elements/shared/gr-list-view/gr-list-view_test.ts b/polygerrit-ui/app/elements/shared/gr-list-view/gr-list-view_test.ts
index 887c181..39efb54 100644
--- a/polygerrit-ui/app/elements/shared/gr-list-view/gr-list-view_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-list-view/gr-list-view_test.ts
@@ -10,50 +10,51 @@
import {queryAndAssert, stubBaseUrl} from '../../../test/test-utils';
import {GrButton} from '../gr-button/gr-button';
import * as MockInteractions from '@polymer/iron-test-helpers/mock-interactions';
-
-const basicFixture = fixtureFromElement('gr-list-view');
+import {fixture, html} from '@open-wc/testing';
suite('gr-list-view tests', () => {
let element: GrListView;
setup(async () => {
- element = basicFixture.instantiate();
- await element.updateComplete;
+ element = await fixture(html`<gr-list-view></gr-list-view>`);
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div id="topContainer">
- <div class="filterContainer">
- <label> Filter: </label>
- <iron-input>
- <input id="filter" type="text" />
- </iron-input>
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div id="topContainer">
+ <div class="filterContainer">
+ <label> Filter: </label>
+ <iron-input>
+ <input id="filter" type="text" />
+ </iron-input>
+ </div>
+ <div id="createNewContainer">
+ <gr-button
+ aria-disabled="false"
+ id="createNew"
+ link=""
+ primary=""
+ role="button"
+ tabindex="0"
+ >
+ Create New
+ </gr-button>
+ </div>
</div>
- <div id="createNewContainer">
- <gr-button
- aria-disabled="false"
- id="createNew"
- link=""
- primary=""
- role="button"
- tabindex="0"
- >
- Create New
- </gr-button>
- </div>
- </div>
- <slot> </slot>
- <nav>
- Page 1
- <a hidden="" href="" id="prevArrow">
- <gr-icon icon="chevron_left"></gr-icon>
- </a>
- <a hidden="" href=",25" id="nextArrow">
- <gr-icon icon="chevron_right"></gr-icon>
- </a>
- </nav>
- `);
+ <slot> </slot>
+ <nav>
+ Page 1
+ <a hidden="" href="" id="prevArrow">
+ <gr-icon icon="chevron_left"></gr-icon>
+ </a>
+ <a hidden="" href=",25" id="nextArrow">
+ <gr-icon icon="chevron_right"></gr-icon>
+ </a>
+ </nav>
+ `
+ );
});
test('computeNavLink', () => {
diff --git a/polygerrit-ui/app/elements/shared/gr-overlay/gr-overlay_test.ts b/polygerrit-ui/app/elements/shared/gr-overlay/gr-overlay_test.ts
index 009e5ab..2c5ebfb 100644
--- a/polygerrit-ui/app/elements/shared/gr-overlay/gr-overlay_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-overlay/gr-overlay_test.ts
@@ -5,25 +5,19 @@
*/
import '../../../test/common-test-setup-karma';
import './gr-overlay';
-import {html} from '@polymer/polymer/lib/utils/html-tag';
import {GrOverlay} from './gr-overlay';
-
-const basicFixture = fixtureFromTemplate(html`
- <gr-overlay>
- <div>content</div>
- </gr-overlay>
-`);
+import {fixture, html} from '@open-wc/testing';
suite('gr-overlay tests', () => {
let element: GrOverlay;
- setup(() => {
- element = basicFixture.instantiate() as GrOverlay;
+ setup(async () => {
+ element = await fixture(html`<gr-overlay><div>content</div></gr-overlay>`);
});
test('render', async () => {
await element.open();
- expect(element).shadowDom.to.equal(/* HTML */ ' <slot></slot> ');
+ assert.shadowDom.equal(element, /* HTML */ ' <slot></slot> ');
});
test('popstate listener is attached on open and removed on close', () => {
diff --git a/polygerrit-ui/app/elements/shared/gr-page-nav/gr-page-nav_test.ts b/polygerrit-ui/app/elements/shared/gr-page-nav/gr-page-nav_test.ts
index 5f54989..7c331b8 100644
--- a/polygerrit-ui/app/elements/shared/gr-page-nav/gr-page-nav_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-page-nav/gr-page-nav_test.ts
@@ -6,7 +6,7 @@
import '../../../test/common-test-setup-karma';
import './gr-page-nav';
import {GrPageNav} from './gr-page-nav';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import {queryAndAssert} from '../../../test/test-utils';
suite('gr-page-nav tests', () => {
@@ -23,11 +23,14 @@
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <nav aria-label="Sidebar">
- <slot> </slot>
- </nav>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <nav aria-label="Sidebar">
+ <slot> </slot>
+ </nav>
+ `
+ );
});
test('header is not pinned just below top', () => {
diff --git a/polygerrit-ui/app/elements/shared/gr-repo-branch-picker/gr-repo-branch-picker_test.ts b/polygerrit-ui/app/elements/shared/gr-repo-branch-picker/gr-repo-branch-picker_test.ts
index f6d4f81..aa18301 100644
--- a/polygerrit-ui/app/elements/shared/gr-repo-branch-picker/gr-repo-branch-picker_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-repo-branch-picker/gr-repo-branch-picker_test.ts
@@ -8,36 +8,39 @@
import {GrRepoBranchPicker} from './gr-repo-branch-picker';
import {stubRestApi} from '../../../test/test-utils';
import {GitRef, ProjectInfoWithName, RepoName} from '../../../types/common';
-
-const basicFixture = fixtureFromElement('gr-repo-branch-picker');
+import {fixture, html} from '@open-wc/testing';
suite('gr-repo-branch-picker tests', () => {
let element: GrRepoBranchPicker;
setup(async () => {
- element = basicFixture.instantiate();
- await element.updateComplete;
+ element = await fixture(
+ html`<gr-repo-branch-picker></gr-repo-branch-picker>`
+ );
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div>
- <gr-labeled-autocomplete
- id="repoInput"
- label="Repository"
- placeholder="Select repo"
- >
- </gr-labeled-autocomplete>
- <gr-icon icon="chevron_right"></gr-icon>
- <gr-labeled-autocomplete
- disabled=""
- id="branchInput"
- label="Branch"
- placeholder="Select branch"
- >
- </gr-labeled-autocomplete>
- </div>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div>
+ <gr-labeled-autocomplete
+ id="repoInput"
+ label="Repository"
+ placeholder="Select repo"
+ >
+ </gr-labeled-autocomplete>
+ <gr-icon icon="chevron_right"></gr-icon>
+ <gr-labeled-autocomplete
+ disabled=""
+ id="branchInput"
+ label="Branch"
+ placeholder="Select branch"
+ >
+ </gr-labeled-autocomplete>
+ </div>
+ `
+ );
});
suite('getRepoSuggestions', () => {
diff --git a/polygerrit-ui/app/elements/shared/gr-select/gr-select_test.ts b/polygerrit-ui/app/elements/shared/gr-select/gr-select_test.ts
index bc364e3..99988c2 100644
--- a/polygerrit-ui/app/elements/shared/gr-select/gr-select_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-select/gr-select_test.ts
@@ -5,7 +5,7 @@
*/
import '../../../test/common-test-setup-karma';
import './gr-select';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import {GrSelect} from './gr-select';
suite('gr-select tests', () => {
@@ -24,7 +24,7 @@
});
test('render', () => {
- expect(element).shadowDom.to.equal(/* HTML */ '<slot></slot>');
+ assert.shadowDom.equal(element, /* HTML */ '<slot></slot>');
});
test('bindValue must be set to the first option value', () => {
diff --git a/polygerrit-ui/app/elements/shared/gr-shell-command/gr-shell-command_test.ts b/polygerrit-ui/app/elements/shared/gr-shell-command/gr-shell-command_test.ts
index 9301662..42376b1 100644
--- a/polygerrit-ui/app/elements/shared/gr-shell-command/gr-shell-command_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-shell-command/gr-shell-command_test.ts
@@ -8,29 +8,31 @@
import {GrShellCommand} from './gr-shell-command';
import {GrCopyClipboard} from '../gr-copy-clipboard/gr-copy-clipboard';
import {queryAndAssert} from '../../../test/test-utils';
-
-const basicFixture = fixtureFromElement('gr-shell-command');
+import {fixture, html} from '@open-wc/testing';
suite('gr-shell-command tests', () => {
let element: GrShellCommand;
setup(async () => {
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-shell-command></gr-shell-command>`);
element.command = `git fetch http://gerrit@localhost:8080/a/test-project
refs/changes/05/5/1 && git checkout FETCH_HEAD`;
- await flush();
+ await element.updateComplete;
});
test('render', async () => {
element.label = 'label1';
await element.updateComplete;
- expect(element).shadowDom.to.equal(/* HTML */ `
- <label> label1 </label>
- <div class="commandContainer">
- <gr-copy-clipboard buttontitle="" hastooltip=""> </gr-copy-clipboard>
- </div>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <label> label1 </label>
+ <div class="commandContainer">
+ <gr-copy-clipboard buttontitle="" hastooltip=""> </gr-copy-clipboard>
+ </div>
+ `
+ );
});
test('focusOnCopy', async () => {
diff --git a/polygerrit-ui/app/elements/shared/gr-textarea/gr-textarea_test.ts b/polygerrit-ui/app/elements/shared/gr-textarea/gr-textarea_test.ts
index ac77ed6..1e5ae8d 100644
--- a/polygerrit-ui/app/elements/shared/gr-textarea/gr-textarea_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-textarea/gr-textarea_test.ts
@@ -9,7 +9,7 @@
import * as MockInteractions from '@polymer/iron-test-helpers/mock-interactions';
import {ItemSelectedEvent} from '../gr-autocomplete-dropdown/gr-autocomplete-dropdown';
import {stubFlags, stubRestApi, waitUntil} from '../../../test/test-utils';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import {createAccountWithEmail} from '../../../test/test-data-generators';
suite('gr-textarea tests', () => {
@@ -22,7 +22,8 @@
});
test('renders', () => {
- expect(element).shadowDom.to.equal(
+ assert.shadowDom.equal(
+ element,
/* HTML */ `<div id="hiddenText"></div>
<span id="caratSpan"> </span>
<gr-autocomplete-dropdown
@@ -52,7 +53,8 @@
});
test('renders', () => {
- expect(element).shadowDom.to.equal(
+ assert.shadowDom.equal(
+ element,
/* HTML */ `
<div id="hiddenText"></div>
<span id="caratSpan"> </span>
diff --git a/polygerrit-ui/app/elements/shared/gr-tooltip-content/gr-tooltip-content_test.ts b/polygerrit-ui/app/elements/shared/gr-tooltip-content/gr-tooltip-content_test.ts
index 051fbd4..e190e9b 100644
--- a/polygerrit-ui/app/elements/shared/gr-tooltip-content/gr-tooltip-content_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-tooltip-content/gr-tooltip-content_test.ts
@@ -6,7 +6,7 @@
import '../../../test/common-test-setup-karma';
import './gr-tooltip-content';
import {GrTooltipContent} from './gr-tooltip-content';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import {GrTooltip} from '../gr-tooltip/gr-tooltip';
import {query} from '../../../test/test-utils';
@@ -40,10 +40,13 @@
element.showIcon = true;
await element.updateComplete;
- expect(element).shadowDom.to.equal(/* HTML */ `
- <slot> </slot>
- <gr-icon icon="info" filled></gr-icon>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <slot> </slot>
+ <gr-icon icon="info" filled></gr-icon>
+ `
+ );
});
test('icon is not visible by default', () => {
diff --git a/polygerrit-ui/app/elements/shared/gr-tooltip/gr-tooltip_test.ts b/polygerrit-ui/app/elements/shared/gr-tooltip/gr-tooltip_test.ts
index e1fb0237..f2b38da 100644
--- a/polygerrit-ui/app/elements/shared/gr-tooltip/gr-tooltip_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-tooltip/gr-tooltip_test.ts
@@ -7,14 +7,13 @@
import './gr-tooltip';
import {GrTooltip} from './gr-tooltip';
import {queryAndAssert} from '../../../test/test-utils';
-
-const basicFixture = fixtureFromElement('gr-tooltip');
+import {fixture, html} from '@open-wc/testing';
suite('gr-tooltip tests', () => {
let element: GrTooltip;
setup(async () => {
- element = basicFixture.instantiate();
+ element = await fixture(html`<gr-tooltip></gr-tooltip>`);
await element.updateComplete;
});
@@ -22,13 +21,16 @@
element.text = 'tooltipText';
await element.updateComplete;
- expect(element).shadowDom.to.equal(/* HTML */ `
- <div class="tooltip">
- <i class="arrow arrowPositionBelow" style="margin-left:0;"> </i>
- tooltipText
- <i class="arrow arrowPositionAbove" style="margin-left:0;"> </i>
- </div>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <div class="tooltip">
+ <i class="arrow arrowPositionBelow" style="margin-left:0;"> </i>
+ tooltipText
+ <i class="arrow arrowPositionAbove" style="margin-left:0;"> </i>
+ </div>
+ `
+ );
});
test('max-width is respected if set', async () => {
diff --git a/polygerrit-ui/app/elements/shared/gr-vote-chip/gr-vote-chip_test.ts b/polygerrit-ui/app/elements/shared/gr-vote-chip/gr-vote-chip_test.ts
index e7dee56..f3906d4 100644
--- a/polygerrit-ui/app/elements/shared/gr-vote-chip/gr-vote-chip_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-vote-chip/gr-vote-chip_test.ts
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
import '../../../test/common-test-setup-karma';
-import {fixture} from '@open-wc/testing-helpers';
+import {fixture} from '@open-wc/testing';
import {html} from 'lit';
import {getAppContext} from '../../../services/app-context';
import './gr-vote-chip';
@@ -36,13 +36,16 @@
});
test('renders', () => {
- expect(element).shadowDom.to.equal(/* HTML */ ` <gr-tooltip-content
- class="container"
- has-tooltip=""
- title=""
- >
- <div class="max vote-chip">✓</div>
- </gr-tooltip-content>`);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ ` <gr-tooltip-content
+ class="container"
+ has-tooltip=""
+ title=""
+ >
+ <div class="max vote-chip">✓</div>
+ </gr-tooltip-content>`
+ );
});
});
@@ -61,13 +64,16 @@
});
test('renders', () => {
- expect(element).shadowDom.to.equal(/* HTML */ ` <gr-tooltip-content
- class="container"
- has-tooltip=""
- title=""
- >
- <div class="positive vote-chip">+2</div>
- </gr-tooltip-content>`);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ ` <gr-tooltip-content
+ class="container"
+ has-tooltip=""
+ title=""
+ >
+ <div class="positive vote-chip">+2</div>
+ </gr-tooltip-content>`
+ );
});
test('renders negative vote', async () => {
@@ -78,13 +84,16 @@
element = await fixture<GrVoteChip>(
html`<gr-vote-chip .label=${labelInfo} .vote=${vote}></gr-vote-chip>`
);
- expect(element).shadowDom.to.equal(/* HTML */ ` <gr-tooltip-content
- class="container"
- has-tooltip=""
- title="Wrong Style or Formatting"
- >
- <div class="min vote-chip">-1</div>
- </gr-tooltip-content>`);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ ` <gr-tooltip-content
+ class="container"
+ has-tooltip=""
+ title="Wrong Style or Formatting"
+ >
+ <div class="min vote-chip">-1</div>
+ </gr-tooltip-content>`
+ );
});
test('renders for more than 1 vote', async () => {
@@ -95,14 +104,17 @@
more
></gr-vote-chip>`
);
- expect(element).shadowDom.to.equal(/* HTML */ ` <gr-tooltip-content
- class="container more"
- has-tooltip=""
- title=""
- >
- <div class="positive vote-chip">+2</div>
- <div class="chip-angle positive">+2</div>
- </gr-tooltip-content>`);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ ` <gr-tooltip-content
+ class="container more"
+ has-tooltip=""
+ title=""
+ >
+ <div class="positive vote-chip">+2</div>
+ <div class="chip-angle positive">+2</div>
+ </gr-tooltip-content>`
+ );
});
});
});
diff --git a/polygerrit-ui/app/embed/diff/gr-context-controls/gr-context-controls_test.ts b/polygerrit-ui/app/embed/diff/gr-context-controls/gr-context-controls_test.ts
index 7bc1b2f..93a5957 100644
--- a/polygerrit-ui/app/embed/diff/gr-context-controls/gr-context-controls_test.ts
+++ b/polygerrit-ui/app/embed/diff/gr-context-controls/gr-context-controls_test.ts
@@ -11,8 +11,7 @@
import {GrDiffLine, GrDiffLineType} from '../gr-diff/gr-diff-line';
import {GrDiffGroup, GrDiffGroupType} from '../gr-diff/gr-diff-group';
import {DiffFileMetaInfo, DiffInfo, SyntaxBlock} from '../../../api/diff';
-
-const blankFixture = fixtureFromElement('div');
+import {fixture, html} from '@open-wc/testing';
suite('gr-context-control tests', () => {
let element: GrContextControls;
@@ -21,7 +20,8 @@
element = document.createElement('gr-context-controls');
element.diff = {content: []} as any as DiffInfo;
element.renderPreferences = {};
- blankFixture.instantiate().appendChild(element);
+ const div = await fixture(html`<div></div>`);
+ div.appendChild(element);
await flush();
});
diff --git a/polygerrit-ui/app/embed/diff/gr-diff-builder/gr-diff-builder-element_test.ts b/polygerrit-ui/app/embed/diff/gr-diff-builder/gr-diff-builder-element_test.ts
index 08d64cb..86d68ba 100644
--- a/polygerrit-ui/app/embed/diff/gr-diff-builder/gr-diff-builder-element_test.ts
+++ b/polygerrit-ui/app/embed/diff/gr-diff-builder/gr-diff-builder-element_test.ts
@@ -29,7 +29,7 @@
import {createDefaultDiffPrefs} from '../../../constants/constants';
import {KeyLocations} from '../gr-diff-processor/gr-diff-processor';
import {BlameInfo} from '../../../types/common';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
const DEFAULT_PREFS = createDefaultDiffPrefs();
@@ -1105,21 +1105,24 @@
assert.isTrue(getBlameStub.calledWithExactly(3));
assert.equal(result.getAttribute('data-line-number'), '3');
- expect(result).dom.to.equal(/* HTML */ `
- <span class="gr-diff">
- <a class="blameDate gr-diff" href="/r/q/1234567890"> 12/12/2019 </a>
- <span class="blameAuthor gr-diff">Clark</span>
- <gr-hovercard class="gr-diff">
- <span class="blameHoverCard gr-diff">
- Commit 1234567890<br />
- Author: Clark Kent<br />
- Date: 12/12/2019<br />
- <br />
- Testing Commit
- </span>
- </gr-hovercard>
- </span>
- `);
+ assert.dom.equal(
+ result,
+ /* HTML */ `
+ <span class="gr-diff">
+ <a class="blameDate gr-diff" href="/r/q/1234567890"> 12/12/2019 </a>
+ <span class="blameAuthor gr-diff">Clark</span>
+ <gr-hovercard class="gr-diff">
+ <span class="blameHoverCard gr-diff">
+ Commit 1234567890<br />
+ Author: Clark Kent<br />
+ Date: 12/12/2019<br />
+ <br />
+ Testing Commit
+ </span>
+ </gr-hovercard>
+ </span>
+ `
+ );
});
});
});
diff --git a/polygerrit-ui/app/embed/diff/gr-diff-cursor/gr-diff-cursor_test.ts b/polygerrit-ui/app/embed/diff/gr-diff-cursor/gr-diff-cursor_test.ts
index e3593cb..4eb44a1 100644
--- a/polygerrit-ui/app/embed/diff/gr-diff-cursor/gr-diff-cursor_test.ts
+++ b/polygerrit-ui/app/embed/diff/gr-diff-cursor/gr-diff-cursor_test.ts
@@ -6,7 +6,7 @@
import '../../../test/common-test-setup-karma';
import '../gr-diff/gr-diff';
import './gr-diff-cursor';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import {mockPromise, queryAll, queryAndAssert} from '../../../test/test-utils';
import {createDiff} from '../../../test/test-data-generators';
import {createDefaultDiffPrefs} from '../../../constants/constants';
diff --git a/polygerrit-ui/app/embed/diff/gr-diff-highlight/gr-annotation_test.js b/polygerrit-ui/app/embed/diff/gr-diff-highlight/gr-annotation_test.js
index a4bad6d..f5aaa53 100644
--- a/polygerrit-ui/app/embed/diff/gr-diff-highlight/gr-annotation_test.js
+++ b/polygerrit-ui/app/embed/diff/gr-diff-highlight/gr-annotation_test.js
@@ -4,22 +4,26 @@
* SPDX-License-Identifier: Apache-2.0
*/
-const basicFixture = fixtureFromTemplate(html`
-<div>Lorem ipsum dolor sit amet, suspendisse inceptos vehicula</div>
-`);
-
import '../../../test/common-test-setup-karma.js';
import {GrAnnotation} from './gr-annotation.js';
-import {sanitizeDOMValue, setSanitizeDOMValue} from '@polymer/polymer/lib/utils/settings.js';
-import {html} from '@polymer/polymer/lib/utils/html-tag.js';
+import {
+ sanitizeDOMValue,
+ setSanitizeDOMValue,
+} from '@polymer/polymer/lib/utils/settings.js';
+// eslint-disable-next-line import/named
+import {fixture, html} from '@open-wc/testing';
suite('annotation', () => {
let str;
let parent;
let textNode;
- setup(() => {
- parent = basicFixture.instantiate();
+ setup(async () => {
+ parent = await fixture(
+ html`
+ <div>Lorem ipsum dolor sit amet, suspendisse inceptos vehicula</div>
+ `
+ );
textNode = parent.childNodes[0];
str = textNode.textContent;
});
@@ -96,17 +100,16 @@
});
test('_annotateElement design doc example', () => {
- const layers = [
- 'amet, ',
- 'inceptos ',
- 'amet, ',
- 'et, suspendisse ince',
- ];
+ const layers = ['amet, ', 'inceptos ', 'amet, ', 'et, suspendisse ince'];
// Apply the layers successively.
layers.forEach((layer, i) => {
GrAnnotation.annotateElement(
- parent, str.indexOf(layer), layer.length, `layer-${i + 1}`);
+ parent,
+ str.indexOf(layer),
+ layer.length,
+ `layer-${i + 1}`
+ );
});
assert.equal(parent.textContent, str);
@@ -142,10 +145,10 @@
assert.equal(layer4[2].textContent, 'ince');
assert.equal(layer4[2].parentElement, layer2[0]);
- assert.equal(layer4[0].textContent +
- layer4[1].textContent +
- layer4[2].textContent,
- layers[3]);
+ assert.equal(
+ layer4[0].textContent + layer4[1].textContent + layer4[2].textContent,
+ layers[3]
+ );
});
test('splitTextNode', () => {
@@ -189,12 +192,14 @@
const length = 10;
const container = document.createElement('div');
container.textContent = fullText;
- GrAnnotation.annotateWithElement(
- container, 1, length, {tagName: 'test-wrapper'});
+ GrAnnotation.annotateWithElement(container, 1, length, {
+ tagName: 'test-wrapper',
+ });
assert.equal(
container.innerHTML,
- '0<test-wrapper>1234567890</test-wrapper>123456789');
+ '0<test-wrapper>1234567890</test-wrapper>123456789'
+ );
});
test('annotates when spanning multiple nodes', () => {
@@ -202,8 +207,9 @@
const container = document.createElement('div');
container.textContent = fullText;
GrAnnotation.annotateElement(container, 5, length, 'testclass');
- GrAnnotation.annotateWithElement(
- container, 1, length, {tagName: 'test-wrapper'});
+ GrAnnotation.annotateWithElement(container, 1, length, {
+ tagName: 'test-wrapper',
+ });
assert.equal(
container.innerHTML,
@@ -213,19 +219,22 @@
'<hl class="testclass">567890</hl>' +
'</test-wrapper>' +
'<hl class="testclass">1234</hl>' +
- '56789');
+ '56789'
+ );
});
test('annotates text node', () => {
const length = 10;
const container = document.createElement('div');
container.textContent = fullText;
- GrAnnotation.annotateWithElement(
- container.childNodes[0], 1, length, {tagName: 'test-wrapper'});
+ GrAnnotation.annotateWithElement(container.childNodes[0], 1, length, {
+ tagName: 'test-wrapper',
+ });
assert.equal(
container.innerHTML,
- '0<test-wrapper>1234567890</test-wrapper>123456789');
+ '0<test-wrapper>1234567890</test-wrapper>123456789'
+ );
});
test('handles zero-length nodes', () => {
@@ -233,12 +242,14 @@
container.appendChild(document.createTextNode('0123456789'));
container.appendChild(document.createElement('span'));
container.appendChild(document.createTextNode('0123456789'));
- GrAnnotation.annotateWithElement(
- container, 1, 10, {tagName: 'test-wrapper'});
+ GrAnnotation.annotateWithElement(container, 1, 10, {
+ tagName: 'test-wrapper',
+ });
assert.equal(
container.innerHTML,
- '0<test-wrapper>123456789<span></span>0</test-wrapper>123456789');
+ '0<test-wrapper>123456789<span></span>0</test-wrapper>123456789'
+ );
});
test('handles comment nodes', () => {
@@ -248,15 +259,17 @@
container.appendChild(document.createComment('comment2'));
container.appendChild(document.createElement('span'));
container.appendChild(document.createTextNode('0123456789'));
- GrAnnotation.annotateWithElement(
- container, 1, 10, {tagName: 'test-wrapper'});
+ GrAnnotation.annotateWithElement(container, 1, 10, {
+ tagName: 'test-wrapper',
+ });
assert.equal(
container.innerHTML,
'<!--comment1-->' +
'0<test-wrapper>123456789' +
'<!--comment2-->' +
- '<span></span>0</test-wrapper>123456789');
+ '<span></span>0</test-wrapper>123456789'
+ );
});
test('sets sanitized attributes', () => {
@@ -267,17 +280,34 @@
'data-foo': 'bar',
'class': 'hello world',
};
- GrAnnotation.annotateWithElement(
- container, 1, length, {tagName: 'test-wrapper', attributes});
- assert(mockSanitize.calledWith(
- 'foo', 'href', 'attribute', sinon.match.instanceOf(Element)));
- assert(mockSanitize.calledWith(
- 'bar', 'data-foo', 'attribute', sinon.match.instanceOf(Element)));
- assert(mockSanitize.calledWith(
- 'hello world',
- 'class',
- 'attribute',
- sinon.match.instanceOf(Element)));
+ GrAnnotation.annotateWithElement(container, 1, length, {
+ tagName: 'test-wrapper',
+ attributes,
+ });
+ assert(
+ mockSanitize.calledWith(
+ 'foo',
+ 'href',
+ 'attribute',
+ sinon.match.instanceOf(Element)
+ )
+ );
+ assert(
+ mockSanitize.calledWith(
+ 'bar',
+ 'data-foo',
+ 'attribute',
+ sinon.match.instanceOf(Element)
+ )
+ );
+ assert(
+ mockSanitize.calledWith(
+ 'hello world',
+ 'class',
+ 'attribute',
+ sinon.match.instanceOf(Element)
+ )
+ );
const el = container.querySelector('test-wrapper');
assert.equal(el.getAttribute('href'), 'foo');
assert.equal(el.getAttribute('data-foo'), 'bar');
@@ -285,4 +315,3 @@
});
});
});
-
diff --git a/polygerrit-ui/app/embed/diff/gr-diff-highlight/gr-diff-highlight_test.ts b/polygerrit-ui/app/embed/diff/gr-diff-highlight/gr-diff-highlight_test.ts
index b819754..d42bbe0 100644
--- a/polygerrit-ui/app/embed/diff/gr-diff-highlight/gr-diff-highlight_test.ts
+++ b/polygerrit-ui/app/embed/diff/gr-diff-highlight/gr-diff-highlight_test.ts
@@ -6,7 +6,7 @@
import '../../../test/common-test-setup-karma';
import './gr-diff-highlight';
import {_getTextOffset} from './gr-range-normalizer';
-import {fixture, fixtureCleanup, html} from '@open-wc/testing-helpers';
+import {fixture, fixtureCleanup, html} from '@open-wc/testing';
import {
GrDiffHighlight,
DiffBuilderInterface,
@@ -16,7 +16,11 @@
import {SinonStubbedMember} from 'sinon';
import {queryAndAssert} from '../../../utils/common-util';
import {GrDiffThreadElement} from '../gr-diff/gr-diff-utils';
-import {waitQueryAndAssert, waitUntil} from '../../../test/test-utils';
+import {
+ stubElement,
+ waitQueryAndAssert,
+ waitUntil,
+} from '../../../test/test-utils';
import {GrSelectionActionBox} from '../gr-selection-action-box/gr-selection-action-box';
// Splitting long lines in html into shorter rows breaks tests:
@@ -222,8 +226,8 @@
element = new GrDiffHighlight();
element.init(diff, builder);
contentStubs = [];
- stub('gr-selection-action-box', 'placeAbove');
- stub('gr-selection-action-box', 'placeBelow');
+ stubElement('gr-selection-action-box', 'placeAbove');
+ stubElement('gr-selection-action-box', 'placeBelow');
});
teardown(() => {
diff --git a/polygerrit-ui/app/embed/diff/gr-diff-mode-selector/gr-diff-mode-selector_test.ts b/polygerrit-ui/app/embed/diff/gr-diff-mode-selector/gr-diff-mode-selector_test.ts
index b089c58..953a23f 100644
--- a/polygerrit-ui/app/embed/diff/gr-diff-mode-selector/gr-diff-mode-selector_test.ts
+++ b/polygerrit-ui/app/embed/diff/gr-diff-mode-selector/gr-diff-mode-selector_test.ts
@@ -12,7 +12,7 @@
stubUsers,
waitUntilObserved,
} from '../../../test/test-utils';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import {wrapInProvider} from '../../../models/di-provider-element';
import {
BrowserModel,
@@ -52,33 +52,36 @@
mode => mode === DiffViewMode.SIDE_BY_SIDE
);
- expect(element).shadowDom.to.equal(/* HTML */ `
- <gr-tooltip-content has-tooltip="" title="Side-by-side diff">
- <gr-button
- id="sideBySideBtn"
- link=""
- class="selected"
- aria-disabled="false"
- aria-pressed="true"
- role="button"
- tabindex="0"
- >
- <gr-icon icon="view_column_2" filled></gr-icon>
- </gr-button>
- </gr-tooltip-content>
- <gr-tooltip-content has-tooltip title="Unified diff">
- <gr-button
- id="unifiedBtn"
- link=""
- role="button"
- aria-disabled="false"
- aria-pressed="false"
- tabindex="0"
- >
- <gr-icon filled icon="calendar_view_day"></gr-icon>
- </gr-button>
- </gr-tooltip-content>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <gr-tooltip-content has-tooltip="" title="Side-by-side diff">
+ <gr-button
+ id="sideBySideBtn"
+ link=""
+ class="selected"
+ aria-disabled="false"
+ aria-pressed="true"
+ role="button"
+ tabindex="0"
+ >
+ <gr-icon icon="view_column_2" filled></gr-icon>
+ </gr-button>
+ </gr-tooltip-content>
+ <gr-tooltip-content has-tooltip title="Unified diff">
+ <gr-button
+ id="unifiedBtn"
+ link=""
+ role="button"
+ aria-disabled="false"
+ aria-pressed="false"
+ tabindex="0"
+ >
+ <gr-icon filled icon="calendar_view_day"></gr-icon>
+ </gr-button>
+ </gr-tooltip-content>
+ `
+ );
});
test('renders unified selected', async () => {
@@ -91,34 +94,37 @@
mode => mode === DiffViewMode.UNIFIED
);
- expect(element).shadowDom.to.equal(/* HTML */ `
- <gr-tooltip-content has-tooltip="" title="Side-by-side diff">
- <gr-button
- id="sideBySideBtn"
- link=""
- class=""
- aria-disabled="false"
- aria-pressed="false"
- role="button"
- tabindex="0"
- >
- <gr-icon icon="view_column_2" filled></gr-icon>
- </gr-button>
- </gr-tooltip-content>
- <gr-tooltip-content has-tooltip title="Unified diff">
- <gr-button
- id="unifiedBtn"
- link=""
- class="selected"
- role="button"
- aria-disabled="false"
- aria-pressed="true"
- tabindex="0"
- >
- <gr-icon icon="calendar_view_day" filled></gr-icon>
- </gr-button>
- </gr-tooltip-content>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <gr-tooltip-content has-tooltip="" title="Side-by-side diff">
+ <gr-button
+ id="sideBySideBtn"
+ link=""
+ class=""
+ aria-disabled="false"
+ aria-pressed="false"
+ role="button"
+ tabindex="0"
+ >
+ <gr-icon icon="view_column_2" filled></gr-icon>
+ </gr-button>
+ </gr-tooltip-content>
+ <gr-tooltip-content has-tooltip title="Unified diff">
+ <gr-button
+ id="unifiedBtn"
+ link=""
+ class="selected"
+ role="button"
+ aria-disabled="false"
+ aria-pressed="true"
+ tabindex="0"
+ >
+ <gr-icon icon="calendar_view_day" filled></gr-icon>
+ </gr-button>
+ </gr-tooltip-content>
+ `
+ );
});
test('set mode', async () => {
diff --git a/polygerrit-ui/app/embed/diff/gr-diff-selection/gr-diff-selection_test.ts b/polygerrit-ui/app/embed/diff/gr-diff-selection/gr-diff-selection_test.ts
index b44114a..ebdff48 100644
--- a/polygerrit-ui/app/embed/diff/gr-diff-selection/gr-diff-selection_test.ts
+++ b/polygerrit-ui/app/embed/diff/gr-diff-selection/gr-diff-selection_test.ts
@@ -9,7 +9,7 @@
import {createDiff} from '../../../test/test-data-generators';
import {DiffInfo, Side} from '../../../api/diff';
import {GrFormattedText} from '../../../elements/shared/gr-formatted-text/gr-formatted-text';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
import {mouseDown} from '../../../test/test-utils';
const diffTableTemplate = html`
diff --git a/polygerrit-ui/app/embed/diff/gr-diff/gr-diff-utils_test.ts b/polygerrit-ui/app/embed/diff/gr-diff/gr-diff-utils_test.ts
index 3885b45..a81959d 100644
--- a/polygerrit-ui/app/embed/diff/gr-diff/gr-diff-utils_test.ts
+++ b/polygerrit-ui/app/embed/diff/gr-diff/gr-diff-utils_test.ts
@@ -69,7 +69,7 @@
for (const size of [1, 3, 8, 55]) {
const html = createTabWrapper(size).outerHTML;
- expect(html).to.match(pattern);
+ assert.match(html, pattern);
assert.equal(html.match(pattern)?.[2], size.toString());
}
});
diff --git a/polygerrit-ui/app/embed/diff/gr-diff/gr-diff_test.ts b/polygerrit-ui/app/embed/diff/gr-diff/gr-diff_test.ts
index 000be0e..72c52b6 100644
--- a/polygerrit-ui/app/embed/diff/gr-diff/gr-diff_test.ts
+++ b/polygerrit-ui/app/embed/diff/gr-diff/gr-diff_test.ts
@@ -9,7 +9,6 @@
import {GrDiffBuilderImage} from '../gr-diff-builder/gr-diff-builder-image';
import {getComputedStyleValue} from '../../../utils/dom-util';
import {_setHiddenScroll} from '../../../scripts/hiddenscroll';
-import {runA11yAudit} from '../../../test/a11y-test-utils';
import '@polymer/paper-button/paper-button';
import {
DiffContent,
@@ -34,11 +33,11 @@
import {ImageInfo} from '../../../types/common';
import {GrRangedCommentHint} from '../gr-ranged-comment-hint/gr-ranged-comment-hint';
import {assertIsDefined} from '../../../utils/common-util';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html, assert} from '@open-wc/testing';
suite('gr-diff a11y test', () => {
test('audit', async () => {
- await runA11yAudit(fixtureFromElement('gr-diff'));
+ assert.isAccessible(await fixture(html`<gr-diff></gr-diff>`));
});
});
diff --git a/polygerrit-ui/app/embed/diff/gr-ranged-comment-hint/gr-ranged-comment-hint_test.ts b/polygerrit-ui/app/embed/diff/gr-ranged-comment-hint/gr-ranged-comment-hint_test.ts
index 757fe34..84c9f57 100644
--- a/polygerrit-ui/app/embed/diff/gr-ranged-comment-hint/gr-ranged-comment-hint_test.ts
+++ b/polygerrit-ui/app/embed/diff/gr-ranged-comment-hint/gr-ranged-comment-hint_test.ts
@@ -9,14 +9,15 @@
import {GrRangedCommentHint} from './gr-ranged-comment-hint';
import {queryAndAssert} from '../../../test/test-utils';
import {GrRangeHeader} from '../gr-range-header/gr-range-header';
-
-const basicFixture = fixtureFromElement('gr-ranged-comment-hint');
+import {fixture, html} from '@open-wc/testing';
suite('gr-ranged-comment-hint tests', () => {
let element: GrRangedCommentHint;
setup(async () => {
- element = basicFixture.instantiate();
+ element = await fixture(
+ html`<gr-ranged-comment-hint></gr-ranged-comment-hint>`
+ );
await flush();
});
diff --git a/polygerrit-ui/app/embed/diff/gr-selection-action-box/gr-selection-action-box_test.ts b/polygerrit-ui/app/embed/diff/gr-selection-action-box/gr-selection-action-box_test.ts
index a92c967..f3f54b0 100644
--- a/polygerrit-ui/app/embed/diff/gr-selection-action-box/gr-selection-action-box_test.ts
+++ b/polygerrit-ui/app/embed/diff/gr-selection-action-box/gr-selection-action-box_test.ts
@@ -7,7 +7,7 @@
import './gr-selection-action-box';
import {GrSelectionActionBox} from './gr-selection-action-box';
import {queryAndAssert} from '../../../test/test-utils';
-import {fixture, html} from '@open-wc/testing-helpers';
+import {fixture, html} from '@open-wc/testing';
suite('gr-selection-action-box', () => {
let container: HTMLDivElement;
@@ -31,9 +31,16 @@
});
test('renders', () => {
- expect(element).shadowDom.to.equal(/* HTML */ `
- <gr-tooltip invisible id="tooltip" text="Press c to comment"></gr-tooltip>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <gr-tooltip
+ invisible
+ id="tooltip"
+ text="Press c to comment"
+ ></gr-tooltip>
+ `
+ );
});
test('ignores regular keys', () => {
@@ -103,9 +110,12 @@
test('renders visible', async () => {
await element.placeAbove(target);
await element.updateComplete;
- expect(element).shadowDom.to.equal(/* HTML */ `
- <gr-tooltip id="tooltip" text="Press c to comment"></gr-tooltip>
- `);
+ assert.shadowDom.equal(
+ element,
+ /* HTML */ `
+ <gr-tooltip id="tooltip" text="Press c to comment"></gr-tooltip>
+ `
+ );
});
test('placeAbove for Element argument', async () => {
diff --git a/polygerrit-ui/app/mixins/hovercard-mixin/hovercard-mixin_test.ts b/polygerrit-ui/app/mixins/hovercard-mixin/hovercard-mixin_test.ts
index 886e92d..c3bf196 100644
--- a/polygerrit-ui/app/mixins/hovercard-mixin/hovercard-mixin_test.ts
+++ b/polygerrit-ui/app/mixins/hovercard-mixin/hovercard-mixin_test.ts
@@ -3,12 +3,13 @@
* Copyright 2018 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
-import '../../test/common-test-setup-karma.js';
-import {HovercardMixin} from './hovercard-mixin.js';
-import {html, LitElement} from 'lit';
+import '../../test/common-test-setup-karma';
+import {HovercardMixin} from './hovercard-mixin';
+import {LitElement} from 'lit';
import {customElement} from 'lit/decorators.js';
-import {MockPromise, mockPromise, pressKey} from '../../test/test-utils.js';
-import {findActiveElement, Key} from '../../utils/dom-util.js';
+import {MockPromise, mockPromise, pressKey} from '../../test/test-utils';
+import {findActiveElement, Key} from '../../utils/dom-util';
+import {fixture, html} from '@open-wc/testing';
const base = HovercardMixin(LitElement);
@@ -33,22 +34,22 @@
}
}
-const basicFixture = fixtureFromElement('hovercard-mixin-test');
-
suite('gr-hovercard tests', () => {
let element: HovercardMixinTest;
let button: HTMLElement;
let testPromise: MockPromise<void>;
- setup(() => {
+ setup(async () => {
testPromise = mockPromise();
button = document.createElement('button');
button.innerHTML = 'Hello';
button.setAttribute('id', 'foo');
document.body.appendChild(button);
- element = basicFixture.instantiate();
+ element = await fixture(
+ html`<hovercard-mixin-test></hovercard-mixin-test>`
+ );
});
teardown(() => {
diff --git a/polygerrit-ui/app/models/dependency_test.ts b/polygerrit-ui/app/models/dependency_test.ts
index 1751051..487b0dc 100644
--- a/polygerrit-ui/app/models/dependency_test.ts
+++ b/polygerrit-ui/app/models/dependency_test.ts
@@ -7,6 +7,7 @@
import {html, LitElement} from 'lit';
import {customElement, property, query} from 'lit/decorators.js';
import '../test/common-test-setup-karma.js';
+import {fixture} from '@open-wc/testing';
interface FooService {
value: string;
@@ -89,17 +90,17 @@
}
suite('Dependency', () => {
- test('It instantiates', async () => {
- const fixture = fixtureFromElement('lit-foo-provider');
- const element = fixture.instantiate();
- await element.updateComplete;
+ let element: LitFooProviderElement;
+
+ setup(async () => {
+ element = await fixture(html`<lit-foo-provider></lit-foo-provider>`);
+ });
+
+ test('It instantiates', () => {
assert.isDefined(element.bar?.litChild?.barRef());
});
test('It works by connecting and reconnecting', async () => {
- const fixture = fixtureFromElement('lit-foo-provider');
- const element = fixture.instantiate();
- await element.updateComplete;
assert.isDefined(element.bar?.litChild?.barRef());
element.showBarProvider = false;
diff --git a/polygerrit-ui/app/models/di-provider-element_test.ts b/polygerrit-ui/app/models/di-provider-element_test.ts
index 8613e83..6134307 100644
--- a/polygerrit-ui/app/models/di-provider-element_test.ts
+++ b/polygerrit-ui/app/models/di-provider-element_test.ts
@@ -7,7 +7,7 @@
import {customElement, state} from 'lit/decorators.js';
import {define, resolve} from './dependency';
import '../test/common-test-setup-karma.js';
-import {fixture} from '@open-wc/testing-helpers';
+import {fixture} from '@open-wc/testing';
import {DIProviderElement, wrapInProvider} from './di-provider-element';
import {BehaviorSubject} from 'rxjs';
import {waitUntilObserved} from '../test/test-utils';
@@ -60,13 +60,13 @@
});
test('provides values to the wrapped element', () => {
- expect(element).shadowDom.to.equal('<div>foo</div>');
+ assert.shadowDom.equal(element, '<div>foo</div>');
});
test('enables the test to control the injected dependency', async () => {
injectedModel.next('bar');
await waitUntilObserved(injectedModel, value => value === 'bar');
- expect(element).shadowDom.to.equal('<div>bar</div>');
+ assert.shadowDom.equal(element, '<div>bar</div>');
});
});
diff --git a/polygerrit-ui/app/services/app-context-init.ts b/polygerrit-ui/app/services/app-context-init.ts
index ec58698..bdb5d8b 100644
--- a/polygerrit-ui/app/services/app-context-init.ts
+++ b/polygerrit-ui/app/services/app-context-init.ts
@@ -51,7 +51,8 @@
},
restApiService: (ctx: Partial<AppContext>) => {
assertIsDefined(ctx.authService, 'authService');
- return new GrRestApiServiceImpl(ctx.authService);
+ assertIsDefined(ctx.flagsService, 'flagsService');
+ return new GrRestApiServiceImpl(ctx.authService, ctx.flagsService);
},
jsApiService: (ctx: Partial<AppContext>) => {
const reportingService = ctx.reportingService;
diff --git a/polygerrit-ui/app/services/gr-rest-api/gr-rest-api-impl.ts b/polygerrit-ui/app/services/gr-rest-api/gr-rest-api-impl.ts
index 9cf7db8..0a550c4 100644
--- a/polygerrit-ui/app/services/gr-rest-api/gr-rest-api-impl.ts
+++ b/polygerrit-ui/app/services/gr-rest-api/gr-rest-api-impl.ts
@@ -146,6 +146,7 @@
import {addDraftProp, DraftInfo} from '../../utils/comment-util';
import {BaseScheduler} from '../scheduler/scheduler';
import {MaxInFlightScheduler} from '../scheduler/max-in-flight-scheduler';
+import {FlagsService} from '../flags/flags';
const MAX_PROJECT_RESULTS = 25;
@@ -284,7 +285,11 @@
// The value is set in created, before any other actions
private readonly _restApiHelper: GrRestApiHelper;
- constructor(private readonly authService: AuthService) {
+ constructor(
+ private readonly authService: AuthService,
+ // @ts-ignore: it's ok.
+ private readonly _flagsService: FlagsService
+ ) {
this._restApiHelper = new GrRestApiHelper(
this._cache,
this.authService,
diff --git a/polygerrit-ui/app/services/gr-rest-api/gr-rest-api-impl_test.js b/polygerrit-ui/app/services/gr-rest-api/gr-rest-api-impl_test.js
index 9e695f9..864d7cd 100644
--- a/polygerrit-ui/app/services/gr-rest-api/gr-rest-api-impl_test.js
+++ b/polygerrit-ui/app/services/gr-rest-api/gr-rest-api-impl_test.js
@@ -56,7 +56,10 @@
sinon
.stub(getAppContext().authService, 'authCheck')
.returns(Promise.resolve(true));
- element = new GrRestApiServiceImpl(getAppContext().authService);
+ element = new GrRestApiServiceImpl(
+ getAppContext().authService,
+ getAppContext().flagsService
+ );
element._projectLookup = {};
});
diff --git a/polygerrit-ui/app/test/a11y-test-utils.js b/polygerrit-ui/app/test/a11y-test-utils.js
deleted file mode 100644
index e120ece..0000000
--- a/polygerrit-ui/app/test/a11y-test-utils.js
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * @license
- * Copyright 2020 Google LLC
- * SPDX-License-Identifier: Apache-2.0
- */
-import './common-test-setup-karma.js';
-
-// Run a11y audit on test fixture
-// The code is inspired by the
-// https://github.com/Polymer/web-component-tester/blob/master/data/a11ySuite.js
-export async function runA11yAudit(fixture, ignoredRules) {
- fixture.instantiate();
- await flush();
- const axsConfig = new axs.AuditConfiguration();
- axsConfig.scope = document.body;
- axsConfig.showUnsupportedRulesWarning = false;
- axsConfig.auditRulesToIgnore = ignoredRules;
-
- const auditResults = axs.Audit.run(axsConfig);
- const errors = [];
- auditResults.forEach((result, index) => {
- // only show applicable tests
- if (result.result === 'FAIL') {
- const title = result.rule.heading;
- // fail test if audit result is FAIL
- const error = axs.Audit.accessibilityErrorMessage(result);
- errors.push(`${title}: ${error}`);
- }
- });
- if (errors.length > 0) {
- assert.fail(errors.join('\n') + '\n');
- }
-}
diff --git a/polygerrit-ui/app/test/common-test-setup-karma.ts b/polygerrit-ui/app/test/common-test-setup-karma.ts
index fadf36c..c440cad 100644
--- a/polygerrit-ui/app/test/common-test-setup-karma.ts
+++ b/polygerrit-ui/app/test/common-test-setup-karma.ts
@@ -4,19 +4,13 @@
* SPDX-License-Identifier: Apache-2.0
*/
import {testResolver as testResolverImpl} from './common-test-setup';
-import '@polymer/test-fixture/test-fixture';
-import 'chai/chai';
declare global {
interface Window {
flush: typeof flushImpl;
- fixtureFromTemplate: typeof fixtureFromTemplateImpl;
- fixtureFromElement: typeof fixtureFromElementImpl;
testResolver: typeof testResolverImpl;
}
let flush: typeof flushImpl;
- let fixtureFromTemplate: typeof fixtureFromTemplateImpl;
- let fixtureFromElement: typeof fixtureFromElementImpl;
let testResolver: typeof testResolverImpl;
}
@@ -95,109 +89,4 @@
self.flush = flushImpl;
-class TestFixtureIdProvider {
- public static readonly instance: TestFixtureIdProvider =
- new TestFixtureIdProvider();
-
- private fixturesCount = 1;
-
- generateNewFixtureId() {
- this.fixturesCount++;
- return `fixture-${this.fixturesCount}`;
- }
-}
-
-interface TagTestFixture<T extends Element> {
- instantiate(model?: unknown): T;
-}
-
-class TestFixture {
- constructor(readonly fixtureId: string) {}
-
- /**
- * Create an instance of a fixture's template.
- *
- * @param model - see Data-bound sections at
- * https://www.webcomponents.org/element/@polymer/test-fixture
- * @return - if the fixture's template contains
- * a single element, returns the appropriated instantiated element.
- * Otherwise, it return an array of all instantiated elements from the
- * template.
- */
- instantiate(model?: unknown): HTMLElement | HTMLElement[] {
- // The window.fixture method is defined in common-test-setup.js
- return window.fixture(this.fixtureId, model);
- }
-}
-
-/**
- * Wraps provided template to a test-fixture tag and adds test-fixture to
- * the document. You can use the html function to create a template.
- *
- * Example:
- * import {html} from '@polymer/polymer/lib/utils/html-tag.js';
- *
- * // Create fixture at the root level of a test file
- * const basicTestFixture = fixtureFromTemplate(html`
- * <gr-cursor-manager cursor-target-class="targeted"></gr-cursor-manager>
- * <ul>
- * <li>A</li>
- * <li>B</li>
- * <li>C</li>
- * <li>D</li>
- * </ul>
- * `);
- * ...
- * // Instantiate fixture when needed:
- *
- * suite('example') {
- * let elements;
- * setup(() => {
- * elements = basicTestFixture.instantiate();
- * });
- * }
- *
- * @param template - a template for a fixture
- */
-function fixtureFromTemplateImpl(template: HTMLTemplateElement): TestFixture {
- const fixtureId = TestFixtureIdProvider.instance.generateNewFixtureId();
- const testFixture = document.createElement('test-fixture');
- testFixture.setAttribute('id', fixtureId);
- testFixture.appendChild(template);
- document.body.appendChild(testFixture);
- return new TestFixture(fixtureId);
-}
-
-/**
- * Wraps provided tag to a test-fixture/template tags and adds test-fixture
- * to the document.
- *
- * Example:
- *
- * // Create fixture at the root level of a test file
- * const basicTestFixture = fixtureFromElement('gr-diff-view');
- * ...
- * // Instantiate fixture when needed:
- *
- * suite('example') {
- * let element;
- * setup(() => {
- * element = basicTestFixture.instantiate();
- * });
- * }
- *
- * @param tagName - a template for a fixture is <tagName></tagName>
- */
-function fixtureFromElementImpl<T extends keyof HTMLElementTagNameMap>(
- tagName: T
-): TagTestFixture<HTMLElementTagNameMap[T]> {
- const template = document.createElement('template');
- template.innerHTML = `<${tagName}></${tagName}>`;
- return fixtureFromTemplate(template) as unknown as TagTestFixture<
- HTMLElementTagNameMap[T]
- >;
-}
-
-window.fixtureFromTemplate = fixtureFromTemplateImpl;
-window.fixtureFromElement = fixtureFromElementImpl;
window.testResolver = testResolverImpl;
diff --git a/polygerrit-ui/app/test/common-test-setup.ts b/polygerrit-ui/app/test/common-test-setup.ts
index fb6b482..181fadf 100644
--- a/polygerrit-ui/app/test/common-test-setup.ts
+++ b/polygerrit-ui/app/test/common-test-setup.ts
@@ -22,7 +22,6 @@
import {
cleanupTestUtils,
getCleanupsCount,
- registerTestCleanup,
addIronOverlayBackdropStyleEl,
removeIronOverlayBackdropStyleEl,
removeThemeStyles,
@@ -31,7 +30,7 @@
import {initGlobalVariables} from '../elements/gr-app-global-var-init';
import 'chai/chai';
import {chaiDomDiff} from '@open-wc/semantic-dom-diff';
-import {fixtureCleanup} from '@open-wc/testing-helpers';
+import {fixtureCleanup} from '@open-wc/testing';
import {
_testOnly_defaultResinReportHandler,
installPolymerResin,
@@ -48,19 +47,13 @@
declare global {
interface Window {
assert: typeof chai.assert;
- expect: typeof chai.expect;
- fixture: typeof fixtureImpl;
- stub: typeof stubImpl;
sinon: typeof sinon;
chai: typeof chai;
}
let assert: typeof chai.assert;
- let expect: typeof chai.expect;
- let stub: typeof stubImpl;
let sinon: typeof sinon;
}
window.assert = chai.assert;
-window.expect = chai.expect;
window.chai.use(chaiDomDiff);
window.sinon = sinon;
@@ -75,24 +68,6 @@
}
});
-interface TestFixtureElement extends HTMLElement {
- restore(): void;
- create(model?: unknown): HTMLElement | HTMLElement[];
-}
-
-function getFixtureElementById(fixtureId: string) {
- return document.getElementById(fixtureId) as TestFixtureElement;
-}
-
-// For karma always set our implementation
-// (karma doesn't provide the fixture method)
-function fixtureImpl(fixtureId: string, model: unknown) {
- // This method is inspired by web-component-tester method
- registerTestCleanup(() => getFixtureElementById(fixtureId).restore());
- return getFixtureElementById(fixtureId).create(model);
-}
-
-window.fixture = fixtureImpl;
let testSetupTimestampMs = 0;
let appContext: AppContext & Finalizable;
@@ -144,7 +119,7 @@
injectDependency(token, provider);
}
document.addEventListener('request-dependency', resolveDependency);
- // The following calls is nessecary to avoid influence of previously executed
+ // The following calls is necessary to avoid influence of previously executed
// tests.
initGlobalVariables(appContext);
@@ -164,24 +139,6 @@
_testOnlyResetGrRestApiSharedObjects();
});
-// For karma always set our implementation
-// (karma doesn't provide the stub method)
-function stubImpl<
- T extends keyof HTMLElementTagNameMap,
- K extends keyof HTMLElementTagNameMap[T]
->(tagName: T, method: K) {
- // This method is inspired by web-component-tester method
- const proto = document.createElement(tagName).constructor
- .prototype as HTMLElementTagNameMap[T];
- const stub = sinon.stub(proto, method);
- registerTestCleanup(() => {
- stub.restore();
- });
- return stub;
-}
-
-window.stub = stubImpl;
-
// Very simple function to catch unexpected elements in documents body.
// It can't catch everything, but in most cases it is enough.
function checkChildAllowed(element: Element) {
diff --git a/polygerrit-ui/app/test/test-utils.ts b/polygerrit-ui/app/test/test-utils.ts
index 98c7c14..2cd3f509 100644
--- a/polygerrit-ui/app/test/test-utils.ts
+++ b/polygerrit-ui/app/test/test-utils.ts
@@ -138,6 +138,20 @@
return sinon.stub(getAppContext().flagsService, method);
}
+export function stubElement<
+ T extends keyof HTMLElementTagNameMap,
+ K extends keyof HTMLElementTagNameMap[T]
+>(tagName: T, method: K) {
+ // This method is inspired by web-component-tester method
+ const proto = document.createElement(tagName).constructor
+ .prototype as HTMLElementTagNameMap[T];
+ const stub = sinon.stub(proto, method);
+ registerTestCleanup(() => {
+ stub.restore();
+ });
+ return stub;
+}
+
export type SinonSpyMember<F extends (...args: any) => any> = SinonSpy<
Parameters<F>,
ReturnType<F>
diff --git a/polygerrit-ui/app/types/events.ts b/polygerrit-ui/app/types/events.ts
index 2a568dc..508b188 100644
--- a/polygerrit-ui/app/types/events.ts
+++ b/polygerrit-ui/app/types/events.ts
@@ -36,7 +36,7 @@
SHORTCUT_TRIGGERERD = 'shortcut-triggered',
SHOW_ALERT = 'show-alert',
SHOW_ERROR = 'show-error',
- SHOW_PRIMARY_TAB = 'show-primary-tab',
+ SHOW_TAB = 'show-tab',
SHOW_SECONDARY_TAB = 'show-secondary-tab',
TAP_ITEM = 'tap-item',
TITLE_CHANGE = 'title-change',
@@ -73,7 +73,7 @@
'reply': ReplyEvent;
'show-alert': ShowAlertEvent;
'show-error': ShowErrorEvent;
- 'show-primary-tab': SwitchTabEvent;
+ 'show-tab': SwitchTabEvent;
'show-secondary-tab': SwitchTabEvent;
'tap-item': TapItemEvent;
'title-change': TitleChangeEvent;
diff --git a/polygerrit-ui/app/utils/admin-nav-util.ts b/polygerrit-ui/app/utils/admin-nav-util.ts
index 10d28c6..62f686d 100644
--- a/polygerrit-ui/app/utils/admin-nav-util.ts
+++ b/polygerrit-ui/app/utils/admin-nav-util.ts
@@ -149,23 +149,23 @@
const children: SubsectionInterface[] = [];
const subsection: SubsectionInterface = {
name: groupName,
- view: GerritNav.View.GROUP,
+ view: GerritView.GROUP,
url: GerritNav.getUrlForGroup(groupId),
children,
};
if (groupIsInternal) {
children.push({
name: 'Members',
- detailType: GerritNav.GroupDetailView.MEMBERS,
- view: GerritNav.View.GROUP,
+ detailType: GroupDetailView.MEMBERS,
+ view: GerritView.GROUP,
url: GerritNav.getUrlForGroupMembers(groupId),
});
}
if (groupIsInternal && (isAdmin || groupOwner)) {
children.push({
name: 'Audit Log',
- detailType: GerritNav.GroupDetailView.LOG,
- view: GerritNav.View.GROUP,
+ detailType: GroupDetailView.LOG,
+ view: GerritView.GROUP,
url: GerritNav.getUrlForGroupLog(groupId),
});
}
@@ -175,42 +175,42 @@
export function getRepoSubsections(repoName: RepoName) {
return {
name: repoName,
- view: GerritNav.View.REPO,
+ view: GerritView.REPO,
children: [
{
name: 'General',
- view: GerritNav.View.REPO,
- detailType: GerritNav.RepoDetailView.GENERAL,
+ view: GerritView.REPO,
+ detailType: RepoDetailView.GENERAL,
url: GerritNav.getUrlForRepo(repoName),
},
{
name: 'Access',
- view: GerritNav.View.REPO,
- detailType: GerritNav.RepoDetailView.ACCESS,
+ view: GerritView.REPO,
+ detailType: RepoDetailView.ACCESS,
url: GerritNav.getUrlForRepoAccess(repoName),
},
{
name: 'Commands',
- view: GerritNav.View.REPO,
- detailType: GerritNav.RepoDetailView.COMMANDS,
+ view: GerritView.REPO,
+ detailType: RepoDetailView.COMMANDS,
url: GerritNav.getUrlForRepoCommands(repoName),
},
{
name: 'Branches',
- view: GerritNav.View.REPO,
- detailType: GerritNav.RepoDetailView.BRANCHES,
+ view: GerritView.REPO,
+ detailType: RepoDetailView.BRANCHES,
url: GerritNav.getUrlForRepoBranches(repoName),
},
{
name: 'Tags',
- view: GerritNav.View.REPO,
- detailType: GerritNav.RepoDetailView.TAGS,
+ view: GerritView.REPO,
+ detailType: RepoDetailView.TAGS,
url: GerritNav.getUrlForRepoTags(repoName),
},
{
name: 'Dashboards',
- view: GerritNav.View.REPO,
- detailType: GerritNav.RepoDetailView.DASHBOARDS,
+ view: GerritView.REPO,
+ detailType: RepoDetailView.DASHBOARDS,
url: GerritNav.getUrlForRepoDashboards(repoName),
},
],
diff --git a/polygerrit-ui/app/utils/common-util.ts b/polygerrit-ui/app/utils/common-util.ts
index 0bae49a..0c99269 100644
--- a/polygerrit-ui/app/utils/common-util.ts
+++ b/polygerrit-ui/app/utils/common-util.ts
@@ -62,8 +62,11 @@
selector: string
): NodeListOf<E> {
if (!el) throw new Error('element not defined');
- const root = el.shadowRoot ?? el;
- return root.querySelectorAll<E>(selector);
+ if (el.shadowRoot) {
+ const r = el.shadowRoot.querySelectorAll<E>(selector);
+ if (r.length > 0) return r;
+ }
+ return el.querySelectorAll<E>(selector);
}
export function query<E extends Element = Element>(
diff --git a/polygerrit-ui/app/utils/dom-util_test.ts b/polygerrit-ui/app/utils/dom-util_test.ts
index d907bd1..3732718 100644
--- a/polygerrit-ui/app/utils/dom-util_test.ts
+++ b/polygerrit-ui/app/utils/dom-util_test.ts
@@ -16,7 +16,7 @@
} from './dom-util';
import * as MockInteractions from '@polymer/iron-test-helpers/mock-interactions';
import {mockPromise, queryAndAssert} from '../test/test-utils';
-import {fixture} from '@open-wc/testing-helpers';
+import {fixture} from '@open-wc/testing';
import {LitElement, html} from 'lit';
import {customElement} from 'lit/decorators.js';
diff --git a/polygerrit-ui/app/utils/event-util.ts b/polygerrit-ui/app/utils/event-util.ts
index 7b6172b..714955b 100644
--- a/polygerrit-ui/app/utils/event-util.ts
+++ b/polygerrit-ui/app/utils/event-util.ts
@@ -93,14 +93,14 @@
fire(target, EventType.IRON_ANNOUNCE, {text});
}
-export function fireShowPrimaryTab(
+export function fireShowTab(
target: EventTarget,
tab: string,
scrollIntoView?: boolean,
tabState?: TabState
) {
const detail: SwitchTabEventDetail = {tab, scrollIntoView, tabState};
- fire(target, EventType.SHOW_PRIMARY_TAB, detail);
+ fire(target, EventType.SHOW_TAB, detail);
}
export function fireCloseFixPreview(target: EventTarget, fixApplied: boolean) {
diff --git a/polygerrit-ui/app/utils/focusable_test.ts b/polygerrit-ui/app/utils/focusable_test.ts
index 198d83c..8b697da 100644
--- a/polygerrit-ui/app/utils/focusable_test.ts
+++ b/polygerrit-ui/app/utils/focusable_test.ts
@@ -6,7 +6,7 @@
import '../test/common-test-setup-karma';
import {getFocusableElements, getFocusableElementsReverse} from './focusable';
import {html, render} from 'lit';
-import {fixture} from '@open-wc/testing-helpers';
+import {fixture} from '@open-wc/testing';
async function createDom() {
const container = await fixture<HTMLDivElement>(html`<div></div>`);
@@ -55,26 +55,18 @@
test('Finds all focusables in-order', async () => {
const container = await createDom();
const results = [...getFocusableElements(container)];
- expect(results.map(e => e.id)).to.have.ordered.members([
- 'first',
- 'second',
- 'third',
- 'fourth',
- 'fifth',
- 'sixth',
- ]);
+ assert.includeOrderedMembers(
+ results.map(e => e.id),
+ ['first', 'second', 'third', 'fourth', 'fifth', 'sixth']
+ );
});
test('Finds all focusables in reverse order', async () => {
const container = await createDom();
const results = [...getFocusableElementsReverse(container)];
- expect(results.map(e => e.id)).to.have.ordered.members([
- 'sixth',
- 'fifth',
- 'fourth',
- 'third',
- 'second',
- 'first',
- ]);
+ assert.includeOrderedMembers(
+ results.map(e => e.id),
+ ['sixth', 'fifth', 'fourth', 'third', 'second', 'first']
+ );
});
});
diff --git a/polygerrit-ui/app/utils/math-util.ts b/polygerrit-ui/app/utils/math-util.ts
deleted file mode 100644
index 57718ae..0000000
--- a/polygerrit-ui/app/utils/math-util.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-/**
- * @license
- * Copyright 2021 Google LLC
- * SPDX-License-Identifier: Apache-2.0
- */
-
-/**
- * Returns a random integer between `from` and `to`, both included.
- * So getRandomInt(0, 2) returns 0, 1, or 2 each with probability 1/3.
- */
-export function getRandomInt(from: number, to: number) {
- return Math.floor(Math.random() * (to + 1 - from) + from);
-}
diff --git a/polygerrit-ui/app/utils/math-util_test.ts b/polygerrit-ui/app/utils/math-util_test.ts
deleted file mode 100644
index dba5f57..0000000
--- a/polygerrit-ui/app/utils/math-util_test.ts
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * @license
- * Copyright 2020 Google LLC
- * SPDX-License-Identifier: Apache-2.0
- */
-import '../test/common-test-setup-karma';
-import {getRandomInt} from './math-util';
-
-suite('math-util tests', () => {
- test('getRandomInt', () => {
- let r = 0;
- const randomStub = sinon.stub(Math, 'random').callsFake(() => r);
-
- assert.equal(getRandomInt(0, 0), 0);
- assert.equal(getRandomInt(0, 2), 0);
- assert.equal(getRandomInt(0, 100), 0);
- assert.equal(getRandomInt(10, 10), 10);
- assert.equal(getRandomInt(10, 12), 10);
- assert.equal(getRandomInt(10, 100), 10);
-
- r = 0.999;
- assert.equal(getRandomInt(0, 0), 0);
- assert.equal(getRandomInt(0, 2), 2);
- assert.equal(getRandomInt(0, 100), 100);
- assert.equal(getRandomInt(10, 10), 10);
- assert.equal(getRandomInt(10, 12), 12);
- assert.equal(getRandomInt(10, 100), 100);
-
- r = 0.5;
- assert.equal(getRandomInt(0, 0), 0);
- assert.equal(getRandomInt(0, 2), 1);
- assert.equal(getRandomInt(0, 100), 50);
- assert.equal(getRandomInt(10, 10), 10);
- assert.equal(getRandomInt(10, 12), 11);
- assert.equal(getRandomInt(10, 100), 55);
-
- r = 0.0;
- assert.equal(getRandomInt(0, 2), 0);
- r = 0.33;
- assert.equal(getRandomInt(0, 2), 0);
- r = 0.34;
- assert.equal(getRandomInt(0, 2), 1);
- r = 0.66;
- assert.equal(getRandomInt(0, 2), 1);
- r = 0.67;
- assert.equal(getRandomInt(0, 2), 2);
- r = 0.99;
- assert.equal(getRandomInt(0, 2), 2);
-
- randomStub.restore();
- });
-});
diff --git a/polygerrit-ui/app/utils/router-util_test.ts b/polygerrit-ui/app/utils/router-util_test.ts
index e3a21df..7ca44d5 100644
--- a/polygerrit-ui/app/utils/router-util_test.ts
+++ b/polygerrit-ui/app/utils/router-util_test.ts
@@ -13,7 +13,6 @@
EDIT,
GroupId,
} from '../api/rest-api';
-import {GerritNav} from '../elements/core/gr-navigation/gr-navigation';
import {PatchRangeParams} from '../elements/core/gr-router/gr-router';
import {GerritView} from '../services/router/router-model';
import '../test/common-test-setup-karma';
@@ -63,7 +62,7 @@
assert.equal(generateUrl(params), '/q/foo%2524bar,100');
params = {
- view: GerritNav.View.SEARCH,
+ view: GerritView.SEARCH,
statuses: ['a', 'b', 'c'],
};
assert.equal(
@@ -72,17 +71,17 @@
);
params = {
- view: GerritNav.View.SEARCH,
+ view: GerritView.SEARCH,
topic: 'test' as TopicName,
};
assert.equal(generateUrl(params), '/q/topic:test');
params = {
- view: GerritNav.View.SEARCH,
+ view: GerritView.SEARCH,
topic: 'test test' as TopicName,
};
assert.equal(generateUrl(params), '/q/topic:"test+test"');
params = {
- view: GerritNav.View.SEARCH,
+ view: GerritView.SEARCH,
topic: 'test:test' as TopicName,
};
assert.equal(generateUrl(params), '/q/topic:"test:test"');
diff --git a/polygerrit-ui/app/utils/string-util.ts b/polygerrit-ui/app/utils/string-util.ts
index 7c32edf..b6f1ad1 100644
--- a/polygerrit-ui/app/utils/string-util.ts
+++ b/polygerrit-ui/app/utils/string-util.ts
@@ -4,6 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
+import {computeDisplayPath} from './path-list-util';
+
/**
* Returns a count plus string that is pluralized when necessary.
*/
@@ -58,3 +60,45 @@
const lastItem = items[items.length - 1];
return `${firstItems.join(', ')}, and ${lastItem}`;
}
+
+/**
+ * Separates a path into:
+ * - The part that matches another path,
+ * - The part that does not match the other path,
+ * - The file name
+ *
+ * For example:
+ * diffFilePaths('same/part/new/part/foo.js', 'same/part/different/foo.js');
+ * yields: {
+ * matchingFolders: 'same/part/',
+ * newFolders: 'new/part/',
+ * fileName: 'foo.js',
+ * }
+ */
+export function diffFilePaths(filePath: string, otherFilePath?: string) {
+ // Separate each string into an array of folder names + file name.
+ const displayPath = computeDisplayPath(filePath);
+ const previousFileDisplayPath = computeDisplayPath(otherFilePath);
+ const displayPathParts = displayPath.split('/');
+ const previousFileDisplayPathParts = previousFileDisplayPath.split('/');
+
+ // Construct separate strings for matching folders, new folders, and file
+ // name.
+ const firstDifferencePartIndex = displayPathParts.findIndex(
+ (part, index) => previousFileDisplayPathParts[index] !== part
+ );
+ const matchingSection = displayPathParts
+ .slice(0, firstDifferencePartIndex)
+ .join('/');
+ const newFolderSection = displayPathParts
+ .slice(firstDifferencePartIndex, -1)
+ .join('/');
+ const fileNameSection = displayPathParts[displayPathParts.length - 1];
+
+ // Note: folder sections need '/' appended back.
+ return {
+ matchingFolders: matchingSection.length > 0 ? `${matchingSection}/` : '',
+ newFolders: newFolderSection.length > 0 ? `${newFolderSection}/` : '',
+ fileName: fileNameSection,
+ };
+}
diff --git a/polygerrit-ui/app/utils/string-util_test.ts b/polygerrit-ui/app/utils/string-util_test.ts
index 7a31034..efc64cf 100644
--- a/polygerrit-ui/app/utils/string-util_test.ts
+++ b/polygerrit-ui/app/utils/string-util_test.ts
@@ -4,7 +4,12 @@
* SPDX-License-Identifier: Apache-2.0
*/
import '../test/common-test-setup-karma';
-import {pluralize, ordinal, listForSentence} from './string-util';
+import {
+ pluralize,
+ ordinal,
+ listForSentence,
+ diffFilePaths,
+} from './string-util';
suite('formatter util tests', () => {
test('pluralize', () => {
@@ -34,4 +39,48 @@
assert.equal(listForSentence(['Foo']), 'Foo');
assert.equal(listForSentence([]), '');
});
+
+ test('diffFilePaths', () => {
+ const path = 'some/new/path/to/foo.js';
+
+ // no other path
+ assert.deepStrictEqual(diffFilePaths(path, undefined), {
+ matchingFolders: '',
+ newFolders: 'some/new/path/to/',
+ fileName: 'foo.js',
+ });
+ // no new folders
+ assert.deepStrictEqual(diffFilePaths(path, 'some/new/path/to/bar.js'), {
+ matchingFolders: 'some/new/path/to/',
+ newFolders: '',
+ fileName: 'foo.js',
+ });
+ // folder partially matches
+ assert.deepStrictEqual(diffFilePaths(path, 'some/ne/foo.js'), {
+ matchingFolders: 'some/',
+ newFolders: 'new/path/to/',
+ fileName: 'foo.js',
+ });
+ // no matching folders
+ assert.deepStrictEqual(
+ diffFilePaths(path, 'another/path/entirely/foo.js'),
+ {
+ matchingFolders: '',
+ newFolders: 'some/new/path/to/',
+ fileName: 'foo.js',
+ }
+ );
+ // some folders match
+ assert.deepStrictEqual(diffFilePaths(path, 'some/other/path/to/bar.js'), {
+ matchingFolders: 'some/',
+ newFolders: 'new/path/to/',
+ fileName: 'foo.js',
+ });
+ // no folders
+ assert.deepStrictEqual(diffFilePaths('COMMIT_MSG', 'some/other/foo.js'), {
+ matchingFolders: '',
+ newFolders: '',
+ fileName: 'COMMIT_MSG',
+ });
+ });
});
diff --git a/polygerrit-ui/package.json b/polygerrit-ui/package.json
index 76e166d..60385d1 100644
--- a/polygerrit-ui/package.json
+++ b/polygerrit-ui/package.json
@@ -10,7 +10,7 @@
"devDependencies": {
"@open-wc/karma-esm": "^3.0.9",
"@open-wc/semantic-dom-diff": "^0.19.5",
- "@open-wc/testing-helpers": "^2.0.2",
+ "@open-wc/testing": "^3.1.6",
"@polymer/iron-test-helpers": "^3.0.1",
"@polymer/test-fixture": "^4.0.2",
"accessibility-developer-tools": "^2.12.0",
@@ -25,4 +25,4 @@
},
"license": "Apache-2.0",
"private": true
-}
\ No newline at end of file
+}
diff --git a/polygerrit-ui/yarn.lock b/polygerrit-ui/yarn.lock
index 2a5bb6b..a8505e0 100644
--- a/polygerrit-ui/yarn.lock
+++ b/polygerrit-ui/yarn.lock
@@ -901,6 +901,13 @@
resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.5.0.tgz#bb504579c1cae923e6576a4f5da43d25f97bdbd9"
integrity sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==
+"@esm-bundle/chai@^4.3.4-fix.0":
+ version "4.3.4-fix.0"
+ resolved "https://registry.yarnpkg.com/@esm-bundle/chai/-/chai-4.3.4-fix.0.tgz#3084cff7eb46d741749f47f3a48dbbdcbaf30a92"
+ integrity sha512-26SKdM4uvDWlY8/OOOxSB1AqQWeBosCX3wRYUZO7enTAj03CtVxIiCimYVG2WpULcyV51qapK4qTovwkUr5Mlw==
+ dependencies:
+ "@types/chai" "^4.2.12"
+
"@koa/cors@^3.1.0":
version "3.1.0"
resolved "https://registry.yarnpkg.com/@koa/cors/-/cors-3.1.0.tgz#618bb073438cfdbd3ebd0e648a76e33b84f3a3b2"
@@ -966,6 +973,14 @@
whatwg-fetch "^3.5.0"
whatwg-url "^7.1.0"
+"@open-wc/chai-dom-equals@^0.12.36":
+ version "0.12.36"
+ resolved "https://registry.yarnpkg.com/@open-wc/chai-dom-equals/-/chai-dom-equals-0.12.36.tgz#ed0eb56b9e98c4d7f7280facce6215654aae9f4c"
+ integrity sha512-Gt1fa37h4rtWPQGETSU4n1L678NmMi9KwHM1sH+JCGcz45rs8DBPx7MUVeGZ+HxRlbEI5t9LU2RGGv6xT2OlyA==
+ dependencies:
+ "@open-wc/semantic-dom-diff" "^0.13.16"
+ "@types/chai" "^4.1.7"
+
"@open-wc/dedupe-mixin@^1.3.0":
version "1.3.0"
resolved "https://registry.yarnpkg.com/@open-wc/dedupe-mixin/-/dedupe-mixin-1.3.0.tgz#0df5d438285fc3482838786ee81895318f0ff778"
@@ -987,14 +1002,18 @@
portfinder "^1.0.21"
request "^2.88.0"
-"@open-wc/scoped-elements@^2.0.1":
- version "2.0.1"
- resolved "https://registry.yarnpkg.com/@open-wc/scoped-elements/-/scoped-elements-2.0.1.tgz#6b1c3535f809bd90710574db80093a81e3a1fc2d"
- integrity sha512-JS6ozxUFwFX3+Er91v9yQzNIaFn7OnE0iESKTbFvkkKdNwvAPtp1fpckBKIvWk8Ae9ZcoI9DYZuT2DDbMPcadA==
+"@open-wc/scoped-elements@^2.1.3":
+ version "2.1.3"
+ resolved "https://registry.yarnpkg.com/@open-wc/scoped-elements/-/scoped-elements-2.1.3.tgz#c4f06fa16091c6ebf2a69b3f40afc03821f42535"
+ integrity sha512-WoQD5T8Me9obek+iyjgrAMw9wxZZg4ytIteIN1i9LXW2KohezUp0LTOlWgBajWJo0/bpjUKiODX73cMYL2i3hw==
dependencies:
"@lit/reactive-element" "^1.0.0"
"@open-wc/dedupe-mixin" "^1.3.0"
- "@webcomponents/scoped-custom-element-registry" "^0.0.3"
+
+"@open-wc/semantic-dom-diff@^0.13.16":
+ version "0.13.21"
+ resolved "https://registry.yarnpkg.com/@open-wc/semantic-dom-diff/-/semantic-dom-diff-0.13.21.tgz#718b9ec5f9a98935fc775e577ad094ae8d8b7dea"
+ integrity sha512-BONpjHcGX2zFa9mfnwBCLEmlDsOHzT+j6Qt1yfK3MzFXFtAykfzFjAgaxPetu0YbBlCfXuMlfxI4vlRGCGMvFg==
"@open-wc/semantic-dom-diff@^0.19.5":
version "0.19.5"
@@ -1004,13 +1023,36 @@
"@types/chai" "^4.2.11"
"@web/test-runner-commands" "^0.5.7"
-"@open-wc/testing-helpers@^2.0.2":
- version "2.0.2"
- resolved "https://registry.yarnpkg.com/@open-wc/testing-helpers/-/testing-helpers-2.0.2.tgz#ca1833bf76036d9bdc03547415e79b6d502c78f6"
- integrity sha512-wJlvDmWo+fIbgykRP21YSP9I9Pf/fo2+dZGaWG77Hw0sIuyB+7sNUDJDkL6kMkyyRecPV6dVRmbLt6HuOwvZ1w==
+"@open-wc/semantic-dom-diff@^0.19.7":
+ version "0.19.7"
+ resolved "https://registry.yarnpkg.com/@open-wc/semantic-dom-diff/-/semantic-dom-diff-0.19.7.tgz#92361f0d2dcb54a8d5cf11d5ea40b8e7ffa58eb4"
+ integrity sha512-ahwHb7arQXXnkIGCrOsM895FJQrU47VWZryCsSSzl5nB3tJKcJ8yjzQ3D/yqZn6v8atqOz61vaY05aNsqoz3oA==
dependencies:
- "@open-wc/scoped-elements" "^2.0.1"
+ "@types/chai" "^4.3.1"
+ "@web/test-runner-commands" "^0.6.1"
+
+"@open-wc/testing-helpers@^2.1.2":
+ version "2.1.3"
+ resolved "https://registry.yarnpkg.com/@open-wc/testing-helpers/-/testing-helpers-2.1.3.tgz#85a133ac8637ed1d880d523b07650788eab4a128"
+ integrity sha512-hQujGaWncmWLx/974jq5yf2jydBNNTwnkISw2wLGiYgX34+3R6/ns301Oi9S3Il96Kzd8B7avdExp/gDgqcF5w==
+ dependencies:
+ "@open-wc/scoped-elements" "^2.1.3"
lit "^2.0.0"
+ lit-html "^2.0.0"
+
+"@open-wc/testing@^3.1.6":
+ version "3.1.6"
+ resolved "https://registry.yarnpkg.com/@open-wc/testing/-/testing-3.1.6.tgz#89f71710e5530d74f0c478b0a9239d68dcdb9f5e"
+ integrity sha512-MIf9cBtac4/UBE5a+R5cXiRhOGfzetsV+ZPFc188AfkPDPbmffHqjrRoCyk4B/qS6fLEulSBMLSaQ+6ze971gQ==
+ dependencies:
+ "@esm-bundle/chai" "^4.3.4-fix.0"
+ "@open-wc/chai-dom-equals" "^0.12.36"
+ "@open-wc/semantic-dom-diff" "^0.19.7"
+ "@open-wc/testing-helpers" "^2.1.2"
+ "@types/chai" "^4.2.11"
+ "@types/chai-dom" "^0.0.12"
+ "@types/sinon-chai" "^3.2.3"
+ chai-a11y-axe "^1.3.2"
"@polymer/iron-test-helpers@^3.0.1":
version "3.0.1"
@@ -1156,6 +1198,18 @@
resolved "https://registry.yarnpkg.com/@types/caniuse-api/-/caniuse-api-3.0.2.tgz#684ba0c284b2a58346abf0000bd0a735ad072d75"
integrity sha512-YfCDMn7R59n7GFFfwjPAM0zLJQy4UvveC32rOJBmTqJJY8uSRqM4Dc7IJj8V9unA48Qy4nj5Bj3jD6Q8VZ1Seg==
+"@types/chai-dom@^0.0.12":
+ version "0.0.12"
+ resolved "https://registry.yarnpkg.com/@types/chai-dom/-/chai-dom-0.0.12.tgz#fdd7a52bed4dd235ed1c94d3d2d31d4e7db1d03a"
+ integrity sha512-4rE7sDw713cV61TYzQbMrPjC4DjNk3x4vk9nAVRNXcSD4p0/5lEEfm0OgoCz5eNuWUXNKA0YiKiH/JDTuKivkA==
+ dependencies:
+ "@types/chai" "*"
+
+"@types/chai@*", "@types/chai@^4.1.7", "@types/chai@^4.2.12":
+ version "4.3.3"
+ resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.3.3.tgz#3c90752792660c4b562ad73b3fbd68bf3bc7ae07"
+ integrity sha512-hC7OMnszpxhZPduX+m+nrx+uFoLkWOMiR4oa/AZF3MuSETYTZmFfJAHqZEM8MVlvfG7BEUcgvtwoCTxBp6hm3g==
+
"@types/chai@^4.2.11":
version "4.2.22"
resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.2.22.tgz#47020d7e4cf19194d43b5202f35f75bd2ad35ce7"
@@ -1420,6 +1474,21 @@
"@types/mime" "^1"
"@types/node" "*"
+"@types/sinon-chai@^3.2.3":
+ version "3.2.8"
+ resolved "https://registry.yarnpkg.com/@types/sinon-chai/-/sinon-chai-3.2.8.tgz#5871d09ab50d671d8e6dd72e9073f8e738ac61dc"
+ integrity sha512-d4ImIQbT/rKMG8+AXpmcan5T2/PNeSjrYhvkwet6z0p8kzYtfgA32xzOBlbU0yqJfq+/0Ml805iFoODO0LP5/g==
+ dependencies:
+ "@types/chai" "*"
+ "@types/sinon" "*"
+
+"@types/sinon@*":
+ version "10.0.13"
+ resolved "https://registry.yarnpkg.com/@types/sinon/-/sinon-10.0.13.tgz#60a7a87a70d9372d0b7b38cc03e825f46981fb83"
+ integrity sha512-UVjDqJblVNQYvVNUsj0PuYYw0ELRmgt1Nt5Vk0pT5f16ROGfcKJY8o1HVuMOJOpD727RrGB9EGvoaTQE5tgxZQ==
+ dependencies:
+ "@types/sinonjs__fake-timers" "*"
+
"@types/sinon@^10.0.0":
version "10.0.2"
resolved "https://registry.yarnpkg.com/@types/sinon/-/sinon-10.0.2.tgz#f360d2f189c0fd433d14aeb97b9d705d7e4cc0e4"
@@ -1427,6 +1496,11 @@
dependencies:
"@sinonjs/fake-timers" "^7.1.0"
+"@types/sinonjs__fake-timers@*":
+ version "8.1.2"
+ resolved "https://registry.yarnpkg.com/@types/sinonjs__fake-timers/-/sinonjs__fake-timers-8.1.2.tgz#bf2e02a3dbd4aecaf95942ecd99b7402e03fad5e"
+ integrity sha512-9GcLXF0/v3t80caGs5p2rRfkB+a8VBGLJZVih6CNFkx8IZ994wiKKLSRs9nuFwk1HevWs/1mnUmkApGrSGsShA==
+
"@types/trusted-types@^2.0.2":
version "2.0.2"
resolved "https://registry.yarnpkg.com/@types/trusted-types/-/trusted-types-2.0.2.tgz#fc25ad9943bcac11cceb8168db4f275e0e72e756"
@@ -1482,6 +1556,30 @@
picomatch "^2.2.2"
ws "^7.4.2"
+"@web/dev-server-core@^0.3.18":
+ version "0.3.19"
+ resolved "https://registry.yarnpkg.com/@web/dev-server-core/-/dev-server-core-0.3.19.tgz#b61f9a0b92351371347a758b30ba19e683c72e94"
+ integrity sha512-Q/Xt4RMVebLWvALofz1C0KvP8qHbzU1EmdIA2Y1WMPJwiFJFhPxdr75p9YxK32P2t0hGs6aqqS5zE0HW9wYzYA==
+ dependencies:
+ "@types/koa" "^2.11.6"
+ "@types/ws" "^7.4.0"
+ "@web/parse5-utils" "^1.2.0"
+ chokidar "^3.4.3"
+ clone "^2.1.2"
+ es-module-lexer "^1.0.0"
+ get-stream "^6.0.0"
+ is-stream "^2.0.0"
+ isbinaryfile "^4.0.6"
+ koa "^2.13.0"
+ koa-etag "^4.0.0"
+ koa-send "^5.0.1"
+ koa-static "^5.0.0"
+ lru-cache "^6.0.0"
+ mime-types "^2.1.27"
+ parse5 "^6.0.1"
+ picomatch "^2.2.2"
+ ws "^7.4.2"
+
"@web/parse5-utils@^1.2.0":
version "1.3.0"
resolved "https://registry.yarnpkg.com/@web/parse5-utils/-/parse5-utils-1.3.0.tgz#e2e9e98b31a4ca948309f74891bda8d77399f6bd"
@@ -1498,6 +1596,14 @@
"@web/test-runner-core" "^0.10.20"
mkdirp "^1.0.4"
+"@web/test-runner-commands@^0.6.1":
+ version "0.6.4"
+ resolved "https://registry.yarnpkg.com/@web/test-runner-commands/-/test-runner-commands-0.6.4.tgz#61c8e1d71d30567b8e2845274426d209dbe77c7e"
+ integrity sha512-opSfIVHj4PsIA/Ah582DKgnmdfY+Xn35FnnYeJ+aBYrM+setOP63McvrY4PuwasictwswHVSzq86qZzmxvXkHw==
+ dependencies:
+ "@web/test-runner-core" "^0.10.27"
+ mkdirp "^1.0.4"
+
"@web/test-runner-core@^0.10.20":
version "0.10.22"
resolved "https://registry.yarnpkg.com/@web/test-runner-core/-/test-runner-core-0.10.22.tgz#34bb67d12a79b01dc79c816f3d76f3419ef50eaf"
@@ -1530,10 +1636,37 @@
picomatch "^2.2.2"
source-map "^0.7.3"
-"@webcomponents/scoped-custom-element-registry@^0.0.3":
- version "0.0.3"
- resolved "https://registry.yarnpkg.com/@webcomponents/scoped-custom-element-registry/-/scoped-custom-element-registry-0.0.3.tgz#774591a886b0b0e4914717273ba53fd8d5657522"
- integrity sha512-lpSzgDCGbM99dytb3+J3Suo4+Bk1E13MPnWB42JK8GwxSAxFz+tC7TTv2hhDSIE2IirGNKNKCf3m08ecu6eAsQ==
+"@web/test-runner-core@^0.10.27":
+ version "0.10.27"
+ resolved "https://registry.yarnpkg.com/@web/test-runner-core/-/test-runner-core-0.10.27.tgz#8d1430f2364fb36b3ac15b9b43034fae9d94e177"
+ integrity sha512-ClV/hSxs4wDm/ANFfQOdRRFb/c0sYywC1QfUXG/nS4vTp3nnt7x7mjydtMGGLmvK9f6Zkubkc1aa+7ryfmVwNA==
+ dependencies:
+ "@babel/code-frame" "^7.12.11"
+ "@types/babel__code-frame" "^7.0.2"
+ "@types/co-body" "^6.1.0"
+ "@types/convert-source-map" "^1.5.1"
+ "@types/debounce" "^1.2.0"
+ "@types/istanbul-lib-coverage" "^2.0.3"
+ "@types/istanbul-reports" "^3.0.0"
+ "@web/browser-logs" "^0.2.1"
+ "@web/dev-server-core" "^0.3.18"
+ chokidar "^3.4.3"
+ cli-cursor "^3.1.0"
+ co-body "^6.1.0"
+ convert-source-map "^1.7.0"
+ debounce "^1.2.0"
+ dependency-graph "^0.11.0"
+ globby "^11.0.1"
+ ip "^1.1.5"
+ istanbul-lib-coverage "^3.0.0"
+ istanbul-lib-report "^3.0.0"
+ istanbul-reports "^3.0.2"
+ log-update "^4.0.0"
+ nanocolors "^0.2.1"
+ nanoid "^3.1.25"
+ open "^8.0.2"
+ picomatch "^2.2.2"
+ source-map "^0.7.3"
"@webcomponents/shadycss@^1.10.2", "@webcomponents/shadycss@^1.9.1":
version "1.11.0"
@@ -1696,6 +1829,11 @@
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.11.0.tgz#d61f46d83b2519250e2784daf5b09479a8b41c59"
integrity sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==
+axe-core@^4.3.3:
+ version "4.4.3"
+ resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-4.4.3.tgz#11c74d23d5013c0fa5d183796729bc3482bd2f6f"
+ integrity sha512-32+ub6kkdhhWick/UjvEwRchgoetXqTK14INLqbGm5U2TzBkBNF3nQtLYm8ovxSkQWArjEQvftCKryjZaATu3w==
+
babel-plugin-dynamic-import-node@^2.3.3:
version "2.3.3"
resolved "https://registry.yarnpkg.com/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz#84fda19c976ec5c6defef57f9427b3def66e17a3"
@@ -1884,6 +2022,13 @@
resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc"
integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=
+chai-a11y-axe@^1.3.2:
+ version "1.4.0"
+ resolved "https://registry.yarnpkg.com/chai-a11y-axe/-/chai-a11y-axe-1.4.0.tgz#e584af967727a8656e27c32e845f5db21f2bf2e0"
+ integrity sha512-m7J6DVAl1ePL2ifPKHmwQyHXdCZ+Qfv+qduh6ScqcDfBnJEzpV1K49TblujM45j1XciZOFeFNqMb2sShXMg/mw==
+ dependencies:
+ axe-core "^4.3.3"
+
chai@^4.3.6:
version "4.3.6"
resolved "https://registry.yarnpkg.com/chai/-/chai-4.3.6.tgz#ffe4ba2d9fa9d6680cc0b370adae709ec9011e9c"
@@ -2475,6 +2620,11 @@
resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-0.9.3.tgz#6f13db00cc38417137daf74366f535c8eb438f19"
integrity sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==
+es-module-lexer@^1.0.0:
+ version "1.0.3"
+ resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-1.0.3.tgz#f0d8d35b36d13024110000d5e6fadc8eeaeb66b8"
+ integrity sha512-iC67eXHToclrlVhQfpRawDiF8D8sQxNxmbqw5oebegOaJkyx/w9C/k57/5e6yJR2zIByRt9OXdqX50DV2t6ZKw==
+
es-module-shims@^0.4.6, es-module-shims@^0.4.7:
version "0.4.7"
resolved "https://registry.yarnpkg.com/es-module-shims/-/es-module-shims-0.4.7.tgz#1419b65bbd38dfe91ab8ea5d7b4b454561e44641"