Replace flushAsynchronousOperations() by flush()
Change-Id: I231d02a548a7194c74812002191e26f281b8e22c
diff --git a/polygerrit-ui/app/.eslintrc.js b/polygerrit-ui/app/.eslintrc.js
index a1d7ff4..226cc4c 100644
--- a/polygerrit-ui/app/.eslintrc.js
+++ b/polygerrit-ui/app/.eslintrc.js
@@ -229,6 +229,9 @@
// Custom rule from the //tools/js/eslint-rules directory.
// See //tools/js/eslint-rules/README.md for details
"goog-module-id": 2,
+ // Prevents certain identifiers being used.
+ // Prefer flush() over flushAsynchronousOperations().
+ "id-blacklist": ["error", "flushAsynchronousOperations"],
},
// List of allowed globals in all files
diff --git a/polygerrit-ui/app/elements/admin/gr-access-section/gr-access-section_test.js b/polygerrit-ui/app/elements/admin/gr-access-section/gr-access-section_test.js
index 8749158..97a7fa3 100644
--- a/polygerrit-ui/app/elements/admin/gr-access-section/gr-access-section_test.js
+++ b/polygerrit-ui/app/elements/admin/gr-access-section/gr-access-section_test.js
@@ -71,7 +71,7 @@
},
};
element._updateSection(element.section);
- flushAsynchronousOperations();
+ flush();
});
test('_updateSection', () => {
@@ -327,7 +327,7 @@
},
};
element._updateSection(element.section);
- flushAsynchronousOperations();
+ flush();
});
test('classes are assigned correctly', () => {
@@ -355,7 +355,7 @@
};
element.capabilities = {};
element._updateSection(element.section);
- flushAsynchronousOperations();
+ flush();
});
test('classes are assigned correctly', () => {
@@ -365,7 +365,7 @@
element.editing = true;
element.canUpload = true;
element.ownerOf = [];
- flushAsynchronousOperations();
+ flush();
assert.notEqual(getComputedStyle(element.$.editBtn).display, 'none');
});
@@ -376,7 +376,7 @@
assert.equal(Object.keys(element.section.value.permissions).length,
1);
MockInteractions.tap(element.$.addBtn);
- flushAsynchronousOperations();
+ flush();
// The permission is added to both the permissions array and also
// the section's permission object.
@@ -399,7 +399,7 @@
element.$.permissionSelect.value = 'abandon';
MockInteractions.tap(element.$.addBtn);
- flushAsynchronousOperations();
+ flush();
permission = {
id: 'abandon',
@@ -479,14 +479,14 @@
assert.isFalse(element._deleted);
assert.isNotOk(element.section.value.deleted);
MockInteractions.tap(element.$.deleteBtn);
- flushAsynchronousOperations();
+ flush();
assert.isTrue(element._deleted);
assert.isTrue(element.section.value.deleted);
assert.isTrue(element.$.section.classList.contains('deleted'));
assert.isTrue(element.section.value.deleted);
MockInteractions.tap(element.$.undoRemoveBtn);
- flushAsynchronousOperations();
+ flush();
assert.isFalse(element._deleted);
assert.isNotOk(element.section.value.deleted);
@@ -506,7 +506,7 @@
new CustomEvent('added-permission-removed', {
composed: true, bubbles: true,
}));
- flushAsynchronousOperations();
+ flush();
assert.equal(element._permissions.length, 0);
});
diff --git a/polygerrit-ui/app/elements/admin/gr-admin-group-list/gr-admin-group-list_test.js b/polygerrit-ui/app/elements/admin/gr-admin-group-list/gr-admin-group-list_test.js
index 546b8a8..4cac782 100644
--- a/polygerrit-ui/app/elements/admin/gr-admin-group-list/gr-admin-group-list_test.js
+++ b/polygerrit-ui/app/elements/admin/gr-admin-group-list/gr-admin-group-list_test.js
@@ -154,7 +154,7 @@
element._loading = false;
element._groups = _.times(25, groupGenerator);
- flushAsynchronousOperations();
+ flush();
assert.equal(element.computeLoadingClass(element._loading), '');
assert.equal(getComputedStyle(element.$.loading).display, 'none');
});
diff --git a/polygerrit-ui/app/elements/admin/gr-admin-view/gr-admin-view_test.js b/polygerrit-ui/app/elements/admin/gr-admin-view/gr-admin-view_test.js
index d255c68..5fe479a 100644
--- a/polygerrit-ui/app/elements/admin/gr-admin-view/gr-admin-view_test.js
+++ b/polygerrit-ui/app/elements/admin/gr-admin-view/gr-admin-view_test.js
@@ -73,7 +73,7 @@
adminView: 'gr-repo-list',
};
- flushAsynchronousOperations();
+ flush();
assert.equal(element.root.querySelectorAll(
'.selected').length, 1);
assert.ok(element.shadowRoot
@@ -183,7 +183,7 @@
viewPlugins: true,
}));
element.reload().then(() => {
- flushAsynchronousOperations();
+ flush();
assert.equal(dom(element.root)
.querySelectorAll('.sectionTitle').length, 3);
assert.equal(element.shadowRoot
@@ -214,7 +214,7 @@
viewPlugins: true,
}));
element.reload().then(() => {
- flushAsynchronousOperations();
+ flush();
assert.equal(element._filteredLinks.length, 3);
// Repos
@@ -280,7 +280,7 @@
});
element.params = {group: 1, view: GerritNav.View.GROUP};
element._groupName = 'oldName';
- flushAsynchronousOperations();
+ flush();
element.shadowRoot
.querySelector('gr-group').dispatchEvent(
new CustomEvent('name-changed', {
@@ -302,11 +302,11 @@
detailType: undefined,
},
];
- flushAsynchronousOperations();
+ flush();
assert.isOk(element.shadowRoot
.querySelector('.mainHeader'));
element._subsectionLinks = undefined;
- flushAsynchronousOperations();
+ flush();
assert.equal(
getComputedStyle(element.shadowRoot
.querySelector('.mainHeader')).display,
@@ -332,7 +332,7 @@
element.$.restAPI,
'getAccount')
.callsFake(() => Promise.resolve({_id: 1}));
- flushAsynchronousOperations();
+ flush();
const expectedFilteredLinks = [
{
name: 'Repositories',
@@ -512,7 +512,7 @@
adminView: 'gr-repo-list',
openCreateModal: false,
};
- flushAsynchronousOperations();
+ flush();
const selected = element.shadowRoot
.querySelector('gr-page-nav .selected');
assert.isOk(selected);
@@ -526,7 +526,7 @@
};
element._repoName = 'foo';
return element.reload().then(() => {
- flushAsynchronousOperations();
+ flush();
const selected = element.shadowRoot
.querySelector('gr-page-nav .selected');
assert.isOk(selected);
@@ -542,7 +542,7 @@
};
element._repoName = 'foo';
return element.reload().then(() => {
- flushAsynchronousOperations();
+ flush();
const selected = element.shadowRoot
.querySelector('gr-page-nav .selected');
assert.isOk(selected);
@@ -558,7 +558,7 @@
};
element._repoName = 'foo';
return element.reload().then(() => {
- flushAsynchronousOperations();
+ flush();
const selected = element.shadowRoot
.querySelector('gr-page-nav .selected');
assert.isOk(selected);
@@ -592,7 +592,7 @@
adminView: 'gr-admin-group-list',
openCreateModal: false,
};
- flushAsynchronousOperations();
+ flush();
const selected = element.shadowRoot
.querySelector('gr-page-nav .selected');
assert.isOk(selected);
@@ -606,7 +606,7 @@
};
element._groupName = 'foo';
return element.reload().then(() => {
- flushAsynchronousOperations();
+ flush();
const subsectionItems = dom(element.root)
.querySelectorAll('.subsectionItem');
assert.equal(subsectionItems.length, 2);
@@ -631,7 +631,7 @@
};
element._groupName = 'foo';
return element.reload().then(() => {
- flushAsynchronousOperations();
+ flush();
const subsectionItems = dom(element.root)
.querySelectorAll('.subsectionItem');
assert.equal(subsectionItems.length, 0);
@@ -651,7 +651,7 @@
};
element._groupName = 'foo';
return element.reload().then(() => {
- flushAsynchronousOperations();
+ flush();
const selected = element.shadowRoot
.querySelector('gr-page-nav .selected');
assert.isOk(selected);
diff --git a/polygerrit-ui/app/elements/admin/gr-create-change-dialog/gr-create-change-dialog_test.js b/polygerrit-ui/app/elements/admin/gr-create-change-dialog/gr-create-change-dialog_test.js
index 07eee42..b570a7b 100644
--- a/polygerrit-ui/app/elements/admin/gr-create-change-dialog/gr-create-change-dialog_test.js
+++ b/polygerrit-ui/app/elements/admin/gr-create-change-dialog/gr-create-change-dialog_test.js
@@ -88,7 +88,7 @@
};
sinon.stub(element, '_formatBooleanString')
.callsFake(() => Promise.resolve(true));
- flushAsynchronousOperations();
+ flush();
const configInputObj = {
branch: 'test-branch',
diff --git a/polygerrit-ui/app/elements/admin/gr-permission/gr-permission_test.js b/polygerrit-ui/app/elements/admin/gr-permission/gr-permission_test.js
index d0d04f4..32430ec 100644
--- a/polygerrit-ui/app/elements/admin/gr-permission/gr-permission_test.js
+++ b/polygerrit-ui/app/elements/admin/gr-permission/gr-permission_test.js
@@ -283,7 +283,7 @@
},
};
element._setupValues();
- flushAsynchronousOperations();
+ flush();
});
test('adding a rule', () => {
@@ -300,7 +300,7 @@
assert.equal(element._rules.length, 2);
assert.equal(Object.keys(element._groupsWithRules).length, 2);
element._handleAddRuleItem(e);
- flushAsynchronousOperations();
+ flush();
assert.deepEqual(element.groups, {'ldap:CN=test te.st': {
name: 'ldap/tests te.st'}});
assert.equal(element._rules.length, 3);
@@ -324,7 +324,7 @@
new CustomEvent('added-rule-removed', {
composed: true, bubbles: true,
}));
- flushAsynchronousOperations();
+ flush();
assert.equal(element._rules.length, 1);
});
@@ -367,7 +367,7 @@
assert.isNotOk(element.permission.value.modified);
MockInteractions.tap(element.shadowRoot
.querySelector('#exclusiveToggle'));
- flushAsynchronousOperations();
+ flush();
assert.isTrue(element.permission.value.exclusive);
assert.isTrue(element.permission.value.modified);
assert.isFalse(element._originalExclusiveValue);
@@ -390,7 +390,7 @@
.querySelector('#exclusiveToggle')).display,
'flex');
element.set(['permission', 'id'], 'owner');
- flushAsynchronousOperations();
+ flush();
assert.equal(getComputedStyle(element.shadowRoot
.querySelector('#exclusiveToggle')).display,
'none');
@@ -401,7 +401,7 @@
.querySelector('#exclusiveToggle')).display,
'flex');
element.section = 'GLOBAL_CAPABILITIES';
- flushAsynchronousOperations();
+ flush();
assert.equal(getComputedStyle(element.shadowRoot
.querySelector('#exclusiveToggle')).display,
'none');
diff --git a/polygerrit-ui/app/elements/admin/gr-plugin-config-array-editor/gr-plugin-config-array-editor_test.js b/polygerrit-ui/app/elements/admin/gr-plugin-config-array-editor/gr-plugin-config-array-editor_test.js
index dae90a1..dfc191f 100644
--- a/polygerrit-ui/app/elements/admin/gr-plugin-config-array-editor/gr-plugin-config-array-editor_test.js
+++ b/polygerrit-ui/app/elements/admin/gr-plugin-config-array-editor/gr-plugin-config-array-editor_test.js
@@ -60,12 +60,12 @@
test('with enter', () => {
element._newValue = '';
MockInteractions.pressAndReleaseKeyOn(element.$.input, 13); // Enter
- flushAsynchronousOperations();
+ flush();
assert.isFalse(dispatchStub.called);
element._newValue = 'test';
MockInteractions.pressAndReleaseKeyOn(element.$.input, 13); // Enter
- flushAsynchronousOperations();
+ flush();
assert.isTrue(dispatchStub.called);
assert.equal(dispatchStub.lastCall.args[0], 'test');
@@ -75,12 +75,12 @@
test('with add btn', () => {
element._newValue = '';
MockInteractions.tap(element.$.addButton);
- flushAsynchronousOperations();
+ flush();
assert.isFalse(dispatchStub.called);
element._newValue = 'test';
MockInteractions.tap(element.$.addButton);
- flushAsynchronousOperations();
+ flush();
assert.isTrue(dispatchStub.called);
assert.equal(dispatchStub.lastCall.args[0], 'test');
@@ -91,22 +91,22 @@
test('deleting', () => {
dispatchStub = sinon.stub(element, '_dispatchChanged');
element.pluginOption = {info: {values: ['test', 'test2']}};
- flushAsynchronousOperations();
+ flush();
const rows = getAll('.existingItems .row');
assert.equal(rows.length, 2);
const button = rows[0].querySelector('gr-button');
MockInteractions.tap(button);
- flushAsynchronousOperations();
+ flush();
assert.isFalse(dispatchStub.called);
element.pluginOption.info.editable = true;
element.notifyPath('pluginOption.info.editable');
- flushAsynchronousOperations();
+ flush();
MockInteractions.tap(button);
- flushAsynchronousOperations();
+ flush();
assert.isTrue(dispatchStub.called);
assert.deepEqual(dispatchStub.lastCall.args[0], ['test2']);
diff --git a/polygerrit-ui/app/elements/admin/gr-plugin-list/gr-plugin-list_test.js b/polygerrit-ui/app/elements/admin/gr-plugin-list/gr-plugin-list_test.js
index 4176dd8..3c027de 100644
--- a/polygerrit-ui/app/elements/admin/gr-plugin-list/gr-plugin-list_test.js
+++ b/polygerrit-ui/app/elements/admin/gr-plugin-list/gr-plugin-list_test.js
@@ -158,7 +158,7 @@
element._loading = false;
element._plugins = _.times(25, pluginGenerator);
- flushAsynchronousOperations();
+ flush();
assert.equal(element.computeLoadingClass(element._loading), '');
assert.equal(getComputedStyle(element.$.loading).display, 'none');
});
diff --git a/polygerrit-ui/app/elements/admin/gr-repo-access/gr-repo-access_test.js b/polygerrit-ui/app/elements/admin/gr-repo-access/gr-repo-access_test.js
index af87254..d3204e1 100644
--- a/polygerrit-ui/app/elements/admin/gr-repo-access/gr-repo-access_test.js
+++ b/polygerrit-ui/app/elements/admin/gr-repo-access/gr-repo-access_test.js
@@ -209,7 +209,7 @@
name: 'another-repo',
};
// When there is a parent project, the link should be displayed.
- flushAsynchronousOperations();
+ flush();
assert.notEqual(getComputedStyle(element.$.inheritsFrom).display, 'none');
assert.notEqual(getComputedStyle(element.$.inheritFromName).display,
'none');
@@ -266,13 +266,13 @@
element._inheritsFrom = {
id: 'test-project',
};
- flushAsynchronousOperations();
+ flush();
assert.equal(getComputedStyle(element.shadowRoot
.querySelector('#editInheritFromInput'))
.display, 'none');
MockInteractions.tap(element.$.editBtn);
- flushAsynchronousOperations();
+ flush();
// Edit button changes to Cancel button, and Save button is visible but
// disabled.
@@ -312,7 +312,7 @@
element._groups = JSON.parse(JSON.stringify(accessRes.groups));
element._capabilities = JSON.parse(JSON.stringify(capabilitiesRes));
element._labels = JSON.parse(JSON.stringify(repoRes.labels));
- flushAsynchronousOperations();
+ flush();
});
test('removing an added section', () => {
@@ -323,7 +323,7 @@
new CustomEvent('added-section-removed', {
composed: true, bubbles: true,
}));
- flushAsynchronousOperations();
+ flush();
assert.equal(element._sections.length, 0);
});
@@ -361,7 +361,7 @@
element._inheritsFrom = {
id: 'test-project',
};
- flushAsynchronousOperations();
+ flush();
element.shadowRoot.querySelector('#editInheritFromInput').dispatchEvent(
new CustomEvent('commit', {
detail: {},
@@ -588,7 +588,7 @@
._handleAddRuleItem(
{detail: {value: 'Maintainers'}});
- flushAsynchronousOperations();
+ flush();
assert.deepEqual(element._computeAddAndRemove(), expectedInput);
// Remove the added rule.
@@ -656,7 +656,7 @@
};
element.shadowRoot
.querySelector('gr-access-section')._handleAddPermission();
- flushAsynchronousOperations();
+ flush();
assert.deepEqual(element._computeAddAndRemove(), expectedInput);
// Add a new rule to the new permission.
@@ -777,7 +777,7 @@
const newSection = dom(element.root)
.querySelectorAll('gr-access-section')[1];
newSection._handleAddPermission();
- flushAsynchronousOperations();
+ flush();
assert.deepEqual(element._computeAddAndRemove(), expectedInput);
// Add rule to the new permission.
@@ -808,7 +808,7 @@
.querySelector('gr-permission')._handleAddRuleItem(
{detail: {value: 'Maintainers'}});
- flushAsynchronousOperations();
+ flush();
assert.deepEqual(element._computeAddAndRemove(), expectedInput);
// Modify a the reference from the default value.
@@ -994,7 +994,7 @@
let newSection = dom(element.root)
.querySelectorAll('gr-access-section')[1];
newSection._handleAddPermission();
- flushAsynchronousOperations();
+ flush();
newSection.shadowRoot
.querySelector('gr-permission')._handleAddRuleItem(
{detail: {value: 'Maintainers'}});
@@ -1068,7 +1068,7 @@
newSection = dom(element.root)
.querySelectorAll('gr-access-section')[2];
newSection._handleAddPermission();
- flushAsynchronousOperations();
+ flush();
newSection.shadowRoot
.querySelector('gr-permission')._handleAddRuleItem(
{detail: {value: 'Maintainers'}});
diff --git a/polygerrit-ui/app/elements/admin/gr-repo-commands/gr-repo-commands_test.js b/polygerrit-ui/app/elements/admin/gr-repo-commands/gr-repo-commands_test.js
index 56e9507..efe4012 100644
--- a/polygerrit-ui/app/elements/admin/gr-repo-commands/gr-repo-commands_test.js
+++ b/polygerrit-ui/app/elements/admin/gr-repo-commands/gr-repo-commands_test.js
@@ -83,7 +83,7 @@
MockInteractions.tap(element.$.editRepoConfig);
assert.isTrue(element.$.editRepoConfig.loading);
return handleSpy.lastCall.returnValue.then(() => {
- flushAsynchronousOperations();
+ flush();
assert.isTrue(alertStub.called);
assert.equal(alertStub.lastCall.args[0].detail.message,
@@ -100,7 +100,7 @@
MockInteractions.tap(element.$.editRepoConfig);
assert.isTrue(element.$.editRepoConfig.loading);
return handleSpy.lastCall.returnValue.then(() => {
- flushAsynchronousOperations();
+ flush();
assert.isTrue(alertStub.called);
assert.equal(alertStub.lastCall.args[0].detail.message,
diff --git a/polygerrit-ui/app/elements/admin/gr-repo-detail-list/gr-repo-detail-list_test.js b/polygerrit-ui/app/elements/admin/gr-repo-detail-list/gr-repo-detail-list_test.js
index f86f613..7727821 100644
--- a/polygerrit-ui/app/elements/admin/gr-repo-detail-list/gr-repo-detail-list_test.js
+++ b/polygerrit-ui/app/elements/admin/gr-repo-detail-list/gr-repo-detail-list_test.js
@@ -170,7 +170,7 @@
}
MockInteractions.tap(editBtn);
- flushAsynchronousOperations();
+ flush();
// The revision and edit button are not visible.
assert.equal(getComputedStyle(revisionWithEditing).display, 'none');
assert.equal(getComputedStyle(editBtn).display, 'none');
@@ -201,7 +201,7 @@
// When cancel is tapped, the edit secion closes.
MockInteractions.tap(cancelBtn);
- flushAsynchronousOperations();
+ flush();
// The revision and edit button are visible.
assert.notEqual(getComputedStyle(revisionWithEditing).display,
diff --git a/polygerrit-ui/app/elements/admin/gr-repo-list/gr-repo-list_test.js b/polygerrit-ui/app/elements/admin/gr-repo-list/gr-repo-list_test.js
index a6dc32c..32cc2ca 100644
--- a/polygerrit-ui/app/elements/admin/gr-repo-list/gr-repo-list_test.js
+++ b/polygerrit-ui/app/elements/admin/gr-repo-list/gr-repo-list_test.js
@@ -144,7 +144,7 @@
element._loading = false;
element._repos = _.times(25, repoGenerator);
- flushAsynchronousOperations();
+ flush();
assert.equal(element.computeLoadingClass(element._loading), '');
assert.equal(getComputedStyle(element.$.loading).display, 'none');
});
diff --git a/polygerrit-ui/app/elements/admin/gr-repo-plugin-config/gr-repo-plugin-config_test.js b/polygerrit-ui/app/elements/admin/gr-repo-plugin-config/gr-repo-plugin-config_test.js
index 1730839..168984a 100644
--- a/polygerrit-ui/app/elements/admin/gr-repo-plugin-config/gr-repo-plugin-config_test.js
+++ b/polygerrit-ui/app/elements/admin/gr-repo-plugin-config/gr-repo-plugin-config_test.js
@@ -77,7 +77,7 @@
name: 'testName',
config: {plugin: {value: 'test', type: 'ARRAY'}},
};
- flushAsynchronousOperations();
+ flush();
const editor = element.shadowRoot
.querySelector('gr-plugin-config-array-editor');
@@ -92,13 +92,13 @@
name: 'testName',
config: {plugin: {value: 'true', type: 'BOOLEAN'}},
};
- flushAsynchronousOperations();
+ flush();
const toggle = element.shadowRoot
.querySelector('paper-toggle-button');
assert.ok(toggle);
toggle.click();
- flushAsynchronousOperations();
+ flush();
assert.isTrue(buildStub.called);
assert.deepEqual(buildStub.lastCall.args, ['false', 'plugin']);
@@ -111,14 +111,14 @@
name: 'testName',
config: {plugin: {value: 'test', type: 'STRING'}},
};
- flushAsynchronousOperations();
+ flush();
const input = element.shadowRoot
.querySelector('input');
assert.ok(input);
input.value = 'newTest';
input.dispatchEvent(new Event('input'));
- flushAsynchronousOperations();
+ flush();
assert.isTrue(buildStub.called);
assert.deepEqual(buildStub.lastCall.args, ['newTest', 'plugin']);
@@ -132,7 +132,7 @@
name: 'testName',
config: {plugin: {value: 'test', type: 'LIST', permitted_values}},
};
- flushAsynchronousOperations();
+ flush();
const select = element.shadowRoot
.querySelector('select');
@@ -140,7 +140,7 @@
select.value = 'newTest';
select.dispatchEvent(new Event(
'change', {bubbles: true, composed: true}));
- flushAsynchronousOperations();
+ flush();
assert.isTrue(buildStub.called);
assert.deepEqual(buildStub.lastCall.args, ['newTest', 'plugin']);
diff --git a/polygerrit-ui/app/elements/admin/gr-repo/gr-repo_test.js b/polygerrit-ui/app/elements/admin/gr-repo/gr-repo_test.js
index 4d7946c..93a9d64 100644
--- a/polygerrit-ui/app/elements/admin/gr-repo/gr-repo_test.js
+++ b/polygerrit-ui/app/elements/admin/gr-repo/gr-repo_test.js
@@ -127,7 +127,7 @@
config: 'data',
notifyPath: 'path',
}});
- flushAsynchronousOperations();
+ flush();
assert.equal(element._repoConfig.plugin_config.test, 'data');
assert.equal(notifyStub.lastCall.args[0],
@@ -144,12 +144,12 @@
test('download commands visibility', () => {
element._loading = false;
- flushAsynchronousOperations();
+ flush();
assert.isTrue(element.$.downloadContent.classList.contains('hide'));
assert.isTrue(getComputedStyle(element.$.downloadContent)
.display == 'none');
element._schemesObj = SCHEMES;
- flushAsynchronousOperations();
+ flush();
assert.isFalse(element.$.downloadContent.classList.contains('hide'));
assert.isFalse(getComputedStyle(element.$.downloadContent)
.display == 'none');
@@ -183,7 +183,7 @@
test('all form elements are disabled when not admin', done => {
element.repo = REPO;
element._loadRepo().then(() => {
- flushAsynchronousOperations();
+ flush();
const formFields = getFormFields();
for (const field of formFields) {
assert.isTrue(field.hasAttribute('disabled'));
@@ -271,7 +271,7 @@
test('all form elements are enabled', done => {
element._loadRepo().then(() => {
- flushAsynchronousOperations();
+ flush();
const formFields = getFormFields();
for (const field of formFields) {
assert.isFalse(field.hasAttribute('disabled'));
diff --git a/polygerrit-ui/app/elements/admin/gr-rule-editor/gr-rule-editor_test.js b/polygerrit-ui/app/elements/admin/gr-rule-editor/gr-rule-editor_test.js
index 5a9ba37..b0065d9 100644
--- a/polygerrit-ui/app/elements/admin/gr-rule-editor/gr-rule-editor_test.js
+++ b/polygerrit-ui/app/elements/admin/gr-rule-editor/gr-rule-editor_test.js
@@ -195,7 +195,7 @@
// Typically called on ready since elements will have properies defined
// by the parent element.
element._setupValues(element.rule);
- flushAsynchronousOperations();
+ flush();
flush(() => {
element.attached();
done();
@@ -229,7 +229,7 @@
test('modify value', () => {
assert.isNotOk(element.rule.value.modified);
element.$.action.bindValue = 'DENY';
- flushAsynchronousOperations();
+ flush();
assert.isTrue(element.rule.value.modified);
// The original value should now differ from the rule values.
@@ -303,7 +303,7 @@
};
element.section = 'refs/*';
element._setupValues(element.rule);
- flushAsynchronousOperations();
+ flush();
element.rule.value.added = true;
flush(() => {
element.attached();
@@ -330,7 +330,7 @@
test('modify value', () => {
assert.isNotOk(element.rule.value.modified);
element.$.force.bindValue = true;
- flushAsynchronousOperations();
+ flush();
assert.isTrue(element.rule.value.modified);
// The original value should now differ from the rule values.
@@ -342,7 +342,7 @@
const removeStub = sinon.stub();
element.addEventListener('added-rule-removed', removeStub);
MockInteractions.tap(element.$.removeBtn);
- flushAsynchronousOperations();
+ flush();
assert.isTrue(removeStub.called);
});
});
@@ -369,7 +369,7 @@
};
element.section = 'refs/*';
element._setupValues(element.rule);
- flushAsynchronousOperations();
+ flush();
flush(() => {
element.attached();
done();
@@ -396,7 +396,7 @@
element.addEventListener('added-rule-removed', removeStub);
assert.isNotOk(element.rule.value.modified);
element.root.querySelector('#labelMin').bindValue = 1;
- flushAsynchronousOperations();
+ flush();
assert.isTrue(element.rule.value.modified);
assert.isFalse(removeStub.called);
@@ -422,7 +422,7 @@
};
element.section = 'refs/*';
element._setupValues(element.rule);
- flushAsynchronousOperations();
+ flush();
element.rule.value.added = true;
flush(() => {
element.attached();
@@ -459,7 +459,7 @@
test('modify value', () => {
assert.isNotOk(element.rule.value.modified);
element.root.querySelector('#labelMin').bindValue = 1;
- flushAsynchronousOperations();
+ flush();
assert.isTrue(element.rule.value.modified);
// The original value should now differ from the rule values.
@@ -480,7 +480,7 @@
};
element.section = 'refs/*';
element._setupValues(element.rule);
- flushAsynchronousOperations();
+ flush();
flush(() => {
element.attached();
done();
@@ -504,7 +504,7 @@
test('modify value', () => {
assert.isNotOk(element.rule.value.modified);
element.$.action.bindValue = false;
- flushAsynchronousOperations();
+ flush();
assert.isTrue(element.rule.value.modified);
// The original value should now differ from the rule values.
@@ -521,7 +521,7 @@
};
element.section = 'refs/*';
element._setupValues(element.rule);
- flushAsynchronousOperations();
+ flush();
element.rule.value.added = true;
flush(() => {
element.attached();
@@ -548,7 +548,7 @@
test('modify value', () => {
assert.isNotOk(element.rule.value.modified);
element.$.force.bindValue = true;
- flushAsynchronousOperations();
+ flush();
assert.isTrue(element.rule.value.modified);
// The original value should now differ from the rule values.
@@ -569,7 +569,7 @@
};
element.section = 'refs/*';
element._setupValues(element.rule);
- flushAsynchronousOperations();
+ flush();
flush(() => {
element.attached();
done();
@@ -593,7 +593,7 @@
test('modify value', () => {
assert.isNotOk(element.rule.value.modified);
element.$.action.bindValue = false;
- flushAsynchronousOperations();
+ flush();
assert.isTrue(element.rule.value.modified);
// The original value should now differ from the rule values.
diff --git a/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item_test.js b/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item_test.js
index 1970928..3dfdb60 100644
--- a/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item_test.js
+++ b/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item_test.js
@@ -115,7 +115,7 @@
'Size',
];
- flushAsynchronousOperations();
+ flush();
for (const column of element.columnNames) {
const elementClass = '.' + column.toLowerCase();
@@ -140,7 +140,7 @@
'Size',
];
- flushAsynchronousOperations();
+ flush();
for (const column of element.columnNames) {
const elementClass = '.' + column.toLowerCase();
@@ -197,7 +197,7 @@
'Bad',
];
- flushAsynchronousOperations();
+ flush();
const elementClass = '.bad';
assert.isNotOk(element.shadowRoot
.querySelector(elementClass));
@@ -205,7 +205,7 @@
test('assignee only displayed if there is one', () => {
element.change = {};
- flushAsynchronousOperations();
+ flush();
assert.isNotOk(element.shadowRoot
.querySelector('.assignee gr-account-link'));
assert.equal(element.shadowRoot
@@ -216,7 +216,7 @@
status: 'test',
},
};
- flushAsynchronousOperations();
+ flush();
assert.isOk(element.shadowRoot
.querySelector('.assignee gr-account-link'));
});
@@ -272,7 +272,7 @@
branch: 'test-branch',
};
element.change = change;
- flushAsynchronousOperations();
+ flush();
assert.deepEqual(GerritNav.getUrlForChange.lastCall.args, [change]);
assert.deepEqual(GerritNav.getUrlForProjectChanges.lastCall.args,
diff --git a/polygerrit-ui/app/elements/change-list/gr-change-list-view/gr-change-list-view_test.js b/polygerrit-ui/app/elements/change-list/gr-change-list-view/gr-change-list-view_test.js
index 6991323..6104335 100644
--- a/polygerrit-ui/app/elements/change-list/gr-change-list-view/gr-change-list-view_test.js
+++ b/polygerrit-ui/app/elements/change-list/gr-change-list-view/gr-change-list-view_test.js
@@ -236,7 +236,7 @@
const stub = sinon.stub(GerritNav, 'navigateToChange');
element.params = {view: GerritNav.View.SEARCH, query: CHANGE_ID};
- flushAsynchronousOperations();
+ flush();
assert.isFalse(stub.called);
});
@@ -247,7 +247,7 @@
const stub = sinon.stub(GerritNav, 'navigateToChange');
element.params = {view: GerritNav.View.SEARCH, query: CHANGE_ID};
- flushAsynchronousOperations();
+ flush();
assert.isFalse(stub.called);
});
diff --git a/polygerrit-ui/app/elements/change-list/gr-change-list/gr-change-list_test.js b/polygerrit-ui/app/elements/change-list/gr-change-list/gr-change-list_test.js
index 56a16b5..68ab5e5 100644
--- a/polygerrit-ui/app/elements/change-list/gr-change-list/gr-change-list_test.js
+++ b/polygerrit-ui/app/elements/change-list/gr-change-list/gr-change-list_test.js
@@ -70,7 +70,7 @@
};
element.account = {_account_id: 1001};
element._config = {};
- flushAsynchronousOperations();
+ flush();
});
test('show number enabled', () => {
@@ -88,7 +88,7 @@
};
element.account = {_account_id: 1001};
element._config = {};
- flushAsynchronousOperations();
+ flush();
});
test('show number disabled', () => {
@@ -138,7 +138,7 @@
element.sections = [
{results: [{}]},
];
- flushAsynchronousOperations();
+ flush();
const tdItemCount = element.root.querySelectorAll(
'td').length;
@@ -160,7 +160,7 @@
{_number: 1},
{_number: 2},
];
- flushAsynchronousOperations();
+ flush();
afterNextRender(element, () => {
const elementItems = element.root.querySelectorAll(
'gr-change-list-item');
@@ -229,7 +229,7 @@
owner: {_account_id: 0},
},
];
- flushAsynchronousOperations();
+ flush();
let elementItems = element.root.querySelectorAll(
'gr-change-list-item');
assert.equal(elementItems.length, 5);
@@ -269,7 +269,7 @@
test('no changes', () => {
element.changes = [];
- flushAsynchronousOperations();
+ flush();
const listItems = element.root.querySelectorAll(
'gr-change-list-item');
assert.equal(listItems.length, 0);
@@ -280,7 +280,7 @@
test('empty sections', () => {
element.sections = [{results: []}, {results: []}];
- flushAsynchronousOperations();
+ flush();
const listItems = element.root.querySelectorAll(
'gr-change-list-item');
assert.equal(listItems.length, 0);
@@ -330,7 +330,7 @@
change_table: [],
};
element._config = {};
- flushAsynchronousOperations();
+ flush();
});
test('show number enabled', () => {
@@ -372,7 +372,7 @@
],
};
element._config = {};
- flushAsynchronousOperations();
+ flush();
});
test('all columns visible', () => {
@@ -409,7 +409,7 @@
],
};
element._config = {};
- flushAsynchronousOperations();
+ flush();
});
test('all columns except repo visible', () => {
@@ -441,7 +441,7 @@
'Bad',
],
};
- flushAsynchronousOperations();
+ flush();
});
test('bad column does not exist', () => {
@@ -534,7 +534,7 @@
],
},
];
- flushAsynchronousOperations();
+ flush();
afterNextRender(element, () => {
const elementItems = element.root.querySelectorAll(
'gr-change-list-item');
@@ -590,7 +590,7 @@
},
];
element.account = {_account_id: 42};
- flushAsynchronousOperations();
+ flush();
let items = element._getListItems();
assert.equal(items.length, 2);
assert.isFalse(items[0].hasAttribute('highlight'));
@@ -601,7 +601,7 @@
element.set(['changes', 0, 'assignee'], {_account_id: 12});
element.set(['changes', 1, 'assignee'], {_account_id: 12});
element.account = {_account_id: 12};
- flushAsynchronousOperations();
+ flush();
items = element._getListItems();
assert.isTrue(items[0].hasAttribute('highlight'));
assert.isFalse(items[1].hasAttribute('highlight'));
diff --git a/polygerrit-ui/app/elements/change-list/gr-dashboard-view/gr-dashboard-view_test.js b/polygerrit-ui/app/elements/change-list/gr-dashboard-view/gr-dashboard-view_test.js
index f56ad75..063fbb2 100644
--- a/polygerrit-ui/app/elements/change-list/gr-dashboard-view/gr-dashboard-view_test.js
+++ b/polygerrit-ui/app/elements/change-list/gr-dashboard-view/gr-dashboard-view_test.js
@@ -86,12 +86,12 @@
test('_showDraftsBanner', () => {
element._showDraftsBanner = false;
- flushAsynchronousOperations();
+ flush();
assert.isTrue(isHidden(element.shadowRoot
.querySelector('.banner')));
element._showDraftsBanner = true;
- flushAsynchronousOperations();
+ flush();
assert.isFalse(isHidden(element.shadowRoot
.querySelector('.banner')));
});
@@ -99,7 +99,7 @@
test('delete tap opens dialog', () => {
sinon.stub(element, '_handleOpenDeleteDialog');
element._showDraftsBanner = true;
- flushAsynchronousOperations();
+ flush();
MockInteractions.tap(element.shadowRoot
.querySelector('.banner .delete'));
@@ -121,7 +121,7 @@
// Open confirmation dialog and tap confirm button.
await element.$.confirmDeleteOverlay.open();
MockInteractions.tap(element.$.confirmDeleteDialog.$.confirm);
- flushAsynchronousOperations();
+ flush();
assert.isTrue(element.$.restAPI.deleteDraftComments
.calledWithExactly('-is:open'));
assert.isTrue(element.$.confirmDeleteDialog.disabled);
@@ -163,11 +163,11 @@
suite('_isViewActive', () => {
test('nothing happens when user param is falsy', () => {
element.params = {};
- flushAsynchronousOperations();
+ flush();
assert.equal(getChangesStub.callCount, 0);
element.params = {user: ''};
- flushAsynchronousOperations();
+ flush();
assert.equal(getChangesStub.callCount, 0);
});
@@ -312,13 +312,13 @@
test('_showNewUserHelp', () => {
element._loading = false;
element._showNewUserHelp = false;
- flushAsynchronousOperations();
+ flush();
assert.equal(element.$.emptyOutgoing.textContent.trim(), 'No changes');
assert.isNotOk(element.shadowRoot
.querySelector('gr-create-change-help'));
element._showNewUserHelp = true;
- flushAsynchronousOperations();
+ flush();
assert.notEqual(element.$.emptyOutgoing.textContent.trim(), 'No changes');
assert.isOk(element.shadowRoot
diff --git a/polygerrit-ui/app/elements/change-list/gr-user-header/gr-user-header_test.js b/polygerrit-ui/app/elements/change-list/gr-user-header/gr-user-header_test.js
index 15fbf8b..a808f3c 100644
--- a/polygerrit-ui/app/elements/change-list/gr-user-header/gr-user-header_test.js
+++ b/polygerrit-ui/app/elements/change-list/gr-user-header/gr-user-header_test.js
@@ -43,7 +43,7 @@
element.userId = null;
flush(() => {
- flushAsynchronousOperations();
+ flush();
assert.isNull(element._accountDetails);
assert.equal(element._status, '');
diff --git a/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions_test.js b/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions_test.js
index e163479..091e5a2 100644
--- a/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions_test.js
+++ b/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions_test.js
@@ -287,7 +287,7 @@
assert.ok(submitButton);
MockInteractions.tap(submitButton);
- flushAsynchronousOperations();
+ flush();
assert.isTrue(showSpy.calledWith(element.$.confirmSubmitDialog));
});
@@ -434,7 +434,7 @@
.querySelector('gr-button[data-action-key="rebase"]');
assert.ok(rebaseButton);
MockInteractions.tap(rebaseButton);
- flushAsynchronousOperations();
+ flush();
assert.isFalse(element.$.confirmRebase.hidden);
sinon.stub(element.$.restAPI, 'getChanges')
.returns(Promise.resolve([]));
@@ -486,7 +486,7 @@
element.set('editPatchsetLoaded', false);
element.change = {status: 'NEW'};
element.set('disableEdit', true);
- flushAsynchronousOperations();
+ flush();
assert.isNotOk(element.shadowRoot
.querySelector('gr-button[data-action-key="publishEdit"]'));
@@ -512,7 +512,7 @@
.querySelector('#confirmDeleteEditDialog')
.shadowRoot
.querySelector('gr-button[primary]'));
- flushAsynchronousOperations();
+ flush();
assert.equal(fireActionStub.lastCall.args[0], '/edit');
});
@@ -521,7 +521,7 @@
element.set('editMode', true);
element.set('editPatchsetLoaded', true);
element.change = {status: 'MERGED'};
- flushAsynchronousOperations();
+ flush();
assert.isNotOk(element.shadowRoot
.querySelector('gr-button[data-action-key="publishEdit"]'));
@@ -538,7 +538,7 @@
element.set('editPatchsetLoaded', true);
element.change = {status: 'NEW'};
element.editBasedOnCurrentPatchSet = false;
- flushAsynchronousOperations();
+ flush();
assert.isNotOk(element.shadowRoot
.querySelector('gr-button[data-action-key="publishEdit"]'));
@@ -557,7 +557,7 @@
element.set('editPatchsetLoaded', true);
element.change = {status: 'NEW'};
element.editBasedOnCurrentPatchSet = true;
- flushAsynchronousOperations();
+ flush();
assert.isOk(element.shadowRoot
.querySelector('gr-button[data-action-key="publishEdit"]'));
@@ -575,7 +575,7 @@
element.set('editMode', true);
element.set('editPatchsetLoaded', false);
element.change = {status: 'NEW'};
- flushAsynchronousOperations();
+ flush();
assert.isNotOk(element.shadowRoot
.querySelector('gr-button[data-action-key="publishEdit"]'));
@@ -593,7 +593,7 @@
element.set('editMode', false);
element.set('editPatchsetLoaded', false);
element.change = {status: 'NEW'};
- flushAsynchronousOperations();
+ flush();
assert.isNotOk(element.shadowRoot
.querySelector('gr-button[data-action-key="publishEdit"]'));
@@ -611,20 +611,20 @@
element.addEventListener('edit-tap', () => { done(); });
element.set('editMode', true);
element.change = {status: 'NEW'};
- flushAsynchronousOperations();
+ flush();
assert.isNotOk(element.shadowRoot
.querySelector('gr-button[data-action-key="edit"]'));
assert.isOk(element.shadowRoot
.querySelector('gr-button[data-action-key="stopEdit"]'));
element.change = {status: 'MERGED'};
- flushAsynchronousOperations();
+ flush();
assert.isNotOk(element.shadowRoot
.querySelector('gr-button[data-action-key="edit"]'));
element.change = {status: 'NEW'};
element.set('editMode', false);
- flushAsynchronousOperations();
+ flush();
const editButton = element.shadowRoot
.querySelector('gr-button[data-action-key="edit"]');
@@ -1214,7 +1214,7 @@
element.$.moreActions.shadowRoot
.querySelector('span[data-id="private-change"]'));
element.setActionOverflow('change', 'private', false);
- flushAsynchronousOperations();
+ flush();
assert.isOk(element.shadowRoot
.querySelector('[data-action-key="private"]'));
assert.isNotOk(
@@ -1265,7 +1265,7 @@
.querySelector('span[data-id="private.delete-change"]')
);
element.setActionOverflow('change', 'private.delete', false);
- flushAsynchronousOperations();
+ flush();
assert.isOk(element.shadowRoot
.querySelector('[data-action-key="private.delete"]'));
assert.isNotOk(
@@ -1311,7 +1311,7 @@
.querySelector('#confirmDeleteDialog')
.shadowRoot
.querySelector('gr-button[primary]'));
- flushAsynchronousOperations();
+ flush();
assert.isTrue(fireActionStub.calledWith('/', deleteAction, false));
});
@@ -1322,7 +1322,7 @@
.querySelector('#confirmDeleteDialog')
.shadowRoot
.querySelector('gr-button:not([primary])'));
- flushAsynchronousOperations();
+ flush();
assert.isTrue(element.shadowRoot
.querySelector('#confirmDeleteDialog').hidden);
assert.isFalse(fireActionStub.called);
@@ -1363,7 +1363,7 @@
assert.isOk(element.$.moreActions.shadowRoot
.querySelector('span[data-id="ignore-change"]'));
element.setActionOverflow('change', 'ignore', false);
- flushAsynchronousOperations();
+ flush();
assert.isOk(element.shadowRoot
.querySelector('[data-action-key="ignore"]'));
assert.isNotOk(
@@ -1406,7 +1406,7 @@
element.$.moreActions.shadowRoot
.querySelector('span[data-id="unignore-change"]'));
element.setActionOverflow('change', 'unignore', false);
- flushAsynchronousOperations();
+ flush();
assert.isOk(element.shadowRoot
.querySelector('[data-action-key="unignore"]'));
assert.isNotOk(
@@ -1463,7 +1463,7 @@
element.$.moreActions.shadowRoot
.querySelector('span[data-id="reviewed-change"]'));
element.setActionOverflow('change', 'reviewed', false);
- flushAsynchronousOperations();
+ flush();
assert.isOk(element.shadowRoot
.querySelector('[data-action-key="reviewed"]'));
assert.isNotOk(
@@ -1506,7 +1506,7 @@
element.$.moreActions.shadowRoot
.querySelector('span[data-id="unreviewed-change"]'));
element.setActionOverflow('change', 'unreviewed', false);
- flushAsynchronousOperations();
+ flush();
assert.isOk(element.shadowRoot
.querySelector('[data-action-key="unreviewed"]'));
assert.isNotOk(
@@ -1535,7 +1535,7 @@
foo: ['-1', ' 0', '+1'],
},
};
- flushAsynchronousOperations();
+ flush();
});
test('added when can approve', () => {
@@ -1554,7 +1554,7 @@
// Assert approve button gets removed from list of buttons.
element.hideQuickApproveAction();
- flushAsynchronousOperations();
+ flush();
const approveButtonUpdated =
element.shadowRoot
.querySelector('gr-button[data-action-key=\'review\']');
@@ -1581,7 +1581,7 @@
foo: [' 0', '+1'],
},
};
- flushAsynchronousOperations();
+ flush();
const approveButton =
element.shadowRoot
.querySelector('gr-button[data-action-key=\'review\']');
@@ -1598,7 +1598,7 @@
bar: [],
},
};
- flushAsynchronousOperations();
+ flush();
const approveButton =
element.shadowRoot
.querySelector('gr-button[data-action-key=\'review\']');
@@ -1610,7 +1610,7 @@
MockInteractions.tap(
element.shadowRoot
.querySelector('gr-button[data-action-key=\'review\']'));
- flushAsynchronousOperations();
+ flush();
assert.isTrue(fireActionStub.called);
assert.isTrue(fireActionStub.calledWith('/review'));
const payload = fireActionStub.lastCall.args[3];
@@ -1629,7 +1629,7 @@
bar: [' 0', '+1', '+2'],
},
};
- flushAsynchronousOperations();
+ flush();
const approveButton =
element.shadowRoot
.querySelector('gr-button[data-action-key=\'review\']');
@@ -1653,7 +1653,7 @@
bar: [' 0', '+1', '+2'],
},
};
- flushAsynchronousOperations();
+ flush();
const approveButton =
element.shadowRoot
.querySelector('gr-button[data-action-key=\'review\']');
@@ -1677,7 +1677,7 @@
bar: [' 0', '+1'],
},
};
- flushAsynchronousOperations();
+ flush();
const approveButton =
element.shadowRoot
.querySelector('gr-button[data-action-key=\'review\']');
@@ -1701,7 +1701,7 @@
bar: [' 0', '+1', '+2'],
},
};
- flushAsynchronousOperations();
+ flush();
const approveButton =
element.shadowRoot
.querySelector('gr-button[data-action-key=\'review\']');
@@ -1714,7 +1714,7 @@
element.addEventListener('download-tap', handler);
assert.ok(element.revisionActions.download);
element._handleDownloadTap();
- flushAsynchronousOperations();
+ flush();
assert.isTrue(handler.called);
});
@@ -1742,7 +1742,7 @@
assert.strictEqual(
element.$.moreActions.items[0].id, 'cherrypick-revision');
element.setActionOverflow('revision', 'cherrypick', false);
- flushAsynchronousOperations();
+ flush();
assert.isOk(element.shadowRoot
.querySelector('[data-action-key="cherrypick"]'));
assert.notEqual(
@@ -1753,7 +1753,7 @@
assert.isOk(element.shadowRoot
.querySelector('[data-action-key="submit"]'));
element.setActionOverflow('revision', 'submit', true);
- flushAsynchronousOperations();
+ flush();
assert.isNotOk(element.shadowRoot
.querySelector('[data-action-key="submit"]'));
assert.strictEqual(
diff --git a/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata_test.js b/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata_test.js
index f7a080f..bdcd480 100644
--- a/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata_test.js
+++ b/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata_test.js
@@ -87,7 +87,7 @@
test('show strategy for open change', () => {
element.change = {status: 'NEW', submit_type: 'CHERRY_PICK', labels: {}};
- flushAsynchronousOperations();
+ flush();
const strategy = element.shadowRoot
.querySelector('.strategy');
assert.ok(strategy);
@@ -97,7 +97,7 @@
test('hide strategy for closed change', () => {
element.change = {status: 'MERGED', labels: {}};
- flushAsynchronousOperations();
+ flush();
assert.isTrue(element.shadowRoot
.querySelector('.strategy').hasAttribute('hidden'));
});
@@ -107,7 +107,7 @@
.returns([{name: 'stubb', url: '#s'}]);
element.commitInfo = {};
element.serverConfig = {};
- flushAsynchronousOperations();
+ flush();
const webLinks = element.$.webLinks;
assert.isTrue(weblinksStub.called);
assert.isFalse(webLinks.hasAttribute('hidden'));
@@ -117,7 +117,7 @@
test('weblinks hidden when no weblinks', () => {
element.commitInfo = {};
element.serverConfig = {};
- flushAsynchronousOperations();
+ flush();
const webLinks = element.$.webLinks;
assert.isTrue(webLinks.hasAttribute('hidden'));
});
@@ -125,7 +125,7 @@
test('weblinks hidden when only gitiles weblink', () => {
element.commitInfo = {web_links: [{name: 'gitiles', url: '#'}]};
element.serverConfig = {};
- flushAsynchronousOperations();
+ flush();
const webLinks = element.$.webLinks;
assert.isTrue(webLinks.hasAttribute('hidden'));
assert.equal(element._computeWebLinks(element.commitInfo), null);
@@ -139,7 +139,7 @@
primary_weblink_name: browser,
},
};
- flushAsynchronousOperations();
+ flush();
const webLinks = element.$.webLinks;
assert.isTrue(webLinks.hasAttribute('hidden'));
});
@@ -150,7 +150,7 @@
router._generateWeblinks.bind(router));
element.commitInfo = {web_links: [{name: 'test', url: '#'}]};
- flushAsynchronousOperations();
+ flush();
const webLinks = element.$.webLinks;
assert.isFalse(webLinks.hasAttribute('hidden'));
assert.equal(element._computeWebLinks(element.commitInfo).length, 1);
@@ -167,7 +167,7 @@
element.commitInfo = {
web_links: [{name: 'test', url: '#'}, {name: 'gitiles', url: '#'}]};
- flushAsynchronousOperations();
+ flush();
const webLinks = element.$.webLinks;
assert.isFalse(webLinks.hasAttribute('hidden'));
// Only the non-gitiles weblink is returned.
@@ -524,7 +524,7 @@
test('topic read only hides delete button', () => {
element.account = {};
element.change = change;
- flushAsynchronousOperations();
+ flush();
const button = element.shadowRoot
.querySelector('gr-linked-chip').shadowRoot
.querySelector('gr-button');
@@ -535,7 +535,7 @@
element.account = {test: true};
change.actions.topic.enabled = true;
element.change = change;
- flushAsynchronousOperations();
+ flush();
const button = element.shadowRoot
.querySelector('gr-linked-chip').shadowRoot
.querySelector('gr-button');
@@ -567,7 +567,7 @@
});
test('_computeHashtagReadOnly', () => {
- flushAsynchronousOperations();
+ flush();
let mutable = false;
assert.isTrue(element._computeHashtagReadOnly(mutable, change));
mutable = true;
@@ -579,10 +579,10 @@
});
test('hashtag read only hides delete button', () => {
- flushAsynchronousOperations();
+ flush();
element.account = {};
element.change = change;
- flushAsynchronousOperations();
+ flush();
const button = element.shadowRoot
.querySelector('gr-linked-chip').shadowRoot
.querySelector('gr-button');
@@ -590,11 +590,11 @@
});
test('hashtag not read only does not hide delete button', () => {
- flushAsynchronousOperations();
+ flush();
element.account = {test: true};
change.actions.hashtags.enabled = true;
element.change = change;
- flushAsynchronousOperations();
+ flush();
const button = element.shadowRoot
.querySelector('gr-linked-chip').shadowRoot
.querySelector('gr-button');
@@ -621,7 +621,7 @@
},
removable_reviewers: [],
};
- flushAsynchronousOperations();
+ flush();
});
suite('assignee field', () => {
@@ -719,7 +719,7 @@
});
test('changing hashtag', () => {
- flushAsynchronousOperations();
+ flush();
element._newHashtag = 'new hashtag';
const newHashtag = ['new hashtag'];
sinon.stub(element.$.restAPI, 'setChangeHashtag').returns(
@@ -737,14 +737,14 @@
test('editTopic', () => {
element.account = {test: true};
element.change = {actions: {topic: {enabled: true}}};
- flushAsynchronousOperations();
+ flush();
const label = element.shadowRoot
.querySelector('.topicEditableLabel');
assert.ok(label);
sinon.stub(label, 'open');
element.editTopic();
- flushAsynchronousOperations();
+ flush();
assert.isTrue(label.open.called);
});
diff --git a/polygerrit-ui/app/elements/change/gr-change-requirements/gr-change-requirements_test.js b/polygerrit-ui/app/elements/change/gr-change-requirements/gr-change-requirements_test.js
index d8a90fc..c2fc72d 100644
--- a/polygerrit-ui/app/elements/change/gr-change-requirements/gr-change-requirements_test.js
+++ b/polygerrit-ui/app/elements/change/gr-change-requirements/gr-change-requirements_test.js
@@ -83,13 +83,13 @@
test('optional show/hide', () => {
element._optionalLabels = [{label: 'test'}];
- flushAsynchronousOperations();
+ flush();
assert.ok(element.shadowRoot
.querySelector('section.optional'));
MockInteractions.tap(element.shadowRoot
.querySelector('.showHide'));
- flushAsynchronousOperations();
+ flush();
assert.isFalse(element._showOptionalLabels);
assert.isTrue(isHidden(element.shadowRoot
@@ -106,7 +106,7 @@
},
requirements: [],
};
- flushAsynchronousOperations();
+ flush();
assert.ok(element.shadowRoot
.querySelector('.approved'));
@@ -125,7 +125,7 @@
},
},
};
- flushAsynchronousOperations();
+ flush();
const name = element.shadowRoot
.querySelector('.name');
@@ -141,7 +141,7 @@
requirements: [],
work_in_progress: true,
};
- flushAsynchronousOperations();
+ flush();
const changeIsWip = element.shadowRoot
.querySelector('.title');
@@ -157,7 +157,7 @@
status: 'OK',
}],
};
- flushAsynchronousOperations();
+ flush();
const requirement = element.shadowRoot
.querySelector('.requirement');
@@ -177,7 +177,7 @@
status: 'OK',
}],
};
- flushAsynchronousOperations();
+ flush();
const requirement = element.shadowRoot
.querySelector('.requirement');
@@ -194,7 +194,7 @@
status: 'NOT_READY',
}],
};
- flushAsynchronousOperations();
+ flush();
const requirement = element.shadowRoot
.querySelector('.requirement');
@@ -211,7 +211,7 @@
status: 'RULE_ERROR',
}],
};
- flushAsynchronousOperations();
+ flush();
const requirement = element.shadowRoot
.querySelector('.requirement');
diff --git a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_test.js b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_test.js
index 0fa8e31..4db670f 100644
--- a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_test.js
+++ b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_test.js
@@ -727,7 +727,7 @@
const setModeStub = sinon.stub(element.$.fileListHeader,
'setDiffViewMode');
const e = {preventDefault: () => {}};
- flushAsynchronousOperations();
+ flush();
element.viewState.diffMode = 'SIDE_BY_SIDE';
element._handleToggleDiffMode(e);
@@ -791,7 +791,7 @@
setup(() => {
element._changeNum = '1';
element._change = {_number: '1'};
- flushAsynchronousOperations();
+ flush();
// Fake computeDraftCount as its required for ChangeComments,
// see gr-comment-api#reloadDrafts.
sinon.stub(element.$.commentAPI, 'reloadDrafts')
@@ -854,7 +854,7 @@
test('thread list modified', () => {
sinon.spy(element, '_handleReloadDiffComments');
element._activeTabs = [PrimaryTab.COMMENT_THREADS, SecondaryTab.CHANGE_LOG];
- flushAsynchronousOperations();
+ flush();
return element._reloadComments().then(() => {
element.threadList.dispatchEvent(
@@ -1054,7 +1054,7 @@
const expectedStatuses = ['Merged', 'WIP'];
assert.deepEqual(element._changeStatuses, expectedStatuses);
assert.equal(element._changeStatus, expectedStatuses.join(', '));
- flushAsynchronousOperations();
+ flush();
const statusChips = dom(element.root)
.querySelectorAll('gr-change-status');
assert.equal(statusChips.length, 2);
@@ -1118,14 +1118,14 @@
},
},
};
- flushAsynchronousOperations();
+ flush();
const reloadStub = sinon.stub(element, '_reload');
element.splice('_change.labels.test.all', 0, 1);
assert.isFalse(reloadStub.called);
element._change.labels.test.all.push(vote);
element._change.labels.test.all.push(vote);
element._change.labels.test.approved = vote;
- flushAsynchronousOperations();
+ flush();
element.splice('_change.labels.test.all', 0, 2);
assert.isTrue(reloadStub.called);
assert.isTrue(reloadStub.calledOnce);
@@ -1202,21 +1202,21 @@
assert.equal(element.viewState.numFilesShown, 200);
assert.equal(element._numFilesShown, 200);
element._numFilesShown = 150;
- flushAsynchronousOperations();
+ flush();
assert.equal(element.viewState.diffMode, 'UNIFIED');
assert.equal(element.viewState.numFilesShown, 150);
element._changeNum = '1';
element.params = {changeNum: '1'};
element._change.newProp = '1';
- flushAsynchronousOperations();
+ flush();
assert.equal(element.viewState.diffMode, 'UNIFIED');
assert.equal(element.viewState.changeNum, '1');
element._changeNum = '2';
element.params = {changeNum: '2'};
element._change.newProp = '2';
- flushAsynchronousOperations();
+ flush();
assert.equal(element.viewState.diffMode, 'UNIFIED');
assert.equal(element.viewState.changeNum, '2');
assert.equal(element.viewState.numFilesShown, 200);
@@ -2167,7 +2167,7 @@
const fileList = element.$.fileList;
const Actions = GrEditConstants.Actions;
element.$.fileListHeader.editMode = true;
- flushAsynchronousOperations();
+ flush();
const controls = element.$.fileListHeader
.shadowRoot.querySelector('#editControls');
sinon.stub(controls, 'openDeleteDialog');
@@ -2182,7 +2182,7 @@
bubbles: true,
composed: true,
}));
- flushAsynchronousOperations();
+ flush();
assert.isTrue(controls.openDeleteDialog.called);
assert.equal(controls.openDeleteDialog.lastCall.args[0], 'foo');
@@ -2193,7 +2193,7 @@
bubbles: true,
composed: true,
}));
- flushAsynchronousOperations();
+ flush();
assert.isTrue(controls.openRestoreDialog.called);
assert.equal(controls.openRestoreDialog.lastCall.args[0], 'foo');
@@ -2204,7 +2204,7 @@
bubbles: true,
composed: true,
}));
- flushAsynchronousOperations();
+ flush();
assert.isTrue(controls.openRenameDialog.called);
assert.equal(controls.openRenameDialog.lastCall.args[0], 'foo');
@@ -2215,7 +2215,7 @@
bubbles: true,
composed: true,
}));
- flushAsynchronousOperations();
+ flush();
assert.isTrue(GerritNav.getEditUrlForDiff.called);
assert.equal(GerritNav.getEditUrlForDiff.lastCall.args[1], 'foo');
@@ -2308,7 +2308,7 @@
element.set('_change.revisions.rev2',
{_number: SPECIAL_PATCH_SET_NUM.EDIT});
- flushAsynchronousOperations();
+ flush();
fireEdit();
});
@@ -2323,7 +2323,7 @@
element.set('_change.revisions.rev2', {_number: 2});
element._patchRange = {patchNum: 1};
- flushAsynchronousOperations();
+ flush();
fireEdit();
});
@@ -2339,7 +2339,7 @@
element.set('_change.revisions.rev2', {_number: 2});
element._patchRange = {patchNum: 2};
- flushAsynchronousOperations();
+ flush();
fireEdit();
});
@@ -2439,7 +2439,7 @@
};
element._loggedIn = true;
const stub = sinon.stub(element, '_handleToggleStar');
- flushAsynchronousOperations();
+ flush();
MockInteractions.tap(element.$.changeStar.shadowRoot
.querySelector('button'));
diff --git a/polygerrit-ui/app/elements/change/gr-confirm-cherrypick-dialog/gr-confirm-cherrypick-dialog_test.js b/polygerrit-ui/app/elements/change/gr-confirm-cherrypick-dialog/gr-confirm-cherrypick-dialog_test.js
index 900412a..07f8f63 100644
--- a/polygerrit-ui/app/elements/change/gr-confirm-cherrypick-dialog/gr-confirm-cherrypick-dialog_test.js
+++ b/polygerrit-ui/app/elements/change/gr-confirm-cherrypick-dialog/gr-confirm-cherrypick-dialog_test.js
@@ -52,7 +52,7 @@
element.commitMessage = 'message\n';
element.commitNum = '123';
element.branch = 'master';
- flushAsynchronousOperations();
+ flush();
const expectedMessage = 'message\n(cherry picked from commit 123)';
assert.equal(element.message, expectedMessage);
});
@@ -62,7 +62,7 @@
element.commitMessage = 'message\n';
element.commitNum = '123';
element.branch = 'master';
- flushAsynchronousOperations();
+ flush();
const expectedMessage = 'message\n';
assert.equal(element.message, expectedMessage);
});
@@ -74,7 +74,7 @@
element.branch = 'master';
const myNewMessage = 'updated commit message';
element.message = myNewMessage;
- flushAsynchronousOperations();
+ flush();
assert.equal(element.message, myNewMessage);
});
diff --git a/polygerrit-ui/app/elements/change/gr-confirm-move-dialog/gr-confirm-move-dialog_test.js b/polygerrit-ui/app/elements/change/gr-confirm-move-dialog/gr-confirm-move-dialog_test.js
index 0b9ba2f..43bde75 100644
--- a/polygerrit-ui/app/elements/change/gr-confirm-move-dialog/gr-confirm-move-dialog_test.js
+++ b/polygerrit-ui/app/elements/change/gr-confirm-move-dialog/gr-confirm-move-dialog_test.js
@@ -47,7 +47,7 @@
element.branch = 'master';
const myNewMessage = 'updated commit message';
element.message = myNewMessage;
- flushAsynchronousOperations();
+ flush();
assert.equal(element.message, myNewMessage);
});
diff --git a/polygerrit-ui/app/elements/change/gr-confirm-rebase-dialog/gr-confirm-rebase-dialog_test.js b/polygerrit-ui/app/elements/change/gr-confirm-rebase-dialog/gr-confirm-rebase-dialog_test.js
index 498d31c..8bce572 100644
--- a/polygerrit-ui/app/elements/change/gr-confirm-rebase-dialog/gr-confirm-rebase-dialog_test.js
+++ b/polygerrit-ui/app/elements/change/gr-confirm-rebase-dialog/gr-confirm-rebase-dialog_test.js
@@ -30,7 +30,7 @@
test('controls with parent and rebase on current available', () => {
element.rebaseOnCurrent = true;
element.hasParent = true;
- flushAsynchronousOperations();
+ flush();
assert.isTrue(element.$.rebaseOnParentInput.checked);
assert.isFalse(element.$.rebaseOnParent.hasAttribute('hidden'));
assert.isTrue(element.$.parentUpToDateMsg.hasAttribute('hidden'));
@@ -41,7 +41,7 @@
test('controls with parent rebase on current not available', () => {
element.rebaseOnCurrent = false;
element.hasParent = true;
- flushAsynchronousOperations();
+ flush();
assert.isTrue(element.$.rebaseOnTipInput.checked);
assert.isTrue(element.$.rebaseOnParent.hasAttribute('hidden'));
assert.isFalse(element.$.parentUpToDateMsg.hasAttribute('hidden'));
@@ -52,7 +52,7 @@
test('controls without parent and rebase on current available', () => {
element.rebaseOnCurrent = true;
element.hasParent = false;
- flushAsynchronousOperations();
+ flush();
assert.isTrue(element.$.rebaseOnTipInput.checked);
assert.isTrue(element.$.rebaseOnParent.hasAttribute('hidden'));
assert.isTrue(element.$.parentUpToDateMsg.hasAttribute('hidden'));
@@ -63,7 +63,7 @@
test('controls without parent rebase on current not available', () => {
element.rebaseOnCurrent = false;
element.hasParent = false;
- flushAsynchronousOperations();
+ flush();
assert.isTrue(element.$.rebaseOnOtherInput.checked);
assert.isTrue(element.$.rebaseOnParent.hasAttribute('hidden'));
assert.isTrue(element.$.parentUpToDateMsg.hasAttribute('hidden'));
diff --git a/polygerrit-ui/app/elements/change/gr-confirm-submit-dialog/gr-confirm-submit-dialog_test.js b/polygerrit-ui/app/elements/change/gr-confirm-submit-dialog/gr-confirm-submit-dialog_test.js
index 77331f7..e16ffdb 100644
--- a/polygerrit-ui/app/elements/change/gr-confirm-submit-dialog/gr-confirm-submit-dialog_test.js
+++ b/polygerrit-ui/app/elements/change/gr-confirm-submit-dialog/gr-confirm-submit-dialog_test.js
@@ -33,7 +33,7 @@
subject: 'my-subject',
revisions: {},
};
- flushAsynchronousOperations();
+ flush();
const header = element.shadowRoot
.querySelector('.header');
assert.equal(header.textContent.trim(), 'my-label');
diff --git a/polygerrit-ui/app/elements/change/gr-download-dialog/gr-download-dialog_test.js b/polygerrit-ui/app/elements/change/gr-download-dialog/gr-download-dialog_test.js
index 208b7e2..213c202 100644
--- a/polygerrit-ui/app/elements/change/gr-download-dialog/gr-download-dialog_test.js
+++ b/polygerrit-ui/app/elements/change/gr-download-dialog/gr-download-dialog_test.js
@@ -114,7 +114,7 @@
archives: ['tgz', 'tar', 'tbz2', 'txz'],
};
- flushAsynchronousOperations();
+ flush();
});
test('anchors use download attribute', () => {
@@ -126,7 +126,7 @@
suite('gr-download-dialog tests with no fetch options', () => {
setup(() => {
element.change = getChangeObjectNoFetch();
- flushAsynchronousOperations();
+ flush();
});
test('focuses on first download link if no copy links', () => {
@@ -140,13 +140,13 @@
suite('gr-download-dialog with fetch options', () => {
setup(() => {
element.change = getChangeObject();
- flushAsynchronousOperations();
+ flush();
});
test('focuses on first copy link', () => {
const focusStub = sinon.stub(element.$.downloadCommands, 'focusOnCopy');
element.focus();
- flushAsynchronousOperations();
+ flush();
assert.isTrue(focusStub.called);
focusStub.restore();
});
diff --git a/polygerrit-ui/app/elements/change/gr-file-list-header/gr-file-list-header_test.js b/polygerrit-ui/app/elements/change/gr-file-list-header/gr-file-list-header_test.js
index af59616..d691e87 100644
--- a/polygerrit-ui/app/elements/change/gr-file-list-header/gr-file-list-header_test.js
+++ b/polygerrit-ui/app/elements/change/gr-file-list-header/gr-file-list-header_test.js
@@ -44,20 +44,20 @@
test('Diff preferences hidden when no prefs or diffPrefsDisabled', () => {
element.diffPrefsDisabled = true;
- flushAsynchronousOperations();
+ flush();
assert.isTrue(element.$.diffPrefsContainer.hidden);
element.diffPrefsDisabled = false;
- flushAsynchronousOperations();
+ flush();
assert.isTrue(element.$.diffPrefsContainer.hidden);
element.diffPrefsDisabled = true;
element.diffPrefs = {font_size: '12'};
- flushAsynchronousOperations();
+ flush();
assert.isTrue(element.$.diffPrefsContainer.hidden);
element.diffPrefsDisabled = false;
- flushAsynchronousOperations();
+ flush();
assert.isFalse(element.$.diffPrefsContainer.hidden);
});
@@ -108,7 +108,7 @@
element.owner = {_account_id: 1};
element.loggedIn = true;
- flushAsynchronousOperations();
+ flush();
// The element has a description, so the account chip should be visible
element.owner = {_account_id: 1};
@@ -128,7 +128,7 @@
assert.equal(putDescStub.lastCall.args[2], '');
assert.equal(element.change.revisions.rev1.description, '');
- flushAsynchronousOperations();
+ flush();
// The editable label should now be visible and the chip hidden.
label = element.root.querySelector('#descriptionLabel');
assert.isOk(label);
@@ -139,14 +139,14 @@
label.editing = true;
label._inputText = 'test2';
label._save();
- flushAsynchronousOperations();
+ flush();
// The API stub should be called with an `test2` for the new
// description.
assert.equal(putDescStub.callCount, 2);
assert.equal(putDescStub.lastCall.args[2], 'test2');
})
.then(() => {
- flushAsynchronousOperations();
+ flush();
// The chip should be visible again, and the label hidden.
assert.equal(element.change.revisions.rev1.description, 'test2');
assert.equal(getComputedStyle(label).display, 'none');
@@ -156,7 +156,7 @@
test('expandAllDiffs called when expand button clicked', () => {
element.shownFileCount = 1;
- flushAsynchronousOperations();
+ flush();
sinon.stub(element, '_expandAllDiffs');
MockInteractions.tap(element.root.querySelector(
'#expandBtn'));
@@ -165,7 +165,7 @@
test('collapseAllDiffs called when expand button clicked', () => {
element.shownFileCount = 1;
- flushAsynchronousOperations();
+ flush();
sinon.stub(element, '_collapseAllDiffs');
MockInteractions.tap(element.root.querySelector(
'#collapseBtn'));
@@ -194,33 +194,33 @@
.querySelector('.fileViewActions');
assert.equal(getComputedStyle(actions).display, 'none');
element.filesExpanded = FilesExpandedState.SOME;
- flushAsynchronousOperations();
+ flush();
assert.notEqual(getComputedStyle(actions).display, 'none');
element.filesExpanded = FilesExpandedState.ALL;
- flushAsynchronousOperations();
+ flush();
assert.notEqual(getComputedStyle(actions).display, 'none');
element.filesExpanded = FilesExpandedState.NONE;
- flushAsynchronousOperations();
+ flush();
assert.equal(getComputedStyle(actions).display, 'none');
});
test('expand/collapse buttons are toggled correctly', () => {
element.shownFileCount = 10;
- flushAsynchronousOperations();
+ flush();
const expandBtn = element.shadowRoot.querySelector('#expandBtn');
const collapseBtn = element.shadowRoot.querySelector('#collapseBtn');
assert.notEqual(getComputedStyle(expandBtn).display, 'none');
assert.equal(getComputedStyle(collapseBtn).display, 'none');
element.filesExpanded = FilesExpandedState.SOME;
- flushAsynchronousOperations();
+ flush();
assert.notEqual(getComputedStyle(expandBtn).display, 'none');
assert.equal(getComputedStyle(collapseBtn).display, 'none');
element.filesExpanded = FilesExpandedState.ALL;
- flushAsynchronousOperations();
+ flush();
assert.equal(getComputedStyle(expandBtn).display, 'none');
assert.notEqual(getComputedStyle(collapseBtn).display, 'none');
element.filesExpanded = FilesExpandedState.NONE;
- flushAsynchronousOperations();
+ flush();
assert.notEqual(getComputedStyle(expandBtn).display, 'none');
assert.equal(getComputedStyle(collapseBtn).display, 'none');
});
@@ -270,14 +270,14 @@
test('patch specific elements', () => {
element.editMode = true;
element.allPatchSets = generateChange({revisionsCount: 2}).revisions;
- flushAsynchronousOperations();
+ flush();
assert.isFalse(isVisible(element.$.diffPrefsContainer));
assert.isFalse(isVisible(element.shadowRoot
.querySelector('.descriptionContainer')));
element.editMode = false;
- flushAsynchronousOperations();
+ flush();
assert.isTrue(isVisible(element.shadowRoot
.querySelector('.descriptionContainer')));
@@ -286,19 +286,19 @@
test('edit-controls visibility', () => {
element.editMode = false;
- flushAsynchronousOperations();
+ flush();
// on the first render, when editMode is false, editControls are not
// in the DOM to reduce size of DOM and make first render faster.
assert.isNull(element.shadowRoot
.querySelector('#editControls'));
element.editMode = true;
- flushAsynchronousOperations();
+ flush();
assert.isTrue(isVisible(element.shadowRoot
.querySelector('#editControls').parentElement));
element.editMode = false;
- flushAsynchronousOperations();
+ flush();
assert.isFalse(isVisible(element.shadowRoot
.querySelector('#editControls').parentElement));
});
diff --git a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list_test.js b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list_test.js
index 0343b39..306d0d4 100644
--- a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list_test.js
+++ b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list_test.js
@@ -127,7 +127,7 @@
return _filesByPath;
}, {});
- flushAsynchronousOperations();
+ flush();
assert.equal(
element.root.querySelectorAll('.file-row').length,
element.numFilesShown);
@@ -140,7 +140,7 @@
'Show all 500 files');
MockInteractions.tap(element.$.showAllButton);
- flushAsynchronousOperations();
+ flush();
assert.equal(element.numFilesShown, 500);
assert.equal(element._shownFiles.length, 500);
@@ -154,7 +154,7 @@
_filesByPath['/file' + idx] = {lines_inserted: 9};
return _filesByPath;
}, {});
- flushAsynchronousOperations();
+ flush();
assert.equal(
element.root.querySelectorAll('.file-row').length, 10);
assert.equal(renderedStub.callCount, 10);
@@ -609,7 +609,7 @@
});
test('keyboard shortcuts', () => {
- flushAsynchronousOperations();
+ flush();
const items = element.root.querySelectorAll('.file-row');
element.$.fileCursor.stops = items;
@@ -666,7 +666,7 @@
test('i key shows/hides selected inline diff', () => {
const paths = Object.keys(element._filesByPath);
sinon.stub(element, '_expandedFilesChanged');
- flushAsynchronousOperations();
+ flush();
const files = element.root.querySelectorAll('.file-row');
element.$.fileCursor.stops = files;
element.$.fileCursor.setCursorAtIndex(0);
@@ -674,27 +674,27 @@
assert.equal(element._expandedFiles.length, 0);
MockInteractions.keyUpOn(element, 73, null, 'i');
- flushAsynchronousOperations();
+ flush();
assert.equal(element.diffs.length, 1);
assert.equal(element.diffs[0].path, paths[0]);
assert.equal(element._expandedFiles.length, 1);
assert.equal(element._expandedFiles[0].path, paths[0]);
MockInteractions.keyUpOn(element, 73, null, 'i');
- flushAsynchronousOperations();
+ flush();
assert.equal(element.diffs.length, 0);
assert.equal(element._expandedFiles.length, 0);
element.$.fileCursor.setCursorAtIndex(1);
MockInteractions.keyUpOn(element, 73, null, 'i');
- flushAsynchronousOperations();
+ flush();
assert.equal(element.diffs.length, 1);
assert.equal(element.diffs[0].path, paths[1]);
assert.equal(element._expandedFiles.length, 1);
assert.equal(element._expandedFiles[0].path, paths[1]);
MockInteractions.keyUpOn(element, 73, 'shift', 'i');
- flushAsynchronousOperations();
+ flush();
assert.equal(element.diffs.length, paths.length);
assert.equal(element._expandedFiles.length, paths.length);
for (const index in element.diffs) {
@@ -706,7 +706,7 @@
}
MockInteractions.keyUpOn(element, 73, 'shift', 'i');
- flushAsynchronousOperations();
+ flush();
assert.equal(element.diffs.length, 0);
assert.equal(element._expandedFiles.length, 0);
});
@@ -714,14 +714,14 @@
test('r key toggles reviewed flag', () => {
const reducer = (accum, file) => (file.isReviewed ? ++accum : accum);
const getNumReviewed = () => element._files.reduce(reducer, 0);
- flushAsynchronousOperations();
+ flush();
// Default state should be unreviewed.
assert.equal(getNumReviewed(), 0);
// Press the review key to toggle it (set the flag).
MockInteractions.pressAndReleaseKeyOn(element, 82, null, 'r');
- flushAsynchronousOperations();
+ flush();
assert.equal(getNumReviewed(), 1);
// Press the review key to toggle it (clear the flag).
@@ -830,7 +830,7 @@
const reviewSpy = sinon.spy(element, '_reviewFile');
const toggleExpandSpy = sinon.spy(element, '_toggleFileExpanded');
- flushAsynchronousOperations();
+ flush();
const fileRows =
element.root.querySelectorAll('.row:not(.header-row)');
const checkSelector = 'span.reviewedSwitch[role="switch"]';
@@ -917,7 +917,7 @@
patchNum: '2',
};
element.editMode = true;
- flushAsynchronousOperations();
+ flush();
const clickSpy = sinon.spy(element, '_handleFileListClick');
const toggleExpandSpy = sinon.spy(element, '_toggleFileExpanded');
@@ -939,7 +939,7 @@
};
element.$.fileCursor.setCursorAtIndex(0);
sinon.stub(element, '_expandedFilesChanged');
- flushAsynchronousOperations();
+ flush();
const fileRows =
element.root.querySelectorAll('.row:not(.header-row)');
// Because the label surrounds the input, the tap event is triggered
@@ -966,14 +966,14 @@
};
sinon.spy(element, '_updateDiffPreferences');
element.$.fileCursor.setCursorAtIndex(0);
- flushAsynchronousOperations();
+ flush();
// Tap on a file to generate the diff.
const row = dom(element.root)
.querySelectorAll('.row:not(.header-row) span.show-hide')[0];
MockInteractions.tap(row);
- flushAsynchronousOperations();
+ flush();
const diffDisplay = element.diffs[0];
element._userPrefs = {default_diff_view: 'SIDE_BY_SIDE'};
element.set('diffViewMode', 'UNIFIED_DIFF');
@@ -999,7 +999,7 @@
patchNum: '2',
};
sinon.stub(element, '_expandedFilesChanged');
- flushAsynchronousOperations();
+ flush();
const commitMsgFile = dom(element.root)
.querySelectorAll('.row:not(.header-row) a.pathLink')[0];
@@ -1008,7 +1008,7 @@
const togglePathSpy = sinon.spy(element, '_toggleFileExpanded');
MockInteractions.tap(commitMsgFile);
- flushAsynchronousOperations();
+ flush();
assert(togglePathSpy.notCalled, 'file is opened as diff view');
assert.isNotOk(element.shadowRoot
.querySelector('.expanded'));
@@ -1027,7 +1027,7 @@
.querySelector('iron-icon').icon, 'gr-icons:expand-more');
assert.equal(element._expandedFiles.length, 0);
element._toggleFileExpanded({path});
- flushAsynchronousOperations();
+ flush();
assert.equal(collapseStub.lastCall.args[0].length, 0);
assert.equal(element.shadowRoot
.querySelector('iron-icon').icon, 'gr-icons:expand-less');
@@ -1035,7 +1035,7 @@
assert.equal(renderSpy.callCount, 1);
assert.isTrue(element._expandedFiles.some(f => f.path === path));
element._toggleFileExpanded({path});
- flushAsynchronousOperations();
+ flush();
assert.equal(element.shadowRoot
.querySelector('iron-icon').icon, 'gr-icons:expand-more');
@@ -1054,13 +1054,13 @@
const path = 'path/to/my/file.txt';
element._filesByPath = {[path]: {}};
element.expandAllDiffs();
- flushAsynchronousOperations();
+ flush();
assert.isTrue(element._showInlineDiffs);
assert.isTrue(reInitStub.calledOnce);
assert.equal(collapseStub.lastCall.args[0].length, 0);
element.collapseAllDiffs();
- flushAsynchronousOperations();
+ flush();
assert.equal(element._expandedFiles.length, 0);
assert.isFalse(element._showInlineDiffs);
assert.isTrue(cursorUpdateStub.calledOnce);
@@ -1105,23 +1105,23 @@
'foo.bar': {},
'baz.bar': {},
};
- flushAsynchronousOperations();
+ flush();
assert.equal(element.filesExpanded,
FilesExpandedState.NONE);
element.push('_expandedFiles', {path: 'baz.bar'});
- flushAsynchronousOperations();
+ flush();
assert.equal(element.filesExpanded,
FilesExpandedState.SOME);
element.push('_expandedFiles', {path: 'foo.bar'});
- flushAsynchronousOperations();
+ flush();
assert.equal(element.filesExpanded,
FilesExpandedState.ALL);
element.collapseAllDiffs();
- flushAsynchronousOperations();
+ flush();
assert.equal(element.filesExpanded,
FilesExpandedState.NONE);
element.expandAllDiffs();
- flushAsynchronousOperations();
+ flush();
assert.equal(element.filesExpanded,
FilesExpandedState.ALL);
});
@@ -1585,12 +1585,12 @@
patchNum: '2',
};
sinon.stub(window, 'fetch').callsFake(() => Promise.resolve());
- flushAsynchronousOperations();
+ flush();
});
test('cursor with individually opened files', () => {
MockInteractions.keyUpOn(element, 73, null, 'i');
- flushAsynchronousOperations();
+ flush();
let diffs = renderAndGetNewDiffs(0);
const diffStops = diffs[0].getCursorStops();
@@ -1603,20 +1603,20 @@
// Tapping content on a line selects the line number.
MockInteractions.tap(dom(
diffStops[10]).querySelectorAll('.contentText')[0]);
- flushAsynchronousOperations();
+ flush();
assert.isTrue(diffStops[10].classList.contains('target-row'));
// Keyboard shortcuts are still moving the file cursor, not the diff
// cursor.
MockInteractions.pressAndReleaseKeyOn(element, 74, null, 'j');
- flushAsynchronousOperations();
+ flush();
assert.isTrue(diffStops[10].classList.contains('target-row'));
assert.isFalse(diffStops[11].classList.contains('target-row'));
// The file cursor is now at 1.
assert.equal(element.$.fileCursor.index, 1);
MockInteractions.keyUpOn(element, 73, null, 'i');
- flushAsynchronousOperations();
+ flush();
diffs = renderAndGetNewDiffs(1);
// Two diffs should be rendered.
@@ -1631,7 +1631,7 @@
test('cursor with toggle all files', () => {
MockInteractions.keyUpOn(element, 73, 'shift', 'i');
- flushAsynchronousOperations();
+ flush();
const diffs = renderAndGetNewDiffs(0);
const diffStops = diffs[0].getCursorStops();
@@ -1645,13 +1645,13 @@
// Tapping content on a line selects the line number.
MockInteractions.tap(dom(
diffStops[10]).querySelectorAll('.contentText')[0]);
- flushAsynchronousOperations();
+ flush();
assert.isTrue(diffStops[10].classList.contains('target-row'));
// Keyboard shortcuts are still moving the file cursor, not the diff
// cursor.
MockInteractions.pressAndReleaseKeyOn(element, 74, null, 'j');
- flushAsynchronousOperations();
+ flush();
assert.isFalse(diffStops[10].classList.contains('target-row'));
assert.isTrue(diffStops[11].classList.contains('target-row'));
@@ -1678,7 +1678,7 @@
test('n key with some files expanded and no shift key', () => {
MockInteractions.keyUpOn(fileRows[0], 73, null, 'i');
- flushAsynchronousOperations();
+ flush();
// Handle N key should return before calling diff cursor functions.
MockInteractions.pressAndReleaseKeyOn(element, 78, null, 'n');
@@ -1692,7 +1692,7 @@
test('n key with some files expanded and shift key', () => {
MockInteractions.keyUpOn(fileRows[0], 73, null, 'i');
- flushAsynchronousOperations();
+ flush();
assert.equal(nextChunkStub.callCount, 0);
MockInteractions.pressAndReleaseKeyOn(element, 78, 'shift', 'n');
@@ -1706,7 +1706,7 @@
test('n key without all files expanded and shift key', () => {
MockInteractions.keyUpOn(fileRows[0], 73, 'shift', 'i');
- flushAsynchronousOperations();
+ flush();
MockInteractions.pressAndReleaseKeyOn(element, 78, null, 'n');
assert.isTrue(nKeySpy.called);
@@ -1719,7 +1719,7 @@
test('n key without all files expanded and no shift key', () => {
MockInteractions.keyUpOn(fileRows[0], 73, 'shift', 'i');
- flushAsynchronousOperations();
+ flush();
MockInteractions.pressAndReleaseKeyOn(element, 78, 'shift', 'n');
assert.isTrue(nKeySpy.called);
@@ -1740,7 +1740,7 @@
assert.isFalse(navStub.called);
element.set('_filesByPath', _filesByPath);
- flushAsynchronousOperations();
+ flush();
// Navigates when a file is selected.
element._openSelectedFile();
assert.isTrue(navStub.called);
@@ -1777,7 +1777,7 @@
assert.isTrue(saveReviewStub.calledOnce);
element.editMode = true;
- flushAsynchronousOperations();
+ flush();
MockInteractions.pressAndReleaseKeyOn(element, 82, null, 'r');
assert.isTrue(saveReviewStub.calledOnce);
@@ -1799,7 +1799,7 @@
.querySelector('gr-edit-file-controls'));
element.editMode = true;
- flushAsynchronousOperations();
+ flush();
// Commit message should not have edit controls.
const editControls =
@@ -1814,7 +1814,7 @@
// Expand the commit message diff
MockInteractions.keyUpOn(element, 73, 'shift', 'i');
const diffs = renderAndGetNewDiffs(0);
- flushAsynchronousOperations();
+ flush();
// Two comment threads should be generated by renderAndGetNewDiffs
const threadEls = diffs[0].getThreadEls();
diff --git a/polygerrit-ui/app/elements/change/gr-label-score-row/gr-label-score-row_test.js b/polygerrit-ui/app/elements/change/gr-label-score-row/gr-label-score-row_test.js
index 60fe10c..3c9b7c7 100644
--- a/polygerrit-ui/app/elements/change/gr-label-score-row/gr-label-score-row_test.js
+++ b/polygerrit-ui/app/elements/change/gr-label-score-row/gr-label-score-row_test.js
@@ -104,7 +104,7 @@
MockInteractions.tap(element.shadowRoot
.querySelector(
'gr-button[data-value="-1"]'));
- flushAsynchronousOperations();
+ flush();
assert.strictEqual(element.selectedValue, '-1');
assert.strictEqual(element.selectedItem
.textContent.trim(), '-1');
@@ -234,7 +234,7 @@
};
const selector = element.$.labelSelector;
element.set('label', {name: 'Verified', value: ' 0'});
- flushAsynchronousOperations();
+ flush();
assert.strictEqual(selector.selected, ' 0');
assert.strictEqual(
element.$.selectedValueLabel.textContent.trim(), 'No score');
@@ -249,17 +249,17 @@
'+1',
],
};
- flushAsynchronousOperations();
+ flush();
assert.isOk(element.$.labelSelector);
assert.isFalse(element.$.labelSelector.hidden);
element.permittedLabels = {};
- flushAsynchronousOperations();
+ flush();
assert.isOk(element.$.labelSelector);
assert.isTrue(element.$.labelSelector.hidden);
element.permittedLabels = {Verified: []};
- flushAsynchronousOperations();
+ flush();
assert.isOk(element.$.labelSelector);
assert.isTrue(element.$.labelSelector.hidden);
});
@@ -333,7 +333,7 @@
name: 'Verified',
value: null,
};
- flushAsynchronousOperations();
+ flush();
assert.strictEqual(element.selectedValue, '-1');
checkAriaCheckedValid();
});
@@ -362,7 +362,7 @@
name: 'Code-Review',
value: null,
};
- flushAsynchronousOperations();
+ flush();
assert.isNull(element.selectedValue);
});
});
diff --git a/polygerrit-ui/app/elements/change/gr-message/gr-message_test.js b/polygerrit-ui/app/elements/change/gr-message/gr-message_test.js
index 66b8ed2..2e2b278 100644
--- a/polygerrit-ui/app/elements/change/gr-message/gr-message_test.js
+++ b/polygerrit-ui/app/elements/change/gr-message/gr-message_test.js
@@ -54,7 +54,7 @@
assert.deepEqual(e.detail.message, element.message);
done();
});
- flushAsynchronousOperations();
+ flush();
assert.isFalse(
element.shadowRoot.querySelector('.replyActionContainer').hidden
);
@@ -75,7 +75,7 @@
expanded: true,
};
- flushAsynchronousOperations();
+ flush();
assert.isFalse(element.shadowRoot.querySelector('.deleteBtn').hidden);
});
@@ -99,7 +99,7 @@
assert.isFalse(element.shadowRoot.querySelector('.deleteBtn').disabled);
done();
});
- flushAsynchronousOperations();
+ flush();
MockInteractions.tap(element.shadowRoot.querySelector('.deleteBtn'));
assert.isTrue(element.shadowRoot.querySelector('.deleteBtn').disabled);
});
@@ -216,7 +216,7 @@
id: '47c43261_55aa2c41',
expanded: false,
};
- flushAsynchronousOperations();
+ flush();
const stub = sinon.stub();
element.addEventListener('message-anchor-tap', stub);
const dateEl = element.shadowRoot
@@ -301,7 +301,7 @@
'Code-Review': {max: 2, min: -2},
'Trybot-Label3': {max: 3, min: 0},
};
- flushAsynchronousOperations();
+ flush();
const scoreChips = element.root.querySelectorAll('.score');
assert.equal(scoreChips.length, 3);
@@ -326,7 +326,7 @@
'Code-Review': {max: 2, min: -2},
'Commit-Queue': {max: 3, min: 0},
};
- flushAsynchronousOperations();
+ flush();
const scoreChips = element.root.querySelectorAll('.score');
assert.equal(scoreChips.length, 3);
@@ -373,7 +373,7 @@
expanded: true,
};
- flushAsynchronousOperations();
+ flush();
assert.isTrue(
element.shadowRoot.querySelector('.replyActionContainer').hidden
);
@@ -471,7 +471,7 @@
expanded: true,
};
- flushAsynchronousOperations();
+ flush();
assert.isFalse(
element.shadowRoot.querySelector('.replyActionContainer').hidden
);
@@ -482,7 +482,7 @@
test('reply button shown when message is updated', () => {
element.message = undefined;
- flushAsynchronousOperations();
+ flush();
let replyEl = element.shadowRoot.querySelector('.replyActionContainer');
// We don't even expect the button to show up in the DOM when the message
// is undefined.
@@ -500,7 +500,7 @@
_revision_number: 1,
expanded: true,
};
- flushAsynchronousOperations();
+ flush();
replyEl = element.shadowRoot.querySelector('.replyActionContainer');
assert.isOk(replyEl);
assert.isFalse(replyEl.hidden);
diff --git a/polygerrit-ui/app/elements/change/gr-messages-list/gr-messages-list_test.js b/polygerrit-ui/app/elements/change/gr-messages-list/gr-messages-list_test.js
index 083fe04..c27f9fd 100644
--- a/polygerrit-ui/app/elements/change/gr-messages-list/gr-messages-list_test.js
+++ b/polygerrit-ui/app/elements/change/gr-messages-list/gr-messages-list_test.js
@@ -231,7 +231,7 @@
const scrollToStub = sinon.stub(window, 'scrollTo');
const highlightStub = sinon.stub(element, '_highlightEl');
element.messages = generateRandomMessages(25);
- flushAsynchronousOperations();
+ flush();
assert.isFalse(scrollToStub.called);
assert.isFalse(highlightStub.called);
@@ -266,7 +266,7 @@
}
);
element.messages = messages;
- flushAsynchronousOperations();
+ flush();
const messageElements = getMessages();
assert.equal(messageElements.length, messages.length);
assert.deepEqual(messageElements[1].message, messages[1]);
@@ -285,7 +285,7 @@
},
];
element.messages = messages;
- flushAsynchronousOperations();
+ flush();
const messageElements = getMessages();
// threads
assert.equal(
@@ -413,7 +413,7 @@
const m2 = randomMessage(
{tag: MessageTag.TAG_NEW_WIP_PATCHSET, _revision_number: 2});
element.messages = [m1, m2];
- flushAsynchronousOperations();
+ flush();
assert.isFalse(m1.isImportant);
assert.isTrue(m2.isImportant);
});
@@ -427,7 +427,7 @@
id: '8c19ccc949c6d482b061be6a28e10782abf0e7af',
}];
element.messages = messages;
- flushAsynchronousOperations();
+ flush();
const messageEls = getMessages();
assert.equal(messageEls.length, 1);
assert.equal(messageEls[0].message.message, messages[0].message);
@@ -482,7 +482,7 @@
const toggle = element.root.querySelector('.showAllActivityToggle');
assert.isOk(toggle);
MockInteractions.tap(toggle);
- flushAsynchronousOperations();
+ flush();
const displayedMsgs = element.root.querySelectorAll('gr-message');
assert.equal(displayedMsgs.length, 2);
});
@@ -492,7 +492,7 @@
const toggle = element.root.querySelector('.showAllActivityToggle');
assert.isOk(toggle);
MockInteractions.tap(toggle);
- flushAsynchronousOperations();
+ flush();
const displayedMsgs = element.root.querySelectorAll('gr-message');
assert.equal(displayedMsgs.length, 3);
});
diff --git a/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list_test.js b/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list_test.js
index e4aeccf..d1a6476 100644
--- a/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list_test.js
+++ b/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list_test.js
@@ -505,13 +505,13 @@
});
test('no submitted together changes', () => {
- flushAsynchronousOperations();
+ flush();
assert.include(element.$.submittedTogether.className, 'hidden');
});
test('no non-visible submitted together changes', () => {
element._submittedTogether = {changes: [change]};
- flushAsynchronousOperations();
+ flush();
assert.notInclude(element.$.submittedTogether.className, 'hidden');
assert.isNull(element.shadowRoot
.querySelector('.note'));
@@ -520,7 +520,7 @@
test('no visible submitted together changes', () => {
// Technically this should never happen, but worth asserting the logic.
element._submittedTogether = {changes: [], non_visible_changes: 1};
- flushAsynchronousOperations();
+ flush();
assert.notInclude(element.$.submittedTogether.className, 'hidden');
assert.isNotNull(element.shadowRoot
.querySelector('.note'));
@@ -532,7 +532,7 @@
test('visible and non-visible submitted together changes', () => {
element._submittedTogether = {changes: [change], non_visible_changes: 2};
- flushAsynchronousOperations();
+ flush();
assert.notInclude(element.$.submittedTogether.className, 'hidden');
assert.isNotNull(element.shadowRoot
.querySelector('.note'));
diff --git a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog-it_test.js b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog-it_test.js
index c1272c6..8a4b1f6 100644
--- a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog-it_test.js
+++ b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog-it_test.js
@@ -81,7 +81,7 @@
element = basicFixture.instantiate();
setupElement(element);
// Allow the elements created by dom-repeat to be stamped.
- flushAsynchronousOperations();
+ flush();
});
teardown(() => {
@@ -98,7 +98,7 @@
MockInteractions.tap(element.shadowRoot
.querySelector('gr-button.send'));
assert.isFalse(sendStub.called);
- flushAsynchronousOperations();
+ flush();
element.$.ccs.$.entry.setText('test@test.test');
MockInteractions.tap(element.shadowRoot
diff --git a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog_test.js b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog_test.js
index c70678f..2f6ca92 100644
--- a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog_test.js
+++ b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog_test.js
@@ -120,7 +120,7 @@
// .returns(Promise.resolve({isLatest: true}));
// Allow the elements created by dom-repeat to be stamped.
- flushAsynchronousOperations();
+ flush();
});
function stubSaveReview(jsonResponseProducer) {
@@ -188,7 +188,7 @@
element._newAttentionSet = new Set([314]);
const buttonEl = element.shadowRoot.querySelector('.edit-attention-button');
MockInteractions.tap(buttonEl);
- flushAsynchronousOperations();
+ flush();
stubSaveReview(review => {
assert.isTrue(review.ignore_automatic_attention_set_rules);
@@ -229,7 +229,7 @@
}
element.change = change;
element._reviewers = reviewers.base;
- flushAsynchronousOperations();
+ flush();
element._computeNewAttention(user, reviewers, [], change, draftThreads);
assert.sameMembers([...element._newAttentionSet], expectedIds);
}
@@ -511,7 +511,7 @@
element._ccPendingConfirmation = null;
element._reviewerPendingConfirmation = null;
- flushAsynchronousOperations();
+ flush();
assert.isFalse(isVisible(element.$.reviewerConfirmationOverlay));
// Cause the confirmation dialog to display.
@@ -531,7 +531,7 @@
count: 10,
};
}
- flushAsynchronousOperations();
+ flush();
if (cc) {
assert.deepEqual(
@@ -642,7 +642,7 @@
});
test('_reviewersMutated when account-text-change is fired from ccs', () => {
- flushAsynchronousOperations();
+ flush();
assert.isFalse(element._reviewersMutated);
assert.isTrue(element.$.ccs.allowAnyInput);
assert.isFalse(element.shadowRoot
@@ -777,7 +777,7 @@
test('_focusOn', () => {
sinon.spy(element, '_chooseFocusTarget');
- flushAsynchronousOperations();
+ flush();
const textareaStub = sinon.stub(element.$.textarea, 'async');
const reviewerEntryStub = sinon.stub(element.$.reviewers.focusStart,
'async');
@@ -924,7 +924,7 @@
CC: [],
REVIEWER: [],
};
- flushAsynchronousOperations();
+ flush();
const reviewer1 = makeAccount();
const reviewer2 = makeAccount();
@@ -936,7 +936,7 @@
element._reviewers = [reviewer1, reviewer2, reviewer3];
element._ccs = [cc1, cc2, cc3, cc4];
element.push('_reviewers', cc1);
- flushAsynchronousOperations();
+ flush();
assert.deepEqual(element._reviewers,
[reviewer1, reviewer2, reviewer3, cc1]);
@@ -944,7 +944,7 @@
assert.deepEqual(element._reviewersPendingRemove.CC, [cc1]);
element.push('_reviewers', cc4, cc3);
- flushAsynchronousOperations();
+ flush();
assert.deepEqual(element._reviewers,
[reviewer1, reviewer2, reviewer3, cc1, cc4, cc3]);
@@ -959,7 +959,7 @@
element.draftCommentThreads = [];
MockInteractions.tap(
element.shadowRoot.querySelector('.edit-attention-button'));
- flushAsynchronousOperations();
+ flush();
assert.isTrue(element._attentionModified);
let accountLabels = Array.from(element.shadowRoot.querySelectorAll(
@@ -968,7 +968,7 @@
element.push('_reviewers', makeAccount());
element.push('_ccs', makeAccount());
- flushAsynchronousOperations();
+ flush();
// The 'attention modified' section collapses and resets when reviewers or
// ccs change.
@@ -976,7 +976,7 @@
MockInteractions.tap(
element.shadowRoot.querySelector('.edit-attention-button'));
- flushAsynchronousOperations();
+ flush();
assert.isTrue(element._attentionModified);
accountLabels = Array.from(element.shadowRoot.querySelectorAll(
@@ -990,7 +990,7 @@
MockInteractions.tap(
element.shadowRoot.querySelector('.edit-attention-button'));
- flushAsynchronousOperations();
+ flush();
accountLabels = Array.from(element.shadowRoot.querySelectorAll(
'.attention-detail gr-account-label'));
@@ -1002,7 +1002,7 @@
CC: [],
REVIEWER: [],
};
- flushAsynchronousOperations();
+ flush();
const reviewer1 = makeAccount();
const reviewer2 = makeAccount();
@@ -1014,7 +1014,7 @@
element._reviewers = [reviewer1, reviewer2, reviewer3];
element._ccs = [cc1, cc2, cc3, cc4];
element.push('_ccs', reviewer1);
- flushAsynchronousOperations();
+ flush();
assert.deepEqual(element._reviewers,
[reviewer2, reviewer3]);
@@ -1022,7 +1022,7 @@
assert.deepEqual(element._reviewersPendingRemove.REVIEWER, [reviewer1]);
element.push('_ccs', reviewer3, reviewer2);
- flushAsynchronousOperations();
+ flush();
assert.deepEqual(element._reviewers, []);
assert.deepEqual(element._ccs,
@@ -1036,7 +1036,7 @@
CC: [],
REVIEWER: [],
};
- flushAsynchronousOperations();
+ flush();
const reviewers = element.$.reviewers;
const ccs = element.$.ccs;
const reviewer1 = makeAccount();
@@ -1124,7 +1124,7 @@
const cancelHandler = sinon.spy();
element.addEventListener('cancel', cancelHandler);
MockInteractions.pressAndReleaseKeyOn(element, 27, null, 'esc');
- flushAsynchronousOperations();
+ flush();
assert.isTrue(cancelHandler.called);
});
@@ -1133,14 +1133,14 @@
stubSaveReview(() => undefined);
element.addEventListener('send', () => assert.fail('wrongly called'));
MockInteractions.pressAndReleaseKeyOn(element, 13, null, 'enter');
- flushAsynchronousOperations();
+ flush();
});
test('emit send on ctrl+enter key', done => {
stubSaveReview(() => undefined);
element.addEventListener('send', () => done());
MockInteractions.pressAndReleaseKeyOn(element, 13, 'ctrl', 'enter');
- flushAsynchronousOperations();
+ flush();
});
test('_computeMessagePlaceholder', () => {
@@ -1262,20 +1262,20 @@
sendStub = sinon.stub(element, 'send').callsFake(() => Promise.resolve());
element.canBeStarted = true;
// Flush to make both Start/Save buttons appear in DOM.
- flushAsynchronousOperations();
+ flush();
});
test('start review sets ready', () => {
MockInteractions.tap(element.shadowRoot
.querySelector('.send'));
- flushAsynchronousOperations();
+ flush();
assert.isTrue(sendStub.calledWith(true, true));
});
test('save review doesn\'t set ready', () => {
MockInteractions.tap(element.shadowRoot
.querySelector('.save'));
- flushAsynchronousOperations();
+ flush();
assert.isTrue(sendStub.calledWith(true, false));
});
});
@@ -1502,7 +1502,7 @@
// resolving.
sinon.stub(element, '_purgeReviewersPendingRemove');
element.draftCommentThreads = [];
- flushAsynchronousOperations();
+ flush();
MockInteractions.tap(element.shadowRoot
.querySelector('gr-button.send'));
@@ -1511,7 +1511,7 @@
element.draftCommentThreads = [{comments: [
{__draft: true, path: 'test', line: 1, patch_set: 1},
]}];
- flushAsynchronousOperations();
+ flush();
MockInteractions.tap(element.shadowRoot
.querySelector('gr-button.send'));
diff --git a/polygerrit-ui/app/elements/change/gr-reviewer-list/gr-reviewer-list_test.js b/polygerrit-ui/app/elements/change/gr-reviewer-list/gr-reviewer-list_test.js
index 834cc43..ad9af30 100644
--- a/polygerrit-ui/app/elements/change/gr-reviewer-list/gr-reviewer-list_test.js
+++ b/polygerrit-ui/app/elements/change/gr-reviewer-list/gr-reviewer-list_test.js
@@ -96,7 +96,7 @@
},
],
};
- flushAsynchronousOperations();
+ flush();
const chips =
element.root.querySelectorAll('gr-account-chip');
assert.equal(chips.length, 4);
diff --git a/polygerrit-ui/app/elements/change/gr-thread-list/gr-thread-list_test.js b/polygerrit-ui/app/elements/change/gr-thread-list/gr-thread-list_test.js
index df4850c..000aa88 100644
--- a/polygerrit-ui/app/elements/change/gr-thread-list/gr-thread-list_test.js
+++ b/polygerrit-ui/app/elements/change/gr-thread-list/gr-thread-list_test.js
@@ -295,7 +295,7 @@
test('onlyShowRobotCommentsWithHumanReply ', () => {
element.onlyShowRobotCommentsWithHumanReply = true;
- flushAsynchronousOperations();
+ flush();
assert.equal(
getVisibleThreads().length,
element.threads.length - 1);
@@ -457,7 +457,7 @@
detail: {rootId: 'rc2'},
composed: true, bubbles: true,
}));
- flushAsynchronousOperations();
+ flush();
assert.equal(element._sortedThreads.length, 8);
const expectedSortedRootIds = [
'patchset_level_2',
@@ -538,13 +538,13 @@
test('toggle unresolved only shows unresolved comments', () => {
MockInteractions.tap(element.shadowRoot.querySelector(
'#unresolvedToggle'));
- flushAsynchronousOperations();
+ flush();
assert.equal(getVisibleThreads().length, 4);
});
test('toggle drafts only shows threads with draft comments', () => {
MockInteractions.tap(element.shadowRoot.querySelector('#draftToggle'));
- flushAsynchronousOperations();
+ flush();
assert.equal(getVisibleThreads().length, 2);
});
@@ -560,7 +560,7 @@
MockInteractions.tap(element.shadowRoot.querySelector('#draftToggle'));
MockInteractions.tap(element.shadowRoot.querySelector(
'#unresolvedToggle'));
- flushAsynchronousOperations();
+ flush();
assert.equal(getVisibleThreads().length, 2);
});
@@ -569,7 +569,7 @@
MockInteractions.tap(element.shadowRoot.querySelector('#draftToggle'));
MockInteractions.tap(element.shadowRoot.querySelector(
'#unresolvedToggle'));
- flushAsynchronousOperations();
+ flush();
assert.equal(getVisibleThreads().length, 1);
});
diff --git a/polygerrit-ui/app/elements/core/gr-error-manager/gr-error-manager_test.js b/polygerrit-ui/app/elements/core/gr-error-manager/gr-error-manager_test.js
index a4f8815..f13276f 100644
--- a/polygerrit-ui/app/elements/core/gr-error-manager/gr-error-manager_test.js
+++ b/polygerrit-ui/app/elements/core/gr-error-manager/gr-error-manager_test.js
@@ -496,7 +496,7 @@
detail: {message},
composed: true, bubbles: true,
}));
- flushAsynchronousOperations();
+ flush();
assert.isTrue(openStub.called);
assert.isTrue(reportStub.called);
@@ -506,7 +506,7 @@
new CustomEvent('dismiss', {
composed: true, bubbles: true,
}));
- flushAsynchronousOperations();
+ flush();
assert.isTrue(closeStub.called);
});
diff --git a/polygerrit-ui/app/elements/core/gr-keyboard-shortcuts-dialog/gr-keyboard-shortcuts-dialog_test.js b/polygerrit-ui/app/elements/core/gr-keyboard-shortcuts-dialog/gr-keyboard-shortcuts-dialog_test.js
index cb7e87b8..f76041e 100644
--- a/polygerrit-ui/app/elements/core/gr-keyboard-shortcuts-dialog/gr-keyboard-shortcuts-dialog_test.js
+++ b/polygerrit-ui/app/elements/core/gr-keyboard-shortcuts-dialog/gr-keyboard-shortcuts-dialog_test.js
@@ -30,7 +30,7 @@
function update(directory) {
element._onDirectoryUpdated(directory);
- flushAsynchronousOperations();
+ flush();
}
suite('_left and _right contents', () => {
diff --git a/polygerrit-ui/app/elements/core/gr-main-header/gr-main-header_test.js b/polygerrit-ui/app/elements/core/gr-main-header/gr-main-header_test.js
index 68ac1b2..48194a6 100644
--- a/polygerrit-ui/app/elements/core/gr-main-header/gr-main-header_test.js
+++ b/polygerrit-ui/app/elements/core/gr-main-header/gr-main-header_test.js
@@ -51,7 +51,7 @@
.querySelector('.registerButton')).display,
'none');
element._account = {};
- flushAsynchronousOperations();
+ flush();
assert.equal(getComputedStyle(element.shadowRoot
.querySelector('gr-account-dropdown')).display,
'none');
diff --git a/polygerrit-ui/app/elements/diff/gr-diff-selection/gr-diff-selection_test.js b/polygerrit-ui/app/elements/diff/gr-diff-selection/gr-diff-selection_test.js
index c37ac93..5c9fe3f 100644
--- a/polygerrit-ui/app/elements/diff/gr-diff-selection/gr-diff-selection_test.js
+++ b/polygerrit-ui/app/elements/diff/gr-diff-selection/gr-diff-selection_test.js
@@ -382,7 +382,7 @@
test('cache is reset when diff changes', () => {
element._linesCache = {left: 'test', right: 'test'};
element.diff = {};
- flushAsynchronousOperations();
+ flush();
assert.deepEqual(element._linesCache, {left: null, right: null});
});
});
diff --git a/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view_test.js b/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view_test.js
index 62963c8..7f8cb3b 100644
--- a/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view_test.js
+++ b/polygerrit-ui/app/elements/diff/gr-diff-view/gr-diff-view_test.js
@@ -397,7 +397,7 @@
test('shift+x shortcut expands all diff context', () => {
const expandStub = sinon.stub(element.$.diffHost, 'expandAllContext');
MockInteractions.pressAndReleaseKeyOn(element, 88, 'shift', 'x');
- flushAsynchronousOperations();
+ flush();
assert.isTrue(expandStub.called);
});
@@ -738,20 +738,20 @@
test('when no prefs or logged out', () => {
element.disableDiffPrefs = false;
element._loggedIn = false;
- flushAsynchronousOperations();
+ flush();
assert.isTrue(element.$.diffPrefsContainer.hidden);
element._loggedIn = true;
- flushAsynchronousOperations();
+ flush();
assert.isTrue(element.$.diffPrefsContainer.hidden);
element._loggedIn = false;
element._prefs = {font_size: '12'};
- flushAsynchronousOperations();
+ flush();
assert.isTrue(element.$.diffPrefsContainer.hidden);
element._loggedIn = true;
- flushAsynchronousOperations();
+ flush();
assert.isFalse(element.$.diffPrefsContainer.hidden);
});
@@ -759,11 +759,11 @@
element._loggedIn = true;
element._prefs = {font_size: '12'};
element.disableDiffPrefs = false;
- flushAsynchronousOperations();
+ flush();
assert.isFalse(element.$.diffPrefsContainer.hidden);
element.disableDiffPrefs = true;
- flushAsynchronousOperations();
+ flush();
assert.isTrue(element.$.diffPrefsContainer.hidden);
});
@@ -897,7 +897,7 @@
element._files = getFilesFromFileList(
['chell.go', 'glados.txt', 'wheatley.md']);
element._path = 'glados.txt';
- flushAsynchronousOperations();
+ flush();
const linkEls = element.root.querySelectorAll('.navLink');
assert.equal(linkEls.length, 3);
assert.equal(linkEls[0].getAttribute('href'), '42-chell.go-10-PARENT');
@@ -905,19 +905,19 @@
assert.equal(linkEls[2].getAttribute('href'),
'42-wheatley.md-10-PARENT');
element._path = 'wheatley.md';
- flushAsynchronousOperations();
+ flush();
assert.equal(linkEls[0].getAttribute('href'),
'42-glados.txt-10-PARENT');
assert.equal(linkEls[1].getAttribute('href'), '42-undefined-undefined');
assert.isFalse(linkEls[2].hasAttribute('href'));
element._path = 'chell.go';
- flushAsynchronousOperations();
+ flush();
assert.isFalse(linkEls[0].hasAttribute('href'));
assert.equal(linkEls[1].getAttribute('href'), '42-undefined-undefined');
assert.equal(linkEls[2].getAttribute('href'),
'42-glados.txt-10-PARENT');
element._path = 'not_a_real_file';
- flushAsynchronousOperations();
+ flush();
assert.equal(linkEls[0].getAttribute('href'),
'42-wheatley.md-10-PARENT');
assert.equal(linkEls[1].getAttribute('href'), '42-undefined-undefined');
@@ -940,19 +940,19 @@
element._files = getFilesFromFileList(
['chell.go', 'glados.txt', 'wheatley.md']);
element._path = 'glados.txt';
- flushAsynchronousOperations();
+ flush();
const linkEls = element.root.querySelectorAll('.navLink');
assert.equal(linkEls.length, 3);
assert.equal(linkEls[0].getAttribute('href'), '42-chell.go-10-5');
assert.equal(linkEls[1].getAttribute('href'), '42-10-5');
assert.equal(linkEls[2].getAttribute('href'), '42-wheatley.md-10-5');
element._path = 'wheatley.md';
- flushAsynchronousOperations();
+ flush();
assert.equal(linkEls[0].getAttribute('href'), '42-glados.txt-10-5');
assert.equal(linkEls[1].getAttribute('href'), '42-10-5');
assert.isFalse(linkEls[2].hasAttribute('href'));
element._path = 'chell.go';
- flushAsynchronousOperations();
+ flush();
assert.isFalse(linkEls[0].hasAttribute('href'));
assert.equal(linkEls[1].getAttribute('href'), '42-10-5');
assert.equal(linkEls[2].getAttribute('href'), '42-glados.txt-10-5');
@@ -1001,13 +1001,13 @@
basePatchNum: '1',
};
element._prefs = {manual_review: true};
- flushAsynchronousOperations();
+ flush();
assert.isFalse(saveReviewedStub.called);
assert.isTrue(getReviewedStub.called);
element._prefs = {};
- flushAsynchronousOperations();
+ flush();
assert.isTrue(saveReviewedStub.called);
assert.isTrue(getReviewedStub.calledOnce);
@@ -1031,7 +1031,7 @@
basePatchNum: '1',
};
element._prefs = {};
- flushAsynchronousOperations();
+ flush();
const commitMsg = element.root.querySelector(
'input[type="checkbox"]');
@@ -1047,7 +1047,7 @@
const callCount = saveReviewedStub.callCount;
element.set('params.view', GerritNav.View.CHANGE);
- flushAsynchronousOperations();
+ flush();
// saveReviewedState observer observes params, but should not fire when
// view !== GerritNav.View.DIFF.
@@ -1058,7 +1058,7 @@
const saveReviewedStub = sinon.stub(element, '_saveReviewedState');
element._patchRange = {patchNum: SPECIAL_PATCH_SET_NUM.EDIT};
- flushAsynchronousOperations();
+ flush();
assert.isTrue(element._editMode);
element._setReviewed();
@@ -1120,14 +1120,14 @@
// Attach a new gr-diff-view so we can intercept the preferences fetch.
const view = document.createElement('gr-diff-view');
blankFixture.instantiate().appendChild(view);
- flushAsynchronousOperations();
+ flush();
// At this point the diff mode doesn't yet have the user's preference.
assert.equal(view._getDiffViewMode(), 'SIDE_BY_SIDE');
// Receive the overriding preference.
resolvePrefs({default_diff_view: 'UNIFIED'});
- flushAsynchronousOperations();
+ flush();
assert.equal(element._getDiffViewMode(), 'SIDE_BY_SIDE');
});
@@ -1525,7 +1525,7 @@
// Reviewed checkbox should be shown.
assert.isTrue(isVisible(element.$.reviewed));
element.set('_patchRange.patchNum', SPECIAL_PATCH_SET_NUM.EDIT);
- flushAsynchronousOperations();
+ flush();
assert.isFalse(isVisible(element.$.reviewed));
});
@@ -1551,7 +1551,7 @@
const reviewedStub = sinon.stub(element, '_setReviewed');
const navStub = sinon.stub(element, '_navToFile');
MockInteractions.pressAndReleaseKeyOn(element, 77, 'shift', 'm');
- flushAsynchronousOperations();
+ flush();
assert.isTrue(reviewedStub.lastCall.args[0]);
assert.deepEqual(navStub.lastCall.args, [
@@ -1578,7 +1578,7 @@
patchNum: 1,
basePatchNum: 'PARENT',
};
- flushAsynchronousOperations();
+ flush();
assert.isTrue(GerritNav.navigateToDiff.notCalled);
// Switch to file2
diff --git a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff_test.js b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff_test.js
index 901bd98..36b3b8f 100644
--- a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff_test.js
+++ b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff_test.js
@@ -77,14 +77,14 @@
test('line limit with line_wrapping', () => {
element = basicFixture.instantiate();
element.prefs = {...MINIMAL_PREFS, line_wrapping: true};
- flushAsynchronousOperations();
+ flush();
assert.equal(getComputedStyleValue('--line-limit', element), '80ch');
});
test('line limit without line_wrapping', () => {
element = basicFixture.instantiate();
element.prefs = {...MINIMAL_PREFS, line_wrapping: false};
- flushAsynchronousOperations();
+ flush();
assert.isNotOk(getComputedStyleValue('--line-limit', element));
});
@@ -605,7 +605,7 @@
};
element._renderDiffTable();
- flushAsynchronousOperations();
+ flush();
};
test('getCursorStops returns [] when hidden and noAutoRender', () => {
@@ -753,7 +753,7 @@
assert.equal(element._diffHeaderItems.length, 0);
element.push('diff.diff_header', 'test');
assert.equal(element._diffHeaderItems.length, 1);
- flushAsynchronousOperations();
+ flush();
assert.equal(element.$.diffHeader.textContent.trim(), 'test');
});
@@ -1012,7 +1012,7 @@
binary,
};
element._renderDiffTable();
- flushAsynchronousOperations();
+ flush();
};
test('clear diff table content as soon as diff changes', () => {
@@ -1032,7 +1032,7 @@
// immediately cleaned up
assert.equal(element.$.diffTable.innerHTML, '');
element._renderDiffTable();
- flushAsynchronousOperations();
+ flush();
// rendered again
assertDiffTableWithContent();
});
@@ -1049,7 +1049,7 @@
],
}];
setupSampleDiff({content});
- flushAsynchronousOperations();
+ flush();
const diffLine = element.shadowRoot.querySelectorAll('.contentText')[2];
assert.equal(getComputedStyle(diffLine).userSelect, 'none');
// click to mark it as selected
@@ -1069,7 +1069,7 @@
}];
setupSampleDiff({content});
element.viewMode = 'UNIFIED_DIFF';
- flushAsynchronousOperations();
+ flush();
const diffLine = element.shadowRoot.querySelectorAll('.contentText')[2];
assert.equal(getComputedStyle(diffLine).userSelect, 'none');
MockInteractions.tap(diffLine);
diff --git a/polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select_test.js b/polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select_test.js
index 782ffc5..2d0924a 100644
--- a/polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select_test.js
+++ b/polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select_test.js
@@ -185,7 +185,7 @@
];
element.patchNum = 2;
element.basePatchNum = 'PARENT';
- flushAsynchronousOperations();
+ flush();
sinon.stub(element, '_computeBaseDropdownContent');
@@ -211,7 +211,7 @@
];
element.patchNum = 2;
element.basePatchNum = 'PARENT';
- flushAsynchronousOperations();
+ flush();
// Should be recomputed for each available patch
sinon.stub(element, '_computeBaseDropdownContent');
@@ -239,7 +239,7 @@
];
element.patchNum = 2;
element.basePatchNum = 'PARENT';
- flushAsynchronousOperations();
+ flush();
// Should be recomputed for each available patch
sinon.stub(element, '_computePatchDropdownContent');
@@ -263,7 +263,7 @@
];
element.patchNum = 2;
element.basePatchNum = 'PARENT';
- flushAsynchronousOperations();
+ flush();
// Should be recomputed for each available patch
sinon.stub(element, '_computePatchDropdownContent');
@@ -345,7 +345,7 @@
},
],
};
- flushAsynchronousOperations();
+ flush();
const domApi = dom(element.root);
assert.equal(
domApi.querySelector('a[href="f.oo"]').textContent, 'foo');
diff --git a/polygerrit-ui/app/elements/documentation/gr-documentation-search/gr-documentation-search_test.js b/polygerrit-ui/app/elements/documentation/gr-documentation-search/gr-documentation-search_test.js
index b90d58f..d763c6f 100644
--- a/polygerrit-ui/app/elements/documentation/gr-documentation-search/gr-documentation-search_test.js
+++ b/polygerrit-ui/app/elements/documentation/gr-documentation-search/gr-documentation-search_test.js
@@ -94,7 +94,7 @@
element._loading = false;
element._repos = _.times(25, documentationGenerator);
- flushAsynchronousOperations();
+ flush();
assert.equal(element.computeLoadingClass(element._loading), '');
assert.equal(getComputedStyle(element.$.loading).display, 'none');
});
diff --git a/polygerrit-ui/app/elements/edit/gr-edit-controls/gr-edit-controls_test.js b/polygerrit-ui/app/elements/edit/gr-edit-controls/gr-edit-controls_test.js
index f997e3a..98d1545 100644
--- a/polygerrit-ui/app/elements/edit/gr-edit-controls/gr-edit-controls_test.js
+++ b/polygerrit-ui/app/elements/edit/gr-edit-controls/gr-edit-controls_test.js
@@ -40,7 +40,7 @@
sinon.stub(element, '_hideAllDialogs');
queryStub = sinon.stub(element.$.restAPI, 'queryChangeFiles')
.returns(Promise.resolve([]));
- flushAsynchronousOperations();
+ flush();
});
teardown(() => {
@@ -141,7 +141,7 @@
assert.isFalse(element.$.deleteDialog.disabled);
MockInteractions.tap(element.$.deleteDialog.shadowRoot
.querySelector('gr-button[primary]'));
- flushAsynchronousOperations();
+ flush();
assert.isTrue(deleteStub.called);
@@ -168,7 +168,7 @@
assert.isFalse(element.$.deleteDialog.disabled);
MockInteractions.tap(element.$.deleteDialog.shadowRoot
.querySelector('gr-button[primary]'));
- flushAsynchronousOperations();
+ flush();
assert.isTrue(deleteStub.called);
@@ -230,7 +230,7 @@
assert.isFalse(element.$.renameDialog.disabled);
MockInteractions.tap(element.$.renameDialog.shadowRoot
.querySelector('gr-button[primary]'));
- flushAsynchronousOperations();
+ flush();
assert.isTrue(renameStub.called);
@@ -262,7 +262,7 @@
assert.isFalse(element.$.renameDialog.disabled);
MockInteractions.tap(element.$.renameDialog.shadowRoot
.querySelector('gr-button[primary]'));
- flushAsynchronousOperations();
+ flush();
assert.isTrue(renameStub.called);
@@ -313,7 +313,7 @@
return showDialogSpy.lastCall.returnValue.then(() => {
MockInteractions.tap(element.$.restoreDialog.shadowRoot
.querySelector('gr-button[primary]'));
- flushAsynchronousOperations();
+ flush();
assert.isTrue(restoreStub.called);
assert.equal(restoreStub.lastCall.args[1], 'src/test.cpp');
@@ -332,7 +332,7 @@
return showDialogSpy.lastCall.returnValue.then(() => {
MockInteractions.tap(element.$.restoreDialog.shadowRoot
.querySelector('gr-button[primary]'));
- flushAsynchronousOperations();
+ flush();
assert.isTrue(restoreStub.called);
assert.equal(restoreStub.lastCall.args[1], 'src/test.cpp');
@@ -402,20 +402,20 @@
element.addEventListener('tap', element._getDialogFromEvent);
MockInteractions.tap(element.$.openDialog);
- flushAsynchronousOperations();
+ flush();
assert.equal(spy.lastCall.returnValue.id, 'openDialog');
MockInteractions.tap(element.$.deleteDialog);
- flushAsynchronousOperations();
+ flush();
assert.equal(spy.lastCall.returnValue.id, 'deleteDialog');
MockInteractions.tap(
element.$.deleteDialog.querySelector('gr-autocomplete'));
- flushAsynchronousOperations();
+ flush();
assert.equal(spy.lastCall.returnValue.id, 'deleteDialog');
MockInteractions.tap(element);
- flushAsynchronousOperations();
+ flush();
assert.notOk(spy.lastCall.returnValue);
});
});
diff --git a/polygerrit-ui/app/elements/edit/gr-edit-file-controls/gr-edit-file-controls_test.js b/polygerrit-ui/app/elements/edit/gr-edit-file-controls/gr-edit-file-controls_test.js
index 8a1c186..180a3a4 100644
--- a/polygerrit-ui/app/elements/edit/gr-edit-file-controls/gr-edit-file-controls_test.js
+++ b/polygerrit-ui/app/elements/edit/gr-edit-file-controls/gr-edit-file-controls_test.js
@@ -37,7 +37,7 @@
const actions = element.$.actions;
element.filePath = 'foo';
actions._open();
- flushAsynchronousOperations();
+ flush();
MockInteractions.tap(actions.shadowRoot
.querySelector('li [data-id="open"]'));
@@ -50,7 +50,7 @@
const actions = element.$.actions;
element.filePath = 'foo';
actions._open();
- flushAsynchronousOperations();
+ flush();
MockInteractions.tap(actions.shadowRoot
.querySelector('li [data-id="delete"]'));
@@ -63,7 +63,7 @@
const actions = element.$.actions;
element.filePath = 'foo';
actions._open();
- flushAsynchronousOperations();
+ flush();
MockInteractions.tap(actions.shadowRoot
.querySelector('li [data-id="restore"]'));
@@ -76,7 +76,7 @@
const actions = element.$.actions;
element.filePath = 'foo';
actions._open();
- flushAsynchronousOperations();
+ flush();
MockInteractions.tap(actions.shadowRoot
.querySelector('li [data-id="rename"]'));
diff --git a/polygerrit-ui/app/elements/edit/gr-editor-view/gr-editor-view_test.js b/polygerrit-ui/app/elements/edit/gr-editor-view/gr-editor-view_test.js
index d8f130c..f2dc7f2 100644
--- a/polygerrit-ui/app/elements/edit/gr-editor-view/gr-editor-view_test.js
+++ b/polygerrit-ui/app/elements/edit/gr-editor-view/gr-editor-view_test.js
@@ -66,7 +66,7 @@
const promises = element._paramsChanged(
{...mockParams, view: GerritNav.View.EDIT});
- flushAsynchronousOperations();
+ flush();
assert.equal(element._changeNum, mockParams.changeNum);
assert.equal(element._path, mockParams.path);
assert.deepEqual(changeDetailStub.lastCall.args[0],
@@ -112,7 +112,7 @@
detail: {value: 'new content value'},
}));
element.flushDebouncer('store');
- flushAsynchronousOperations();
+ flush();
assert.equal(element._newContent, 'new content value');
assert.isTrue(storeStub.called);
@@ -128,7 +128,7 @@
element._path = mockParams.path;
element._content = originalText;
element._newContent = originalText;
- flushAsynchronousOperations();
+ flush();
});
test('initial load', () => {
@@ -143,7 +143,7 @@
const alertStub = sinon.stub(element, '_showAlert');
saveFileStub.returns(Promise.resolve({ok: false}));
element._newContent = newText;
- flushAsynchronousOperations();
+ flush();
assert.isFalse(element.$.save.hasAttribute('disabled'));
assert.isFalse(element._saving);
@@ -172,7 +172,7 @@
const alertStub = sinon.stub(element, '_showAlert');
saveFileStub.returns(Promise.resolve({ok: true}));
element._newContent = newText;
- flushAsynchronousOperations();
+ flush();
assert.isFalse(element._saving);
assert.isFalse(element.$.save.hasAttribute('disabled'));
@@ -197,7 +197,7 @@
test('file modification and close', () => {
const closeSpy = sinon.spy(element, '_handleCloseTap');
element._newContent = newText;
- flushAsynchronousOperations();
+ flush();
assert.isFalse(element.$.save.hasAttribute('disabled'));
@@ -312,13 +312,13 @@
element._content = '';
element._newContent = '_test';
MockInteractions.pressAndReleaseKeyOn(element, 83, 'ctrl', 's');
- flushAsynchronousOperations();
+ flush();
assert.isTrue(handleSpy.calledOnce);
assert.isTrue(saveStub.calledOnce);
MockInteractions.pressAndReleaseKeyOn(element, 83, 'meta', 's');
- flushAsynchronousOperations();
+ flush();
assert.equal(handleSpy.callCount, 2);
assert.equal(saveStub.callCount, 2);
@@ -326,13 +326,13 @@
test('save disabled', () => {
MockInteractions.pressAndReleaseKeyOn(element, 83, 'ctrl', 's');
- flushAsynchronousOperations();
+ flush();
assert.isTrue(handleSpy.calledOnce);
assert.isFalse(saveStub.called);
MockInteractions.pressAndReleaseKeyOn(element, 83, 'meta', 's');
- flushAsynchronousOperations();
+ flush();
assert.equal(handleSpy.callCount, 2);
assert.isFalse(saveStub.called);
@@ -355,7 +355,7 @@
element.addEventListener('show-alert', alertStub);
return element._getFileData(1, 'test', 1).then(() => {
- flushAsynchronousOperations();
+ flush();
assert.isTrue(alertStub.called);
assert.equal(element._newContent, 'pending edit');
@@ -378,7 +378,7 @@
element.addEventListener('show-alert', alertStub);
return element._getFileData(1, 'test', 1).then(() => {
- flushAsynchronousOperations();
+ flush();
assert.isFalse(alertStub.called);
assert.equal(element._newContent, 'pending edit');
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
index e56278f..25c0d43 100644
--- 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
@@ -54,7 +54,7 @@
addListener(element.parentElement, 'tap', tapStub);
instance.onTap(() => false);
MockInteractions.tap(element);
- flushAsynchronousOperations();
+ flush();
assert.isFalse(tapStub.called);
});
@@ -63,7 +63,7 @@
element.parentElement.addEventListener('click', tapStub);
instance.onTap(() => false);
MockInteractions.tap(element);
- flushAsynchronousOperations();
+ flush();
assert.isFalse(tapStub.called);
});
@@ -86,7 +86,7 @@
addListener(element.parentElement, 'tap', tapStub);
instance.captureTap(() => false);
MockInteractions.tap(element);
- flushAsynchronousOperations();
+ flush();
assert.isFalse(tapStub.called);
});
@@ -95,7 +95,7 @@
element.addEventListener('click', tapStub);
instance.captureTap(() => false);
MockInteractions.tap(element);
- flushAsynchronousOperations();
+ flush();
assert.isFalse(tapStub.called);
});
diff --git a/polygerrit-ui/app/elements/plugins/gr-popup-interface/gr-popup-interface_test.js b/polygerrit-ui/app/elements/plugins/gr-popup-interface/gr-popup-interface_test.js
index 75bd306..65f517a 100644
--- a/polygerrit-ui/app/elements/plugins/gr-popup-interface/gr-popup-interface_test.js
+++ b/polygerrit-ui/app/elements/plugins/gr-popup-interface/gr-popup-interface_test.js
@@ -70,7 +70,7 @@
manual.id = 'foobar';
manual.innerHTML = 'manual content';
api._getElement().appendChild(manual);
- flushAsynchronousOperations();
+ flush();
assert.equal(
container.querySelector('#foobar').textContent, 'manual content');
done();
diff --git a/polygerrit-ui/app/elements/settings/gr-account-info/gr-account-info_test.js b/polygerrit-ui/app/elements/settings/gr-account-info/gr-account-info_test.js
index c152ad2..d359ad2 100644
--- a/polygerrit-ui/app/elements/settings/gr-account-info/gr-account-info_test.js
+++ b/polygerrit-ui/app/elements/settings/gr-account-info/gr-account-info_test.js
@@ -302,12 +302,12 @@
// _usernameChanged is an observer, but call it here after setting
// _hasUsernameChange in the test to force recomputation.
element._usernameChanged();
- flushAsynchronousOperations();
+ flush();
assert.isFalse(element._hasUsernameChange);
element.set('_username', 'test');
- flushAsynchronousOperations();
+ flush();
assert.isTrue(element._hasUsernameChange);
});
diff --git a/polygerrit-ui/app/elements/settings/gr-change-table-editor/gr-change-table-editor_test.js b/polygerrit-ui/app/elements/settings/gr-change-table-editor/gr-change-table-editor_test.js
index 3fca9d2..42085ff 100644
--- a/polygerrit-ui/app/elements/settings/gr-change-table-editor/gr-change-table-editor_test.js
+++ b/polygerrit-ui/app/elements/settings/gr-change-table-editor/gr-change-table-editor_test.js
@@ -41,7 +41,7 @@
element.set('displayedColumns', columns);
element.showNumber = false;
- flushAsynchronousOperations();
+ flush();
});
test('renders', () => {
@@ -66,7 +66,7 @@
assert.isTrue(isChecked);
MockInteractions.tap(checkbox);
- flushAsynchronousOperations();
+ flush();
assert.equal(element.displayedColumns.length, displayedLength - 1);
});
@@ -80,7 +80,7 @@
'Branch',
'Updated',
]);
- flushAsynchronousOperations();
+ flush();
const checkbox = element.shadowRoot
.querySelector('table tr:nth-child(2) input');
const isChecked = checkbox.checked;
@@ -90,7 +90,7 @@
.querySelector('table').style.display, '');
MockInteractions.tap(checkbox);
- flushAsynchronousOperations();
+ flush();
assert.equal(element.displayedColumns.length,
displayedLength + 1);
diff --git a/polygerrit-ui/app/elements/settings/gr-watched-projects-editor/gr-watched-projects-editor_test.js b/polygerrit-ui/app/elements/settings/gr-watched-projects-editor/gr-watched-projects-editor_test.js
index b3f0970..2fd8900 100644
--- a/polygerrit-ui/app/elements/settings/gr-watched-projects-editor/gr-watched-projects-editor_test.js
+++ b/polygerrit-ui/app/elements/settings/gr-watched-projects-editor/gr-watched-projects-editor_test.js
@@ -187,7 +187,7 @@
.querySelector('table tbody tr:nth-child(2) gr-button');
MockInteractions.tap(button);
- flushAsynchronousOperations();
+ flush();
const rows = element.shadowRoot
.querySelector('table tbody').querySelectorAll('tr');
diff --git a/polygerrit-ui/app/elements/shared/gr-account-entry/gr-account-entry_test.js b/polygerrit-ui/app/elements/shared/gr-account-entry/gr-account-entry_test.js
index 396145b..424f979 100644
--- a/polygerrit-ui/app/elements/shared/gr-account-entry/gr-account-entry_test.js
+++ b/polygerrit-ui/app/elements/shared/gr-account-entry/gr-account-entry_test.js
@@ -81,7 +81,7 @@
// Spy on query, as that is called when _updateSuggestions proceeds.
const suggestSpy = sinon.spy(element.$.input, 'query');
element.setText('test text');
- flushAsynchronousOperations();
+ flush();
assert.equal(element.$.input.$.input.value, 'test text');
assert.isFalse(suggestSpy.called);
diff --git a/polygerrit-ui/app/elements/shared/gr-account-label/gr-account-label_test.js b/polygerrit-ui/app/elements/shared/gr-account-label/gr-account-label_test.js
index d606230..2e54db2 100644
--- a/polygerrit-ui/app/elements/shared/gr-account-label/gr-account-label_test.js
+++ b/polygerrit-ui/app/elements/shared/gr-account-label/gr-account-label_test.js
@@ -91,7 +91,7 @@
element._selfAccount = createAccount('kermit', 31);
element.account = createAccount('ernie', 42);
element.change = {attention_set: {42: {}}};
- flushAsynchronousOperations();
+ flush();
});
test('show attention button', () => {
diff --git a/polygerrit-ui/app/elements/shared/gr-account-list/gr-account-list_test.js b/polygerrit-ui/app/elements/shared/gr-account-list/gr-account-list_test.js
index e1a5e1a..78c8b9f 100644
--- a/polygerrit-ui/app/elements/shared/gr-account-list/gr-account-list_test.js
+++ b/polygerrit-ui/app/elements/shared/gr-account-list/gr-account-list_test.js
@@ -77,7 +77,7 @@
});
test('addition and removal of account/group chips', () => {
- flushAsynchronousOperations();
+ flush();
sinon.stub(element, '_computeRemovable').returns(true);
// Existing accounts are listed.
let chips = getChips();
@@ -94,7 +94,7 @@
},
},
});
- flushAsynchronousOperations();
+ flush();
chips = getChips();
assert.equal(chips.length, 3);
assert.isFalse(chips[0].classList.contains('pendingAdd'));
@@ -107,7 +107,7 @@
detail: {account: existingAccount1},
composed: true, bubbles: true,
}));
- flushAsynchronousOperations();
+ flush();
chips = getChips();
assert.equal(chips.length, 2);
assert.isFalse(chips[0].classList.contains('pendingAdd'));
@@ -124,7 +124,7 @@
detail: {account: newAccount},
composed: true, bubbles: true,
}));
- flushAsynchronousOperations();
+ flush();
chips = getChips();
assert.equal(chips.length, 1);
assert.isFalse(chips[0].classList.contains('pendingAdd'));
@@ -138,7 +138,7 @@
},
},
});
- flushAsynchronousOperations();
+ flush();
chips = getChips();
assert.equal(chips.length, 2);
assert.isTrue(chips[1].classList.contains('group'));
@@ -150,7 +150,7 @@
detail: {account: newGroup},
composed: true, bubbles: true,
}));
- flushAsynchronousOperations();
+ flush();
chips = getChips();
assert.equal(chips.length, 1);
assert.isFalse(chips[0].classList.contains('pendingAdd'));
@@ -235,7 +235,7 @@
test('submitEntryText', () => {
element.allowAnyInput = true;
- flushAsynchronousOperations();
+ flush();
const getTextStub = sinon.stub(element.$.entry, 'getText');
getTextStub.onFirstCall().returns('');
@@ -345,7 +345,7 @@
},
},
});
- flushAsynchronousOperations();
+ flush();
assert.isTrue(element.$.entry.hasAttribute('hidden'));
});
@@ -373,7 +373,7 @@
input.text = 'newTest';
MockInteractions.focus(input.$.input);
input.noDebounce = true;
- flushAsynchronousOperations();
+ flush();
flush(() => {
assert.isTrue(getSuggestionsStub.calledOnce);
assert.equal(getSuggestionsStub.lastCall.args[0], 'newTest');
@@ -407,7 +407,7 @@
input.text = '';
MockInteractions.focus(input.$.input);
input.noDebounce = true;
- flushAsynchronousOperations();
+ flush();
flush(() => {
assert.isTrue(getSuggestionsStub.calledOnce);
assert.equal(getSuggestionsStub.lastCall.args[0], '');
@@ -427,7 +427,7 @@
input.text = '';
MockInteractions.focus(input.$.input);
input.noDebounce = true;
- flushAsynchronousOperations();
+ flush();
flush(() => {
assert.isTrue(getSuggestionsStub.notCalled);
done();
@@ -479,7 +479,7 @@
element._getNativeInput(input.$.input).selectionStart, 0);
input.text = 'test';
MockInteractions.focus(input.$.input);
- flushAsynchronousOperations();
+ flush();
assert.equal(element.accounts.length, 2);
MockInteractions.pressAndReleaseKeyOn(
element._getNativeInput(input.$.input), 8); // Backspace
@@ -487,7 +487,7 @@
input.text = '';
MockInteractions.pressAndReleaseKeyOn(
element._getNativeInput(input.$.input), 8); // Backspace
- flushAsynchronousOperations();
+ flush();
assert.equal(element.accounts.length, 1);
done();
});
@@ -499,7 +499,7 @@
element.accounts = [makeAccount(), makeAccount()];
flush(() => {
MockInteractions.focus(input.$.input);
- flushAsynchronousOperations();
+ flush();
const chips = element.accountChips;
const chipsOneSpy = sinon.spy(chips[1], 'focus');
MockInteractions.pressAndReleaseKeyOn(input.$.input, 37); // Left
diff --git a/polygerrit-ui/app/elements/shared/gr-autocomplete-dropdown/gr-autocomplete-dropdown_test.js b/polygerrit-ui/app/elements/shared/gr-autocomplete-dropdown/gr-autocomplete-dropdown_test.js
index f76d070..633b18e 100644
--- a/polygerrit-ui/app/elements/shared/gr-autocomplete-dropdown/gr-autocomplete-dropdown_test.js
+++ b/polygerrit-ui/app/elements/shared/gr-autocomplete-dropdown/gr-autocomplete-dropdown_test.js
@@ -29,7 +29,7 @@
element.suggestions = [
{dataValue: 'test value 1', name: 'test name 1', text: 1, label: 'hi'},
{dataValue: 'test value 2', name: 'test name 2', text: 2}];
- flushAsynchronousOperations();
+ flush();
});
teardown(() => {
@@ -45,7 +45,7 @@
test('escape key', done => {
const closeSpy = sinon.spy(element, 'close');
MockInteractions.pressAndReleaseKeyOn(element, 27);
- flushAsynchronousOperations();
+ flush();
assert.isTrue(closeSpy.called);
done();
});
@@ -108,7 +108,7 @@
element.addEventListener('item-selected', itemSelectedStub);
MockInteractions.tap(element.$.suggestions.querySelectorAll('li')[1]);
- flushAsynchronousOperations();
+ flush();
assert.deepEqual(itemSelectedStub.lastCall.args[0].detail, {
trigger: 'click',
selected: element.$.suggestions.querySelectorAll('li')[1],
@@ -121,7 +121,7 @@
MockInteractions.tap(element.$.suggestions.querySelectorAll('li')[0]
.lastElementChild);
- flushAsynchronousOperations();
+ flush();
assert.deepEqual(itemSelectedStub.lastCall.args[0].detail, {
trigger: 'click',
selected: element.$.suggestions.querySelectorAll('li')[0],
diff --git a/polygerrit-ui/app/elements/shared/gr-autocomplete/gr-autocomplete_test.js b/polygerrit-ui/app/elements/shared/gr-autocomplete/gr-autocomplete_test.js
index b5fed6b..3c30c4e 100644
--- a/polygerrit-ui/app/elements/shared/gr-autocomplete/gr-autocomplete_test.js
+++ b/polygerrit-ui/app/elements/shared/gr-autocomplete/gr-autocomplete_test.js
@@ -259,7 +259,7 @@
focusOnInput(element);
element.text = 'bla';
assert.equal(element._focused, true);
- flushAsynchronousOperations();
+ flush();
promise.then(() => {
assert.equal(element._suggestions.length, 1);
assert.equal(queryStub.notCalled, false);
@@ -277,7 +277,7 @@
element.suggestOnlyWhenFocus = true;
element.text = 'bla';
assert.equal(element._focused, false);
- flushAsynchronousOperations();
+ flush();
promise.then(() => {
assert.equal(element._suggestions.length, 0);
done();
@@ -293,7 +293,7 @@
element.query = queryStub;
focusOnInput(element);
element.text = 'bla';
- flushAsynchronousOperations();
+ flush();
promise.then(() => {
assert.equal(element._suggestions.length, 1);
element._updateSuggestions('', 0, false);
@@ -458,7 +458,7 @@
focusSpy = sinon.spy(element, 'focus');
MockInteractions.pressAndReleaseKeyOn(element.$.input, 13, null,
'enter');
- flushAsynchronousOperations();
+ flush();
assert.isTrue(commitSpy.called);
assert.isFalse(focusSpy.called);
@@ -472,7 +472,7 @@
element.tabComplete = true;
element._suggestions = ['tunnel snakes drool'];
MockInteractions.pressAndReleaseKeyOn(element.$.input, 9, null, 'tab');
- flushAsynchronousOperations();
+ flush();
assert.isTrue(commitSpy.called);
assert.isTrue(focusSpy.called);
@@ -484,7 +484,7 @@
element._suggestions = ['sugar bombs'];
focusSpy = sinon.spy(element, 'focus');
MockInteractions.pressAndReleaseKeyOn(element.$.input, 9, null, 'tab');
- flushAsynchronousOperations();
+ flush();
assert.isFalse(commitSpy.called);
assert.isFalse(focusSpy.called);
@@ -503,7 +503,7 @@
MockInteractions.pressAndReleaseKeyOn(
element.$.suggestions.shadowRoot
.querySelector('li:first-child'), 9, null, 'tab');
- flushAsynchronousOperations();
+ flush();
assert.isFalse(commitSpy.called);
assert.isFalse(element._focused);
});
@@ -520,7 +520,7 @@
MockInteractions.pressAndReleaseKeyOn(
element.$.suggestions.shadowRoot
.querySelector('li:first-child'), 9, null, 'tab');
- flushAsynchronousOperations();
+ flush();
assert.isTrue(commitSpy.called);
assert.isTrue(element._focused);
@@ -534,7 +534,7 @@
assert.isFalse(element.$.suggestions.isHidden);
MockInteractions.tap(element.$.suggestions.shadowRoot
.querySelector('li:first-child'));
- flushAsynchronousOperations();
+ flush();
assert.isFalse(focusSpy.called);
assert.isTrue(commitSpy.called);
@@ -546,7 +546,7 @@
const listener = sinon.spy();
element.addEventListener('input-keydown', listener);
MockInteractions.pressAndReleaseKeyOn(element.$.input, 9, null, 'tab');
- flushAsynchronousOperations();
+ flush();
assert.isTrue(listener.called);
});
diff --git a/polygerrit-ui/app/elements/shared/gr-comment-thread/gr-comment-thread_test.js b/polygerrit-ui/app/elements/shared/gr-comment-thread/gr-comment-thread_test.js
index 7c176ac..416b6a8 100644
--- a/polygerrit-ui/app/elements/shared/gr-comment-thread/gr-comment-thread_test.js
+++ b/polygerrit-ui/app/elements/shared/gr-comment-thread/gr-comment-thread_test.js
@@ -37,7 +37,7 @@
element = basicFixture.instantiate();
element.patchNum = '3';
element.changeNum = '1';
- flushAsynchronousOperations();
+ flush();
});
test('comments are sorted correctly', () => {
@@ -190,7 +190,7 @@
element.lineNum = 5;
element.comments = [{id: 'comment_id'}];
element.showFilePath = true;
- flushAsynchronousOperations();
+ flush();
assert.isOk(element.shadowRoot
.querySelector('.pathInfo'));
assert.notEqual(getComputedStyle(element.shadowRoot
@@ -268,7 +268,7 @@
patchNum: 3,
__commentSide: 'left',
}];
- flushAsynchronousOperations();
+ flush();
});
test('reply', () => {
@@ -280,7 +280,7 @@
const replyBtn = element.$.replyBtn;
MockInteractions.tap(replyBtn);
- flushAsynchronousOperations();
+ flush();
const drafts = element._orderedComments.filter(c => c.__draft == true);
assert.equal(drafts.length, 1);
@@ -298,7 +298,7 @@
const quoteBtn = element.$.quoteBtn;
MockInteractions.tap(quoteBtn);
- flushAsynchronousOperations();
+ flush();
const drafts = element._orderedComments.filter(c => c.__draft == true);
assert.equal(drafts.length, 1);
@@ -321,7 +321,7 @@
message: 'is this a crossover episode!?\nIt might be!',
updated: '2015-12-08 19:48:33.843000000',
}];
- flushAsynchronousOperations();
+ flush();
const commentEl = element.shadowRoot
.querySelector('gr-comment');
@@ -329,7 +329,7 @@
const quoteBtn = element.$.quoteBtn;
MockInteractions.tap(quoteBtn);
- flushAsynchronousOperations();
+ flush();
const drafts = element._orderedComments.filter(c => c.__draft == true);
assert.equal(drafts.length, 1);
@@ -438,7 +438,7 @@
element.comments[0].id,
element.comments[0].path,
'it’s pronouced jiff, not giff'));
- flushAsynchronousOperations();
+ flush();
const saveOrDiscardStub = sinon.stub();
element.addEventListener('thread-changed', saveOrDiscardStub);
@@ -469,7 +469,7 @@
element.path = '/path/to/file.txt';
element.comments = [];
element.addOrEditDraft('1');
- flushAsynchronousOperations();
+ flush();
const rootId = element.rootId;
assert.isOk(rootId);
@@ -510,7 +510,7 @@
const replyBtn = element.$.replyBtn;
MockInteractions.tap(replyBtn);
- flushAsynchronousOperations();
+ flush();
const editing = element._orderedComments.filter(c => c.__editing == true);
assert.equal(editing.length, 1);
@@ -560,7 +560,7 @@
__draft: true,
}];
const storageStub = sinon.stub(element.$.storage, 'setDraftComment');
- flushAsynchronousOperations();
+ flush();
const draftEl =
element.root.querySelectorAll('gr-comment')[1];
@@ -634,7 +634,7 @@
test('comment in_reply_to is either null or most recent comment', () => {
element._createReplyComment('dummy', true);
- flushAsynchronousOperations();
+ flush();
assert.equal(element._orderedComments.length, 5);
assert.equal(element._orderedComments[4].in_reply_to, 'jacks_reply');
});
@@ -642,7 +642,7 @@
test('resolvable comments', () => {
assert.isFalse(element.unresolved);
element._createReplyComment('dummy', true, true);
- flushAsynchronousOperations();
+ flush();
assert.isTrue(element.unresolved);
});
@@ -848,7 +848,7 @@
path: '/path/to/file.txt',
unresolved: false,
}];
- flushAsynchronousOperations();
+ flush();
});
test('ack and done should be hidden', () => {
diff --git a/polygerrit-ui/app/elements/shared/gr-comment/gr-comment_test.js b/polygerrit-ui/app/elements/shared/gr-comment/gr-comment_test.js
index 3847135..10925af 100644
--- a/polygerrit-ui/app/elements/shared/gr-comment/gr-comment_test.js
+++ b/polygerrit-ui/app/elements/shared/gr-comment/gr-comment_test.js
@@ -106,7 +106,7 @@
element.side = 'PARENT';
const stub = sinon.stub();
element.addEventListener('comment-anchor-tap', stub);
- flushAsynchronousOperations();
+ flush();
const dateEl = element.shadowRoot
.querySelector('.date');
assert.ok(dateEl);
@@ -200,7 +200,7 @@
element._messageText = 'test';
sinon.stub(element, '_handleCancel');
sinon.stub(element, '_handleSave');
- flushAsynchronousOperations();
+ flush();
});
suite('when text is empty', () => {
@@ -353,7 +353,7 @@
const reportStub = sinon.stub(element.reporting,
'recordDraftInteraction');
element.draft = true;
- flushAsynchronousOperations();
+ flush();
MockInteractions.tap(element.shadowRoot
.querySelector('.edit'));
assert.isTrue(reportStub.calledOnce);
@@ -363,7 +363,7 @@
const reportStub = sinon.stub(element.reporting,
'recordDraftInteraction');
element.draft = true;
- flushAsynchronousOperations();
+ flush();
MockInteractions.tap(element.shadowRoot
.querySelector('.discard'));
assert.isTrue(reportStub.calledOnce);
@@ -500,7 +500,7 @@
.querySelector('.robotActions').hasAttribute('hidden'));
element.draft = true;
- flushAsynchronousOperations();
+ flush();
assert.isTrue(isVisible(element.shadowRoot
.querySelector('.edit')), 'edit is visible');
assert.isTrue(isVisible(element.shadowRoot
@@ -517,7 +517,7 @@
.querySelector('.robotActions').hasAttribute('hidden'));
element.editing = true;
- flushAsynchronousOperations();
+ flush();
assert.isFalse(isVisible(element.shadowRoot
.querySelector('.edit')), 'edit is not visible');
assert.isFalse(isVisible(element.shadowRoot
@@ -535,7 +535,7 @@
element.draft = false;
element.editing = false;
- flushAsynchronousOperations();
+ flush();
assert.isFalse(isVisible(element.shadowRoot
.querySelector('.edit')), 'edit is not visible');
assert.isFalse(isVisible(element.shadowRoot
@@ -553,7 +553,7 @@
element.comment.id = 'foo';
element.draft = true;
element.editing = true;
- flushAsynchronousOperations();
+ flush();
assert.isTrue(isVisible(element.shadowRoot
.querySelector('.cancel')), 'cancel is visible');
assert.isFalse(element.shadowRoot
@@ -583,13 +583,13 @@
element.set(['comment', 'robot_run_id'], 'text');
element.editing = false;
element.collapsed = false;
- flushAsynchronousOperations();
+ flush();
assert.isTrue(element.shadowRoot
.querySelector('.robotRun.link').textContent === 'Run Details');
// A robot comment with run ID and url should display a link.
element.set(['comment', 'url'], '/path/to/run');
- flushAsynchronousOperations();
+ flush();
assert.notEqual(getComputedStyle(element.shadowRoot
.querySelector('.robotRun.link')).display,
'none');
@@ -627,10 +627,10 @@
// When the edit button is pressed, should still see the actions
// and also textarea
element.draft = true;
- flushAsynchronousOperations();
+ flush();
MockInteractions.tap(element.shadowRoot
.querySelector('.edit'));
- flushAsynchronousOperations();
+ flush();
assert.isFalse(element.collapsed);
assert.isFalse(isVisible(element.shadowRoot
.querySelector('gr-formatted-text')),
@@ -704,7 +704,7 @@
assert.isTrue(authorName.innerText === 'Happy Robot');
element.collapsed = true;
- flushAsynchronousOperations();
+ flush();
runIdMessage = element.shadowRoot
.querySelector('.runIdMessage');
assert.isTrue(runIdMessage.hidden);
@@ -752,7 +752,7 @@
test('draft creation/cancellation', done => {
assert.isFalse(element.editing);
element.draft = true;
- flushAsynchronousOperations();
+ flush();
MockInteractions.tap(element.shadowRoot
.querySelector('.edit'));
assert.isTrue(element.editing);
@@ -785,7 +785,7 @@
.querySelector('.cancel'));
element.flushDebouncer('fire-update');
element._messageText = '';
- flushAsynchronousOperations();
+ flush();
MockInteractions.pressAndReleaseKeyOn(element.textarea, 27); // esc
});
@@ -874,7 +874,7 @@
});
element._messageText = 'is that the horse from horsing around??';
element.editing = true;
- flushAsynchronousOperations();
+ flush();
MockInteractions.pressAndReleaseKeyOn(
element.textarea.$.textarea.textarea,
83, 'ctrl'); // 'ctrl + s'
@@ -885,7 +885,7 @@
const cancelDebounce = sinon.stub(element, 'cancelDebouncer');
element.draft = true;
- flushAsynchronousOperations();
+ flush();
MockInteractions.tap(element.shadowRoot
.querySelector('.edit'));
element._messageText = 'good news, everyone!';
@@ -951,7 +951,7 @@
const saveStub = sinon.stub(element, 'save').returns(Promise.resolve());
element.showActions = true;
element.draft = true;
- flushAsynchronousOperations();
+ flush();
MockInteractions.tap(element.$.header);
MockInteractions.tap(element.shadowRoot
.querySelector('.edit'));
@@ -1042,7 +1042,7 @@
const storeStub = sinon.stub(element.$.storage, 'setDraftComment');
const eraseStub = sinon.stub(element.$.storage, 'eraseDraftComment');
element._messageText = 'test text';
- flushAsynchronousOperations();
+ flush();
element.flushDebouncer('store');
assert.isTrue(storeStub.called);
@@ -1057,7 +1057,7 @@
const discardSpy = sinon.spy(element, '_fireDiscard');
const storeStub = sinon.stub(element.$.storage, 'setDraftComment');
element._messageText = 'test text';
- flushAsynchronousOperations();
+ flush();
element.flushDebouncer('store');
assert.isFalse(storeStub.called);
@@ -1081,7 +1081,7 @@
});
element.isRobotComment = true;
element.comments = [element.comment];
- flushAsynchronousOperations();
+ flush();
MockInteractions.tap(element.shadowRoot
.querySelector('.fix'));
@@ -1157,7 +1157,7 @@
},
];
element.comment = element.comments[0];
- flushAsynchronousOperations();
+ flush();
assert.isNull(element.shadowRoot
.querySelector('robotActions gr-button'));
});
@@ -1219,7 +1219,7 @@
},
];
element.comment = element.comments[0];
- flushAsynchronousOperations();
+ flush();
assert.isNotNull(element.shadowRoot
.querySelector('.robotActions gr-button'));
});
@@ -1231,7 +1231,7 @@
});
element.comment = {fix_suggestions: [{}]};
element.isRobotComment = true;
- flushAsynchronousOperations();
+ flush();
MockInteractions.tap(element.shadowRoot
.querySelector('.show-fix'));
@@ -1300,7 +1300,7 @@
MockInteractions.tap(element.shadowRoot
.querySelector('.respectfulReviewTip .close'));
- flushAsynchronousOperations();
+ flush();
assert.isTrue(respectfulSetStub.lastCall.args[0] === 14);
done();
});
diff --git a/polygerrit-ui/app/elements/shared/gr-copy-clipboard/gr-copy-clipboard_test.js b/polygerrit-ui/app/elements/shared/gr-copy-clipboard/gr-copy-clipboard_test.js
index 58c00da..2611bfa 100644
--- a/polygerrit-ui/app/elements/shared/gr-copy-clipboard/gr-copy-clipboard_test.js
+++ b/polygerrit-ui/app/elements/shared/gr-copy-clipboard/gr-copy-clipboard_test.js
@@ -28,7 +28,7 @@
element = basicFixture.instantiate();
element.text = `git fetch http://gerrit@localhost:8080/a/test-project
refs/changes/05/5/1 && git checkout FETCH_HEAD`;
- flushAsynchronousOperations();
+ flush();
flush(done);
});
@@ -67,7 +67,7 @@
assert.notEqual(getComputedStyle(element.$.input).display, 'none');
element.hideInput = true;
- flushAsynchronousOperations();
+ flush();
assert.equal(getComputedStyle(element.$.input).display, 'none');
});
diff --git a/polygerrit-ui/app/elements/shared/gr-date-formatter/gr-date-formatter_test.js b/polygerrit-ui/app/elements/shared/gr-date-formatter/gr-date-formatter_test.js
index 804c3b7..cf44182 100644
--- a/polygerrit-ui/app/elements/shared/gr-date-formatter/gr-date-formatter_test.js
+++ b/polygerrit-ui/app/elements/shared/gr-date-formatter/gr-date-formatter_test.js
@@ -55,7 +55,7 @@
assert.equal(span.textContent.trim(), expected);
assert.equal(element.title, expectedTooltip);
element.showDateAndTime = true;
- flushAsynchronousOperations();
+ flush();
assert.equal(span.textContent.trim(), expectedWithDateAndTime);
done();
});
diff --git a/polygerrit-ui/app/elements/shared/gr-dialog/gr-dialog_test.js b/polygerrit-ui/app/elements/shared/gr-dialog/gr-dialog_test.js
index ce36d7b..346031d 100644
--- a/polygerrit-ui/app/elements/shared/gr-dialog/gr-dialog_test.js
+++ b/polygerrit-ui/app/elements/shared/gr-dialog/gr-dialog_test.js
@@ -48,7 +48,7 @@
MockInteractions.pressAndReleaseKeyOn(element.shadowRoot
.querySelector('main'),
13, null, 'enter');
- flushAsynchronousOperations();
+ flush();
assert.isTrue(handleKeydownSpy.called);
assert.isFalse(handleConfirmStub.called);
@@ -57,7 +57,7 @@
MockInteractions.pressAndReleaseKeyOn(element.shadowRoot
.querySelector('main'),
13, null, 'enter');
- flushAsynchronousOperations();
+ flush();
assert.isTrue(handleConfirmStub.called);
});
@@ -85,7 +85,7 @@
test('empty cancel label hides cancel btn', () => {
assert.isFalse(isHidden(element.$.cancel));
element.cancelLabel = '';
- flushAsynchronousOperations();
+ flush();
assert.isTrue(isHidden(element.$.cancel));
});
diff --git a/polygerrit-ui/app/elements/shared/gr-download-commands/gr-download-commands_test.js b/polygerrit-ui/app/elements/shared/gr-download-commands/gr-download-commands_test.js
index 0f8b97d..9931fae 100644
--- a/polygerrit-ui/app/elements/shared/gr-download-commands/gr-download-commands_test.js
+++ b/polygerrit-ui/app/elements/shared/gr-download-commands/gr-download-commands_test.js
@@ -54,7 +54,7 @@
element.schemes = SCHEMES;
element.commands = COMMANDS;
element.selectedScheme = SELECTED_SCHEME;
- flushAsynchronousOperations();
+ flush();
flush(done);
});
@@ -83,7 +83,7 @@
assert.equal(element.$.downloadTabs.selected, '0');
MockInteractions.tap(element.shadowRoot
.querySelector('[data-scheme="ssh"]'));
- flushAsynchronousOperations();
+ flush();
assert.equal(element.selectedScheme, 'ssh');
assert.equal(element.$.downloadTabs.selected, '2');
done();
@@ -121,7 +121,7 @@
const savePrefsStub = sinon.stub(element.$.restAPI, 'savePreferences')
.callsFake(() => Promise.resolve());
- flushAsynchronousOperations();
+ flush();
const repoTab = element.shadowRoot
.querySelector('paper-tab[data-scheme="repo"]');
diff --git a/polygerrit-ui/app/elements/shared/gr-dropdown-list/gr-dropdown-list_test.js b/polygerrit-ui/app/elements/shared/gr-dropdown-list/gr-dropdown-list_test.js
index 76deee5..205a4e6 100644
--- a/polygerrit-ui/app/elements/shared/gr-dropdown-list/gr-dropdown-list_test.js
+++ b/polygerrit-ui/app/elements/shared/gr-dropdown-list/gr-dropdown-list_test.js
@@ -156,7 +156,7 @@
// Select a new item.
MockInteractions.tap(items[0]);
- flushAsynchronousOperations();
+ flush();
assert.equal(element.value, 1);
assert.isTrue(items[0].classList.contains('iron-selected'));
assert.isTrue(mobileItems[0].selected);
diff --git a/polygerrit-ui/app/elements/shared/gr-dropdown/gr-dropdown_test.js b/polygerrit-ui/app/elements/shared/gr-dropdown/gr-dropdown_test.js
index b9070f3..515644b 100644
--- a/polygerrit-ui/app/elements/shared/gr-dropdown/gr-dropdown_test.js
+++ b/polygerrit-ui/app/elements/shared/gr-dropdown/gr-dropdown_test.js
@@ -94,7 +94,7 @@
test('Top text exists and is bolded correctly', () => {
element.topContent = [{text: 'User', bold: true}, {text: 'email'}];
- flushAsynchronousOperations();
+ flush();
const topItems = element.root.querySelectorAll('.top-item');
assert.equal(topItems.length, 2);
assert.isTrue(topItems[0].classList.contains('bold-text'));
@@ -108,7 +108,7 @@
const tapped = sinon.stub();
element.addEventListener('tap-item-foo', fooTapped);
element.addEventListener('tap-item', tapped);
- flushAsynchronousOperations();
+ flush();
MockInteractions.tap(element.shadowRoot
.querySelector('.itemAction'));
assert.isTrue(fooTapped.called);
@@ -124,7 +124,7 @@
const tapped = sinon.stub();
element.addEventListener('tap-item-foo', stub);
element.addEventListener('tap-item', tapped);
- flushAsynchronousOperations();
+ flush();
MockInteractions.tap(element.shadowRoot
.querySelector('.itemAction'));
assert.isFalse(stub.called);
@@ -137,7 +137,7 @@
{name: 'item two', id: 'bar'},
];
element.disabledIds = [];
- flushAsynchronousOperations();
+ flush();
const tooltipContents = dom(element.root)
.querySelectorAll('iron-dropdown li gr-tooltip-content');
assert.equal(tooltipContents.length, 2);
@@ -152,7 +152,7 @@
{name: 'item one', id: 'foo'},
{name: 'item two', id: 'bar'},
];
- flushAsynchronousOperations();
+ flush();
});
test('down', () => {
diff --git a/polygerrit-ui/app/elements/shared/gr-editable-content/gr-editable-content_test.js b/polygerrit-ui/app/elements/shared/gr-editable-content/gr-editable-content_test.js
index 0a9dd79..f57a510 100644
--- a/polygerrit-ui/app/elements/shared/gr-editable-content/gr-editable-content_test.js
+++ b/polygerrit-ui/app/elements/shared/gr-editable-content/gr-editable-content_test.js
@@ -121,7 +121,7 @@
element.editing = true;
element._newContent = 'new content';
- flushAsynchronousOperations();
+ flush();
element.flushDebouncer('store');
assert.isTrue(storeStub.called);
@@ -130,7 +130,7 @@
storeStub.lastCall.args);
element._newContent = '';
- flushAsynchronousOperations();
+ flush();
element.flushDebouncer('store');
assert.isTrue(eraseStub.called);
diff --git a/polygerrit-ui/app/elements/shared/gr-hovercard-account/gr-hovercard-account_test.js b/polygerrit-ui/app/elements/shared/gr-hovercard-account/gr-hovercard-account_test.js
index eb84a0b..e87480b 100644
--- a/polygerrit-ui/app/elements/shared/gr-hovercard-account/gr-hovercard-account_test.js
+++ b/polygerrit-ui/app/elements/shared/gr-hovercard-account/gr-hovercard-account_test.js
@@ -47,7 +47,7 @@
attention_set: {},
};
element.show({});
- flushAsynchronousOperations();
+ flush();
});
teardown(() => {
@@ -96,7 +96,7 @@
test('account status is displayed', () => {
element.account = {status: 'OOO', ...ACCOUNT};
- flushAsynchronousOperations();
+ flush();
assert.equal(element.shadowRoot.querySelector('.status .value').innerText,
'OOO');
});
@@ -107,7 +107,7 @@
test('voteable div is displayed', () => {
element.voteableText = 'CodeReview: +2';
- flushAsynchronousOperations();
+ flush();
assert.equal(element.shadowRoot.querySelector('.voteable .value').innerText,
element.voteableText);
});
@@ -121,7 +121,7 @@
.callsFake(() => apiPromise);
element.highlightAttention = true;
element._target = document.createElement('div');
- flushAsynchronousOperations();
+ flush();
const showAlertListener = sinon.spy();
const hideAlertListener = sinon.spy();
const updatedListener = sinon.spy();
@@ -156,7 +156,7 @@
element.highlightAttention = true;
element.change = {attention_set: {31415926535: {}}};
element._target = document.createElement('div');
- flushAsynchronousOperations();
+ flush();
const showAlertListener = sinon.spy();
const hideAlertListener = sinon.spy();
const updatedListener = sinon.spy();
diff --git a/polygerrit-ui/app/elements/shared/gr-label-info/gr-label-info_test.js b/polygerrit-ui/app/elements/shared/gr-label-info/gr-label-info_test.js
index b936237..be7878b 100644
--- a/polygerrit-ui/app/elements/shared/gr-label-info/gr-label-info_test.js
+++ b/polygerrit-ui/app/elements/shared/gr-label-info/gr-label-info_test.js
@@ -57,7 +57,7 @@
element.labelInfo = test;
element.label = 'test';
- flushAsynchronousOperations();
+ flush();
});
test('_computeCanDeleteVote', () => {
@@ -92,14 +92,14 @@
suite('label color and order', () => {
test('valueless label rejected', () => {
element.labelInfo = {rejected: {name: 'someone'}};
- flushAsynchronousOperations();
+ flush();
const labels = element.root.querySelectorAll('gr-label');
assert.isTrue(labels[0].classList.contains('negative'));
});
test('valueless label approved', () => {
element.labelInfo = {approved: {name: 'someone'}};
- flushAsynchronousOperations();
+ flush();
const labels = element.root.querySelectorAll('gr-label');
assert.isTrue(labels[0].classList.contains('positive'));
});
@@ -120,7 +120,7 @@
'+2': 'Ready to submit',
},
};
- flushAsynchronousOperations();
+ flush();
const labels = element.root.querySelectorAll('gr-label');
assert.isTrue(labels[0].classList.contains('max'));
assert.isTrue(labels[1].classList.contains('positive'));
@@ -140,7 +140,7 @@
'+1': 'Looks good to me',
},
};
- flushAsynchronousOperations();
+ flush();
const labels = element.root.querySelectorAll('gr-label');
assert.isTrue(labels[0].classList.contains('max'));
assert.isTrue(labels[1].classList.contains('min'));
@@ -158,7 +158,7 @@
'+2': 'Looks good to me',
},
};
- flushAsynchronousOperations();
+ flush();
const labels = element.root.querySelectorAll('gr-label');
assert.isTrue(labels[0].classList.contains('max'));
assert.isTrue(labels[1].classList.contains('positive'));
@@ -180,7 +180,7 @@
'+1': 'Looks good to me',
},
};
- flushAsynchronousOperations();
+ flush();
const chips =
element.root.querySelectorAll('gr-account-link');
assert.equal(chips[0].account._account_id, element.account._account_id);
diff --git a/polygerrit-ui/app/elements/shared/gr-limited-text/gr-limited-text_test.js b/polygerrit-ui/app/elements/shared/gr-limited-text/gr-limited-text_test.js
index 6e27eeb..3b99d6d 100644
--- a/polygerrit-ui/app/elements/shared/gr-limited-text/gr-limited-text_test.js
+++ b/polygerrit-ui/app/elements/shared/gr-limited-text/gr-limited-text_test.js
@@ -30,31 +30,31 @@
test('tooltip without title input', () => {
const updateSpy = sinon.spy(element, '_updateTitle');
element.text = 'abc 123';
- flushAsynchronousOperations();
+ flush();
assert.isTrue(updateSpy.calledOnce);
assert.isNotOk(element.getAttribute('title'));
assert.isFalse(element.hasTooltip);
element.limit = 10;
- flushAsynchronousOperations();
+ flush();
assert.isTrue(updateSpy.calledTwice);
assert.isNotOk(element.getAttribute('title'));
assert.isFalse(element.hasTooltip);
element.limit = 3;
- flushAsynchronousOperations();
+ flush();
assert.equal(updateSpy.callCount, 3);
assert.equal(element.getAttribute('title'), 'abc 123');
assert.equal(element.title, 'abc 123');
assert.isTrue(element.hasTooltip);
element.limit = 100;
- flushAsynchronousOperations();
+ flush();
assert.equal(updateSpy.callCount, 4);
assert.isFalse(element.hasTooltip);
element.limit = null;
- flushAsynchronousOperations();
+ flush();
assert.equal(updateSpy.callCount, 5);
assert.isNotOk(element.getAttribute('title'));
assert.isFalse(element.hasTooltip);
@@ -63,20 +63,20 @@
test('with tooltip input', () => {
const updateSpy = sinon.spy(element, '_updateTitle');
element.tooltip = 'abc 123';
- flushAsynchronousOperations();
+ flush();
assert.isTrue(updateSpy.calledOnce);
assert.isTrue(element.hasTooltip);
assert.equal(element.getAttribute('title'), 'abc 123');
assert.equal(element.title, 'abc 123');
element.text = 'abc';
- flushAsynchronousOperations();
+ flush();
assert.equal(element.getAttribute('title'), 'abc 123');
assert.isTrue(element.hasTooltip);
element.text = 'abcdef';
element.limit = 3;
- flushAsynchronousOperations();
+ flush();
assert.equal(element.getAttribute('title'), 'abcdef (abc 123)');
assert.isTrue(element.hasTooltip);
});
@@ -92,7 +92,7 @@
element.text = 'abcdefghijklmn';
element.disableTooltip = true;
element.limit = 10;
- flushAsynchronousOperations();
+ flush();
assert.equal(element.getAttribute('title'), '');
});
});
diff --git a/polygerrit-ui/app/elements/shared/gr-linked-chip/gr-linked-chip_test.js b/polygerrit-ui/app/elements/shared/gr-linked-chip/gr-linked-chip_test.js
index b111e84..dd2b98a 100644
--- a/polygerrit-ui/app/elements/shared/gr-linked-chip/gr-linked-chip_test.js
+++ b/polygerrit-ui/app/elements/shared/gr-linked-chip/gr-linked-chip_test.js
@@ -30,7 +30,7 @@
test('remove fired', () => {
const spy = sinon.spy();
element.addEventListener('remove', spy);
- flushAsynchronousOperations();
+ flush();
MockInteractions.tap(element.$.remove);
assert.isTrue(spy.called);
});
diff --git a/polygerrit-ui/app/elements/shared/gr-list-view/gr-list-view_test.js b/polygerrit-ui/app/elements/shared/gr-list-view/gr-list-view_test.js
index ce14dac..faf2975 100644
--- a/polygerrit-ui/app/elements/shared/gr-list-view/gr-list-view_test.js
+++ b/polygerrit-ui/app/elements/shared/gr-list-view/gr-list-view_test.js
@@ -110,7 +110,7 @@
.querySelector('#createNewContainer').classList
.contains('show'));
element.createNew = true;
- flushAsynchronousOperations();
+ flush();
assert.isTrue(element.shadowRoot
.querySelector('#createNewContainer').classList
.contains('show'));
@@ -120,7 +120,7 @@
const clickHandler = sinon.stub();
element.addEventListener('create-clicked', clickHandler);
element.createNew = true;
- flushAsynchronousOperations();
+ flush();
MockInteractions.tap(element.shadowRoot.querySelector('#createNew'));
assert.isTrue(clickHandler.called);
});
diff --git a/polygerrit-ui/app/elements/shared/gr-page-nav/gr-page-nav_test.js b/polygerrit-ui/app/elements/shared/gr-page-nav/gr-page-nav_test.js
index 2e40b27..2960a1f 100644
--- a/polygerrit-ui/app/elements/shared/gr-page-nav/gr-page-nav_test.js
+++ b/polygerrit-ui/app/elements/shared/gr-page-nav/gr-page-nav_test.js
@@ -32,7 +32,7 @@
setup(() => {
element = basicFixture.instantiate();
- flushAsynchronousOperations();
+ flush();
});
test('header is not pinned just below top', () => {
diff --git a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface_test.js b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface_test.js
index beb66b6..e05494b 100644
--- a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface_test.js
+++ b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface_test.js
@@ -1299,7 +1299,7 @@
sinon.stub(appContext.authService, 'fetch').returns(Promise.resolve(res));
sinon.stub(element, '_changeBaseURL').returns(Promise.resolve(''));
element.getFileContent('1', 'tst/path', '1').then(() => {
- flushAsynchronousOperations();
+ flush();
res.status = 500;
element.getFileContent('1', 'tst/path', '1');
@@ -1349,7 +1349,7 @@
element._restApiHelper
._logCall({url: 'url', anonymizedUrl: 'not url'}, 100, 200);
- flushAsynchronousOperations();
+ flush();
assert.isTrue(handler.calledOnce);
});
diff --git a/polygerrit-ui/app/elements/shared/gr-shell-command/gr-shell-command_test.js b/polygerrit-ui/app/elements/shared/gr-shell-command/gr-shell-command_test.js
index 5e20717..de9f243 100644
--- a/polygerrit-ui/app/elements/shared/gr-shell-command/gr-shell-command_test.js
+++ b/polygerrit-ui/app/elements/shared/gr-shell-command/gr-shell-command_test.js
@@ -27,7 +27,7 @@
element = basicFixture.instantiate();
element.text = `git fetch http://gerrit@localhost:8080/a/test-project
refs/changes/05/5/1 && git checkout FETCH_HEAD`;
- flushAsynchronousOperations();
+ flush();
});
test('focusOnCopy', () => {
diff --git a/polygerrit-ui/app/elements/shared/gr-textarea/gr-textarea_test.js b/polygerrit-ui/app/elements/shared/gr-textarea/gr-textarea_test.js
index 2aa7697..5b3a2b2 100644
--- a/polygerrit-ui/app/elements/shared/gr-textarea/gr-textarea_test.js
+++ b/polygerrit-ui/app/elements/shared/gr-textarea/gr-textarea_test.js
@@ -68,7 +68,7 @@
element.$.textarea.selectionStart = 1;
element.$.textarea.selectionEnd = 1;
element.text = ':';
- flushAsynchronousOperations();
+ flush();
assert.isFalse(element.$.emojiSuggestions.isHidden);
assert.equal(element._colonIndex, 0);
assert.isFalse(element._hideAutocomplete);
@@ -83,7 +83,7 @@
element.$.textarea.selectionStart = 2;
element.$.textarea.selectionEnd = 2;
element.text = ' :';
- flushAsynchronousOperations();
+ flush();
assert.isFalse(element.$.emojiSuggestions.isHidden);
assert.equal(element._colonIndex, 1);
assert.isFalse(element._hideAutocomplete);
@@ -98,7 +98,7 @@
element.$.textarea.selectionStart = 5;
element.$.textarea.selectionEnd = 5;
element.text = 'test:';
- flushAsynchronousOperations();
+ flush();
assert.isTrue(element.$.emojiSuggestions.isHidden);
assert.isTrue(element._hideAutocomplete);
});
@@ -114,7 +114,7 @@
element.$.textarea.selectionStart = 2;
element.$.textarea.selectionEnd = 2;
element.text = ':t';
- flushAsynchronousOperations();
+ flush();
assert.isFalse(element.$.emojiSuggestions.isHidden);
assert.equal(element._colonIndex, 0);
assert.isFalse(element._hideAutocomplete);
@@ -139,7 +139,7 @@
},
});
element.text = text;
- flushAsynchronousOperations();
+ flush();
assert.isFalse(element.$.emojiSuggestions.isHidden);
assert.equal(element._colonIndex, 0);
assert.isFalse(element._hideAutocomplete);
@@ -148,7 +148,7 @@
test('emoji selector closes when text changes before the colon', () => {
const resetStub = sinon.stub(element, '_resetEmojiDropdown');
MockInteractions.focus(element.$.textarea);
- flushAsynchronousOperations();
+ flush();
element.$.textarea.selectionStart = 10;
element.$.textarea.selectionEnd = 10;
element.text = 'test test ';
@@ -173,7 +173,7 @@
assert.equal(element._colonIndex, null);
element.$.emojiSuggestions.open();
- flushAsynchronousOperations();
+ flush();
element._resetEmojiDropdown();
assert.isTrue(closeSpy.called);
});
@@ -246,7 +246,7 @@
element.$.textarea.selectionStart = 1;
element.$.textarea.selectionEnd = 2;
element.text = ':1';
- flushAsynchronousOperations();
+ flush();
}
test('escape key', () => {
@@ -285,7 +285,7 @@
setupDropdown();
MockInteractions.pressAndReleaseKeyOn(element.$.textarea, 13);
assert.isTrue(enterSpy.called);
- flushAsynchronousOperations();
+ flush();
assert.equal(element.text, '💯');
});
@@ -298,7 +298,7 @@
element.$.textarea.selectionStart = 1;
element.$.textarea.selectionEnd = 1;
element.text = ':';
- flushAsynchronousOperations();
+ flush();
MockInteractions.pressAndReleaseKeyOn(element.$.textarea, 13);
assert.isFalse(enterSpy.called);
});
diff --git a/polygerrit-ui/app/mixins/gr-tooltip-mixin/gr-tooltip-mixin_test.js b/polygerrit-ui/app/mixins/gr-tooltip-mixin/gr-tooltip-mixin_test.js
index 589307d..209c83af 100644
--- a/polygerrit-ui/app/mixins/gr-tooltip-mixin/gr-tooltip-mixin_test.js
+++ b/polygerrit-ui/app/mixins/gr-tooltip-mixin/gr-tooltip-mixin_test.js
@@ -117,7 +117,7 @@
test('hides tooltip when detached', () => {
sinon.stub(element, '_handleHideTooltip');
element.remove();
- flushAsynchronousOperations();
+ flush();
assert.isTrue(element._handleHideTooltip.called);
});