Commit e3aca8c8 authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 33 files - 53 of 73

Part of our prettier migration; changing the arrow-parens style.
parent 3b1593f2
...@@ -1531,41 +1531,6 @@ ee/spec/frontend/roadmap/components/epic_item_timeline_spec.js ...@@ -1531,41 +1531,6 @@ ee/spec/frontend/roadmap/components/epic_item_timeline_spec.js
ee/spec/frontend/roadmap/components/epics_list_empty_spec.js ee/spec/frontend/roadmap/components/epics_list_empty_spec.js
ee/spec/frontend/roadmap/components/milestones_list_section_spec.js ee/spec/frontend/roadmap/components/milestones_list_section_spec.js
## relaxed-goldwasser
spec/frontend/__mocks__/@gitlab/ui.js
spec/frontend/__mocks__/lodash/debounce.js
spec/frontend/__mocks__/lodash/throttle.js
spec/frontend/activities_spec.js
spec/frontend/add_context_commits_modal/store/actions_spec.js
spec/frontend/admin/statistics_panel/components/app_spec.js
spec/frontend/admin/statistics_panel/store/actions_spec.js
spec/frontend/alert_handler_spec.js
spec/frontend/alerts_service_settings/components/alerts_service_form_spec.js
spec/frontend/alerts_settings/alert_mapping_builder_spec.js
spec/frontend/alerts_settings/alerts_settings_wrapper_spec.js
spec/frontend/analytics/instance_statistics/components/app_spec.js
spec/frontend/api_spec.js
spec/frontend/authentication/two_factor_auth/components/recovery_codes_spec.js
spec/frontend/authentication/u2f/authenticate_spec.js
spec/frontend/authentication/u2f/register_spec.js
spec/frontend/awards_handler_spec.js
spec/frontend/badges/components/badge_form_spec.js
spec/frontend/badges/components/badge_list_row_spec.js
spec/frontend/badges/components/badge_list_spec.js
spec/frontend/badges/components/badge_spec.js
spec/frontend/badges/store/actions_spec.js
spec/frontend/batch_comments/components/draft_note_spec.js
spec/frontend/batch_comments/components/drafts_count_spec.js
spec/frontend/batch_comments/components/preview_item_spec.js
spec/frontend/batch_comments/components/publish_button_spec.js
spec/frontend/batch_comments/stores/modules/batch_comments/actions_spec.js
spec/frontend/behaviors/autosize_spec.js
spec/frontend/behaviors/copy_as_gfm_spec.js
spec/frontend/behaviors/load_startup_css_spec.js
spec/frontend/behaviors/markdown/paste_markdown_table_spec.js
spec/frontend/behaviors/quick_submit_spec.js
spec/frontend/behaviors/secret_values_spec.js
## eager-lamport ## eager-lamport
spec/frontend/behaviors/shortcuts/keybindings_spec.js spec/frontend/behaviors/shortcuts/keybindings_spec.js
spec/frontend/behaviors/shortcuts/shortcuts_issuable_spec.js spec/frontend/behaviors/shortcuts/shortcuts_issuable_spec.js
......
...@@ -38,7 +38,7 @@ jest.mock('@gitlab/ui/dist/components/base/popover/popover.js', () => ({ ...@@ -38,7 +38,7 @@ jest.mock('@gitlab/ui/dist/components/base/popover/popover.js', () => ({
required: false, required: false,
default: () => [], default: () => [],
}, },
...Object.fromEntries(['target', 'triggers', 'placement'].map(prop => [prop, {}])), ...Object.fromEntries(['target', 'triggers', 'placement'].map((prop) => [prop, {}])),
}, },
render(h) { render(h) {
return h( return h(
...@@ -47,7 +47,7 @@ jest.mock('@gitlab/ui/dist/components/base/popover/popover.js', () => ({ ...@@ -47,7 +47,7 @@ jest.mock('@gitlab/ui/dist/components/base/popover/popover.js', () => ({
class: 'gl-popover', class: 'gl-popover',
...this.$attrs, ...this.$attrs,
}, },
Object.keys(this.$slots).map(s => this.$slots[s]), Object.keys(this.$slots).map((s) => this.$slots[s]),
); );
}, },
})); }));
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
// [2]: https://gitlab.com/gitlab-org/gitlab/-/issues/213378 // [2]: https://gitlab.com/gitlab-org/gitlab/-/issues/213378
// Further reference: https://github.com/facebook/jest/issues/3465 // Further reference: https://github.com/facebook/jest/issues/3465
export default fn => { export default (fn) => {
const debouncedFn = jest.fn().mockImplementation(fn); const debouncedFn = jest.fn().mockImplementation(fn);
debouncedFn.cancel = jest.fn(); debouncedFn.cancel = jest.fn();
debouncedFn.flush = jest.fn().mockImplementation(() => { debouncedFn.flush = jest.fn().mockImplementation(() => {
......
// Similar to `lodash/debounce`, `lodash/throttle` also causes flaky specs. // Similar to `lodash/debounce`, `lodash/throttle` also causes flaky specs.
// See `./debounce.js` for more details. // See `./debounce.js` for more details.
export default fn => fn; export default (fn) => fn;
...@@ -44,14 +44,14 @@ describe('Activities', () => { ...@@ -44,14 +44,14 @@ describe('Activities', () => {
}); });
for (let i = 0; i < filters.length; i += 1) { for (let i = 0; i < filters.length; i += 1) {
(i => { ((i) => {
describe(`when selecting ${getEventName(i)}`, () => { describe(`when selecting ${getEventName(i)}`, () => {
beforeEach(() => { beforeEach(() => {
$(getSelector(i)).click(); $(getSelector(i)).click();
}); });
for (let x = 0; x < filters.length; x += 1) { for (let x = 0; x < filters.length; x += 1) {
(x => { ((x) => {
const shouldHighlight = i === x; const shouldHighlight = i === x;
const testName = shouldHighlight ? 'should highlight' : 'should not highlight'; const testName = shouldHighlight ? 'should highlight' : 'should not highlight';
......
...@@ -42,7 +42,7 @@ describe('AddContextCommitsModalStoreActions', () => { ...@@ -42,7 +42,7 @@ describe('AddContextCommitsModalStoreActions', () => {
}); });
describe('setBaseConfig', () => { describe('setBaseConfig', () => {
it('commits SET_BASE_CONFIG', done => { it('commits SET_BASE_CONFIG', (done) => {
const options = { contextCommitsPath, mergeRequestIid, projectId }; const options = { contextCommitsPath, mergeRequestIid, projectId };
testAction( testAction(
setBaseConfig, setBaseConfig,
...@@ -65,7 +65,7 @@ describe('AddContextCommitsModalStoreActions', () => { ...@@ -65,7 +65,7 @@ describe('AddContextCommitsModalStoreActions', () => {
}); });
describe('setTabIndex', () => { describe('setTabIndex', () => {
it('commits SET_TABINDEX', done => { it('commits SET_TABINDEX', (done) => {
testAction( testAction(
setTabIndex, setTabIndex,
{ tabIndex: 1 }, { tabIndex: 1 },
...@@ -78,7 +78,7 @@ describe('AddContextCommitsModalStoreActions', () => { ...@@ -78,7 +78,7 @@ describe('AddContextCommitsModalStoreActions', () => {
}); });
describe('setCommits', () => { describe('setCommits', () => {
it('commits SET_COMMITS', done => { it('commits SET_COMMITS', (done) => {
testAction( testAction(
setCommits, setCommits,
{ commits: [], silentAddition: false }, { commits: [], silentAddition: false },
...@@ -89,7 +89,7 @@ describe('AddContextCommitsModalStoreActions', () => { ...@@ -89,7 +89,7 @@ describe('AddContextCommitsModalStoreActions', () => {
); );
}); });
it('commits SET_COMMITS_SILENT', done => { it('commits SET_COMMITS_SILENT', (done) => {
testAction( testAction(
setCommits, setCommits,
{ commits: [], silentAddition: true }, { commits: [], silentAddition: true },
...@@ -102,7 +102,7 @@ describe('AddContextCommitsModalStoreActions', () => { ...@@ -102,7 +102,7 @@ describe('AddContextCommitsModalStoreActions', () => {
}); });
describe('createContextCommits', () => { describe('createContextCommits', () => {
it('calls API to create context commits', done => { it('calls API to create context commits', (done) => {
mock.onPost(contextCommitEndpoint).reply(200, {}); mock.onPost(contextCommitEndpoint).reply(200, {});
testAction(createContextCommits, { commits: [] }, {}, [], [], done); testAction(createContextCommits, { commits: [] }, {}, [], [], done);
...@@ -126,7 +126,7 @@ describe('AddContextCommitsModalStoreActions', () => { ...@@ -126,7 +126,7 @@ describe('AddContextCommitsModalStoreActions', () => {
) )
.reply(200, [dummyCommit]); .reply(200, [dummyCommit]);
}); });
it('commits FETCH_CONTEXT_COMMITS', done => { it('commits FETCH_CONTEXT_COMMITS', (done) => {
const contextCommit = { ...dummyCommit, isSelected: true }; const contextCommit = { ...dummyCommit, isSelected: true };
testAction( testAction(
fetchContextCommits, fetchContextCommits,
...@@ -150,7 +150,7 @@ describe('AddContextCommitsModalStoreActions', () => { ...@@ -150,7 +150,7 @@ describe('AddContextCommitsModalStoreActions', () => {
}); });
describe('setContextCommits', () => { describe('setContextCommits', () => {
it('commits SET_CONTEXT_COMMITS', done => { it('commits SET_CONTEXT_COMMITS', (done) => {
testAction( testAction(
setContextCommits, setContextCommits,
{ data: [] }, { data: [] },
...@@ -168,7 +168,7 @@ describe('AddContextCommitsModalStoreActions', () => { ...@@ -168,7 +168,7 @@ describe('AddContextCommitsModalStoreActions', () => {
.onDelete('/api/v4/projects/gitlab-org%2Fgitlab/merge_requests/1/context_commits') .onDelete('/api/v4/projects/gitlab-org%2Fgitlab/merge_requests/1/context_commits')
.reply(204); .reply(204);
}); });
it('calls API to remove context commits', done => { it('calls API to remove context commits', (done) => {
testAction( testAction(
removeContextCommits, removeContextCommits,
{ forceReload: false }, { forceReload: false },
...@@ -181,7 +181,7 @@ describe('AddContextCommitsModalStoreActions', () => { ...@@ -181,7 +181,7 @@ describe('AddContextCommitsModalStoreActions', () => {
}); });
describe('setSelectedCommits', () => { describe('setSelectedCommits', () => {
it('commits SET_SELECTED_COMMITS', done => { it('commits SET_SELECTED_COMMITS', (done) => {
testAction( testAction(
setSelectedCommits, setSelectedCommits,
[dummyCommit], [dummyCommit],
...@@ -194,7 +194,7 @@ describe('AddContextCommitsModalStoreActions', () => { ...@@ -194,7 +194,7 @@ describe('AddContextCommitsModalStoreActions', () => {
}); });
describe('setSearchText', () => { describe('setSearchText', () => {
it('commits SET_SEARCH_TEXT', done => { it('commits SET_SEARCH_TEXT', (done) => {
const searchText = 'Dummy Text'; const searchText = 'Dummy Text';
testAction( testAction(
setSearchText, setSearchText,
...@@ -208,7 +208,7 @@ describe('AddContextCommitsModalStoreActions', () => { ...@@ -208,7 +208,7 @@ describe('AddContextCommitsModalStoreActions', () => {
}); });
describe('setToRemoveCommits', () => { describe('setToRemoveCommits', () => {
it('commits SET_TO_REMOVE_COMMITS', done => { it('commits SET_TO_REMOVE_COMMITS', (done) => {
const commitId = 'abcde'; const commitId = 'abcde';
testAction( testAction(
...@@ -223,7 +223,7 @@ describe('AddContextCommitsModalStoreActions', () => { ...@@ -223,7 +223,7 @@ describe('AddContextCommitsModalStoreActions', () => {
}); });
describe('resetModalState', () => { describe('resetModalState', () => {
it('commits RESET_MODAL_STATE', done => { it('commits RESET_MODAL_STATE', (done) => {
const commitId = 'abcde'; const commitId = 'abcde';
testAction( testAction(
......
...@@ -34,7 +34,7 @@ describe('Admin statistics app', () => { ...@@ -34,7 +34,7 @@ describe('Admin statistics app', () => {
wrapper.destroy(); wrapper.destroy();
}); });
const findStats = idx => wrapper.findAll('.js-stats').at(idx); const findStats = (idx) => wrapper.findAll('.js-stats').at(idx);
describe('template', () => { describe('template', () => {
describe('when app is loading', () => { describe('when app is loading', () => {
......
...@@ -22,7 +22,7 @@ describe('Admin statistics panel actions', () => { ...@@ -22,7 +22,7 @@ describe('Admin statistics panel actions', () => {
mock.onGet(/api\/(.*)\/application\/statistics/).replyOnce(200, mockStatistics); mock.onGet(/api\/(.*)\/application\/statistics/).replyOnce(200, mockStatistics);
}); });
it('dispatches success with received data', done => it('dispatches success with received data', (done) =>
testAction( testAction(
actions.fetchStatistics, actions.fetchStatistics,
null, null,
...@@ -46,7 +46,7 @@ describe('Admin statistics panel actions', () => { ...@@ -46,7 +46,7 @@ describe('Admin statistics panel actions', () => {
mock.onGet(/api\/(.*)\/application\/statistics/).replyOnce(500); mock.onGet(/api\/(.*)\/application\/statistics/).replyOnce(500);
}); });
it('dispatches error', done => it('dispatches error', (done) =>
testAction( testAction(
actions.fetchStatistics, actions.fetchStatistics,
null, null,
...@@ -67,7 +67,7 @@ describe('Admin statistics panel actions', () => { ...@@ -67,7 +67,7 @@ describe('Admin statistics panel actions', () => {
}); });
describe('requestStatistic', () => { describe('requestStatistic', () => {
it('should commit the request mutation', done => it('should commit the request mutation', (done) =>
testAction( testAction(
actions.requestStatistics, actions.requestStatistics,
null, null,
...@@ -79,7 +79,7 @@ describe('Admin statistics panel actions', () => { ...@@ -79,7 +79,7 @@ describe('Admin statistics panel actions', () => {
}); });
describe('receiveStatisticsSuccess', () => { describe('receiveStatisticsSuccess', () => {
it('should commit received data', done => it('should commit received data', (done) =>
testAction( testAction(
actions.receiveStatisticsSuccess, actions.receiveStatisticsSuccess,
mockStatistics, mockStatistics,
...@@ -96,7 +96,7 @@ describe('Admin statistics panel actions', () => { ...@@ -96,7 +96,7 @@ describe('Admin statistics panel actions', () => {
}); });
describe('receiveStatisticsError', () => { describe('receiveStatisticsError', () => {
it('should commit error', done => { it('should commit error', (done) => {
testAction( testAction(
actions.receiveStatisticsError, actions.receiveStatisticsError,
500, 500,
......
...@@ -7,7 +7,7 @@ describe('Alert Handler', () => { ...@@ -7,7 +7,7 @@ describe('Alert Handler', () => {
const DISMISS_CLASS = 'gl-alert-dismiss'; const DISMISS_CLASS = 'gl-alert-dismiss';
const DISMISS_LABEL = 'Dismiss'; const DISMISS_LABEL = 'Dismiss';
const generateHtml = parentClass => const generateHtml = (parentClass) =>
`<div class="${parentClass}"> `<div class="${parentClass}">
<button aria-label="${DISMISS_LABEL}">Dismiss</button> <button aria-label="${DISMISS_LABEL}">Dismiss</button>
</div>`; </div>`;
......
...@@ -35,7 +35,7 @@ describe('AlertsServiceForm', () => { ...@@ -35,7 +35,7 @@ describe('AlertsServiceForm', () => {
const findUrl = () => wrapper.find('#url'); const findUrl = () => wrapper.find('#url');
const findAuthorizationKey = () => wrapper.find('#authorization-key'); const findAuthorizationKey = () => wrapper.find('#authorization-key');
const findDescription = () => wrapper.find('[data-testid="description"'); const findDescription = () => wrapper.find('[data-testid="description"');
const findActiveStatusIcon = val => const findActiveStatusIcon = (val) =>
document.querySelector(`.js-service-active-status[data-value=${val.toString()}]`); document.querySelector(`.js-service-active-status[data-value=${val.toString()}]`);
beforeEach(() => { beforeEach(() => {
......
...@@ -63,7 +63,7 @@ describe('AlertMappingBuilder', () => { ...@@ -63,7 +63,7 @@ describe('AlertMappingBuilder', () => {
const dropdownItems = dropdown.findAll(GlDropdownItem); const dropdownItems = dropdown.findAll(GlDropdownItem);
const { nodes } = parsedMapping.samplePayload.payloadAlerFields; const { nodes } = parsedMapping.samplePayload.payloadAlerFields;
const numberOfMappingOptions = nodes.filter(({ type }) => const numberOfMappingOptions = nodes.filter(({ type }) =>
type.some(t => compatibleTypes.includes(t)), type.some((t) => compatibleTypes.includes(t)),
); );
expect(dropdown.exists()).toBe(true); expect(dropdown.exists()).toBe(true);
...@@ -82,7 +82,7 @@ describe('AlertMappingBuilder', () => { ...@@ -82,7 +82,7 @@ describe('AlertMappingBuilder', () => {
const dropdownItems = dropdown.findAll(GlDropdownItem); const dropdownItems = dropdown.findAll(GlDropdownItem);
const { nodes } = parsedMapping.samplePayload.payloadAlerFields; const { nodes } = parsedMapping.samplePayload.payloadAlerFields;
const numberOfMappingOptions = nodes.filter(({ type }) => const numberOfMappingOptions = nodes.filter(({ type }) =>
type.some(t => compatibleTypes.includes(t)), type.some((t) => compatibleTypes.includes(t)),
); );
expect(searchBox.exists()).toBe(Boolean(numberOfFallbacks)); expect(searchBox.exists()).toBe(Boolean(numberOfFallbacks));
......
...@@ -379,7 +379,7 @@ describe('AlertsSettingsWrapper', () => { ...@@ -379,7 +379,7 @@ describe('AlertsSettingsWrapper', () => {
// TODO: Will be removed in 13.7 as part of: https://gitlab.com/gitlab-org/gitlab/-/issues/273657 // TODO: Will be removed in 13.7 as part of: https://gitlab.com/gitlab-org/gitlab/-/issues/273657
describe('Opsgenie integration', () => { describe('Opsgenie integration', () => {
it.each([true, false])('it shows/hides the alert when opsgenie is %s', active => { it.each([true, false])('it shows/hides the alert when opsgenie is %s', (active) => {
createComponent({ createComponent({
data: { integrations: { list: mockIntegrations }, currentIntegration: mockIntegrations[0] }, data: { integrations: { list: mockIntegrations }, currentIntegration: mockIntegrations[0] },
provide: { opsgenie: { active } }, provide: { opsgenie: { active } },
......
...@@ -25,11 +25,11 @@ describe('InstanceStatisticsApp', () => { ...@@ -25,11 +25,11 @@ describe('InstanceStatisticsApp', () => {
expect(wrapper.find(InstanceCounts).exists()).toBe(true); expect(wrapper.find(InstanceCounts).exists()).toBe(true);
}); });
['Pipelines', 'Issues & Merge Requests'].forEach(instance => { ['Pipelines', 'Issues & Merge Requests'].forEach((instance) => {
it(`displays the ${instance} chart`, () => { it(`displays the ${instance} chart`, () => {
const chartTitles = wrapper const chartTitles = wrapper
.findAll(InstanceStatisticsCountChart) .findAll(InstanceStatisticsCountChart)
.wrappers.map(chartComponent => chartComponent.props('chartTitle')); .wrappers.map((chartComponent) => chartComponent.props('chartTitle'));
expect(chartTitles).toContain(instance); expect(chartTitles).toContain(instance);
}); });
......
This diff is collapsed.
...@@ -34,8 +34,8 @@ describe('RecoveryCodes', () => { ...@@ -34,8 +34,8 @@ describe('RecoveryCodes', () => {
const findAlert = () => wrapper.find(GlAlert); const findAlert = () => wrapper.find(GlAlert);
const findRecoveryCodes = () => wrapper.findByTestId('recovery-codes'); const findRecoveryCodes = () => wrapper.findByTestId('recovery-codes');
const findCopyButton = () => wrapper.find(ClipboardButton); const findCopyButton = () => wrapper.find(ClipboardButton);
const findButtonByText = text => const findButtonByText = (text) =>
wrapper.findAll(GlButton).wrappers.find(buttonWrapper => buttonWrapper.text() === text); wrapper.findAll(GlButton).wrappers.find((buttonWrapper) => buttonWrapper.text() === text);
const findDownloadButton = () => findButtonByText('Download codes'); const findDownloadButton = () => findButtonByText('Download codes');
const findPrintButton = () => findButtonByText('Print codes'); const findPrintButton = () => findButtonByText('Print codes');
const findProceedButton = () => findButtonByText('Proceed'); const findProceedButton = () => findButtonByText('Proceed');
...@@ -59,7 +59,7 @@ describe('RecoveryCodes', () => { ...@@ -59,7 +59,7 @@ describe('RecoveryCodes', () => {
it('renders codes', () => { it('renders codes', () => {
const recoveryCodes = findRecoveryCodes().text(); const recoveryCodes = findRecoveryCodes().text();
codes.forEach(code => { codes.forEach((code) => {
expect(recoveryCodes).toContain(code); expect(recoveryCodes).toContain(code);
}); });
}); });
......
...@@ -38,7 +38,7 @@ describe('U2FAuthenticate', () => { ...@@ -38,7 +38,7 @@ describe('U2FAuthenticate', () => {
window.u2f = oldu2f; window.u2f = oldu2f;
}); });
it('falls back to normal 2fa', done => { it('falls back to normal 2fa', (done) => {
component component
.start() .start()
.then(() => { .then(() => {
...@@ -50,7 +50,7 @@ describe('U2FAuthenticate', () => { ...@@ -50,7 +50,7 @@ describe('U2FAuthenticate', () => {
}); });
describe('with u2f available', () => { describe('with u2f available', () => {
beforeEach(done => { beforeEach((done) => {
// bypass automatic form submission within renderAuthenticated // bypass automatic form submission within renderAuthenticated
jest.spyOn(component, 'renderAuthenticated').mockReturnValue(true); jest.spyOn(component, 'renderAuthenticated').mockReturnValue(true);
u2fDevice = new MockU2FDevice(); u2fDevice = new MockU2FDevice();
......
...@@ -10,7 +10,7 @@ describe('U2FRegister', () => { ...@@ -10,7 +10,7 @@ describe('U2FRegister', () => {
preloadFixtures('u2f/register.html'); preloadFixtures('u2f/register.html');
beforeEach(done => { beforeEach((done) => {
loadFixtures('u2f/register.html'); loadFixtures('u2f/register.html');
u2fDevice = new MockU2FDevice(); u2fDevice = new MockU2FDevice();
container = $('#js-register-token-2fa'); container = $('#js-register-token-2fa');
......
...@@ -63,7 +63,7 @@ describe('AwardsHandler', () => { ...@@ -63,7 +63,7 @@ describe('AwardsHandler', () => {
const $menu = $('.emoji-menu'); const $menu = $('.emoji-menu');
return new Promise(resolve => { return new Promise((resolve) => {
$menu.one('build-emoji-menu-finish', () => { $menu.one('build-emoji-menu-finish', () => {
resolve(); resolve();
}); });
...@@ -356,7 +356,7 @@ describe('AwardsHandler', () => { ...@@ -356,7 +356,7 @@ describe('AwardsHandler', () => {
await openAndWaitForEmojiMenu(); await openAndWaitForEmojiMenu();
const emojiMenu = document.querySelector('.emoji-menu'); const emojiMenu = document.querySelector('.emoji-menu');
Array.prototype.forEach.call(emojiMenu.querySelectorAll('.emoji-menu-title'), title => { Array.prototype.forEach.call(emojiMenu.querySelectorAll('.emoji-menu-title'), (title) => {
expect(title.textContent.trim().toLowerCase()).not.toBe('frequently used'); expect(title.textContent.trim().toLowerCase()).not.toBe('frequently used');
}); });
}); });
...@@ -369,7 +369,7 @@ describe('AwardsHandler', () => { ...@@ -369,7 +369,7 @@ describe('AwardsHandler', () => {
const emojiMenu = document.querySelector('.emoji-menu'); const emojiMenu = document.querySelector('.emoji-menu');
const hasFrequentlyUsedHeading = Array.prototype.some.call( const hasFrequentlyUsedHeading = Array.prototype.some.call(
emojiMenu.querySelectorAll('.emoji-menu-title'), emojiMenu.querySelectorAll('.emoji-menu-title'),
title => title.textContent.trim().toLowerCase() === 'frequently used', (title) => title.textContent.trim().toLowerCase() === 'frequently used',
); );
expect(hasFrequentlyUsedHeading).toBe(true); expect(hasFrequentlyUsedHeading).toBe(true);
......
...@@ -50,7 +50,7 @@ describe('BadgeForm component', () => { ...@@ -50,7 +50,7 @@ describe('BadgeForm component', () => {
}); });
}); });
const sharedSubmitTests = submitAction => { const sharedSubmitTests = (submitAction) => {
const nameSelector = '#badge-name'; const nameSelector = '#badge-name';
const imageUrlSelector = '#badge-image-url'; const imageUrlSelector = '#badge-image-url';
const findImageUrlElement = () => vm.$el.querySelector(imageUrlSelector); const findImageUrlElement = () => vm.$el.querySelector(imageUrlSelector);
...@@ -65,7 +65,7 @@ describe('BadgeForm component', () => { ...@@ -65,7 +65,7 @@ describe('BadgeForm component', () => {
const submitButton = vm.$el.querySelector('button[type="submit"]'); const submitButton = vm.$el.querySelector('button[type="submit"]');
submitButton.click(); submitButton.click();
}; };
const expectInvalidInput = inputElementSelector => { const expectInvalidInput = (inputElementSelector) => {
const inputElement = vm.$el.querySelector(inputElementSelector); const inputElement = vm.$el.querySelector(inputElementSelector);
expect(inputElement.checkValidity()).toBe(false); expect(inputElement.checkValidity()).toBe(false);
...@@ -74,7 +74,7 @@ describe('BadgeForm component', () => { ...@@ -74,7 +74,7 @@ describe('BadgeForm component', () => {
expect(feedbackElement).toBeVisible(); expect(feedbackElement).toBeVisible();
}; };
beforeEach(done => { beforeEach((done) => {
jest.spyOn(vm, submitAction).mockReturnValue(Promise.resolve()); jest.spyOn(vm, submitAction).mockReturnValue(Promise.resolve());
store.replaceState({ store.replaceState({
...store.state, ...store.state,
......
...@@ -73,7 +73,7 @@ describe('BadgeListRow component', () => { ...@@ -73,7 +73,7 @@ describe('BadgeListRow component', () => {
expect(vm.editBadge).toHaveBeenCalled(); expect(vm.editBadge).toHaveBeenCalled();
}); });
it('calls updateBadgeInModal and shows modal when clicking then delete button', done => { it('calls updateBadgeInModal and shows modal when clicking then delete button', (done) => {
jest.spyOn(vm, 'updateBadgeInModal').mockImplementation(() => {}); jest.spyOn(vm, 'updateBadgeInModal').mockImplementation(() => {});
const deleteButton = vm.$el.querySelector('.table-button-footer button:last-of-type'); const deleteButton = vm.$el.querySelector('.table-button-footer button:last-of-type');
...@@ -88,7 +88,7 @@ describe('BadgeListRow component', () => { ...@@ -88,7 +88,7 @@ describe('BadgeListRow component', () => {
}); });
describe('for a group badge', () => { describe('for a group badge', () => {
beforeEach(done => { beforeEach((done) => {
badge.kind = GROUP_BADGE; badge.kind = GROUP_BADGE;
Vue.nextTick().then(done).catch(done.fail); Vue.nextTick().then(done).catch(done.fail);
......
...@@ -48,7 +48,7 @@ describe('BadgeList component', () => { ...@@ -48,7 +48,7 @@ describe('BadgeList component', () => {
expect(rows).toHaveLength(numberOfDummyBadges); expect(rows).toHaveLength(numberOfDummyBadges);
}); });
it('renders a message if no badges exist', done => { it('renders a message if no badges exist', (done) => {
store.state.badges = []; store.state.badges = [];
Vue.nextTick() Vue.nextTick()
...@@ -59,7 +59,7 @@ describe('BadgeList component', () => { ...@@ -59,7 +59,7 @@ describe('BadgeList component', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('shows a loading icon when loading', done => { it('shows a loading icon when loading', (done) => {
store.state.isLoading = true; store.state.isLoading = true;
Vue.nextTick() Vue.nextTick()
...@@ -73,13 +73,13 @@ describe('BadgeList component', () => { ...@@ -73,13 +73,13 @@ describe('BadgeList component', () => {
}); });
describe('for group badges', () => { describe('for group badges', () => {
beforeEach(done => { beforeEach((done) => {
store.state.kind = GROUP_BADGE; store.state.kind = GROUP_BADGE;
Vue.nextTick().then(done).catch(done.fail); Vue.nextTick().then(done).catch(done.fail);
}); });
it('renders a message if no badges exist', done => { it('renders a message if no badges exist', (done) => {
store.state.badges = []; store.state.badges = [];
Vue.nextTick() Vue.nextTick()
......
...@@ -23,7 +23,7 @@ describe('Badge component', () => { ...@@ -23,7 +23,7 @@ describe('Badge component', () => {
const createComponent = (props, el = null) => { const createComponent = (props, el = null) => {
vm = mountComponent(Component, props, el); vm = mountComponent(Component, props, el);
const { badgeImage } = findElements(); const { badgeImage } = findElements();
return new Promise(resolve => { return new Promise((resolve) => {
badgeImage.addEventListener('load', resolve); badgeImage.addEventListener('load', resolve);
// Manually dispatch load event as it is not triggered // Manually dispatch load event as it is not triggered
badgeImage.dispatchEvent(new Event('load')); badgeImage.dispatchEvent(new Event('load'));
...@@ -36,7 +36,7 @@ describe('Badge component', () => { ...@@ -36,7 +36,7 @@ describe('Badge component', () => {
describe('watchers', () => { describe('watchers', () => {
describe('imageUrl', () => { describe('imageUrl', () => {
it('sets isLoading and resets numRetries and hasError', done => { it('sets isLoading and resets numRetries and hasError', (done) => {
const props = { ...dummyProps }; const props = { ...dummyProps };
createComponent(props) createComponent(props)
.then(() => { .then(() => {
...@@ -60,7 +60,7 @@ describe('Badge component', () => { ...@@ -60,7 +60,7 @@ describe('Badge component', () => {
}); });
describe('methods', () => { describe('methods', () => {
beforeEach(done => { beforeEach((done) => {
createComponent({ ...dummyProps }) createComponent({ ...dummyProps })
.then(done) .then(done)
.catch(done.fail); .catch(done.fail);
...@@ -98,7 +98,7 @@ describe('Badge component', () => { ...@@ -98,7 +98,7 @@ describe('Badge component', () => {
}); });
describe('behavior', () => { describe('behavior', () => {
beforeEach(done => { beforeEach((done) => {
setFixtures('<div id="dummy-element"></div>'); setFixtures('<div id="dummy-element"></div>');
createComponent({ ...dummyProps }, '#dummy-element') createComponent({ ...dummyProps }, '#dummy-element')
.then(done) .then(done)
...@@ -116,7 +116,7 @@ describe('Badge component', () => { ...@@ -116,7 +116,7 @@ describe('Badge component', () => {
expect(vm.$el.querySelector('.btn-group')).toBeHidden(); expect(vm.$el.querySelector('.btn-group')).toBeHidden();
}); });
it('shows a loading icon when loading', done => { it('shows a loading icon when loading', (done) => {
vm.isLoading = true; vm.isLoading = true;
Vue.nextTick() Vue.nextTick()
...@@ -132,7 +132,7 @@ describe('Badge component', () => { ...@@ -132,7 +132,7 @@ describe('Badge component', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('shows an error and reload button if loading failed', done => { it('shows an error and reload button if loading failed', (done) => {
vm.hasError = true; vm.hasError = true;
Vue.nextTick() Vue.nextTick()
......
This diff is collapsed.
...@@ -65,7 +65,7 @@ describe('Batch comments draft note component', () => { ...@@ -65,7 +65,7 @@ describe('Batch comments draft note component', () => {
); );
}); });
it('sets as loading when draft is publishing', done => { it('sets as loading when draft is publishing', (done) => {
createComponent(); createComponent();
wrapper.vm.$store.state.batchComments.currentlyPublishingDrafts.push(1); wrapper.vm.$store.state.batchComments.currentlyPublishingDrafts.push(1);
...@@ -80,7 +80,7 @@ describe('Batch comments draft note component', () => { ...@@ -80,7 +80,7 @@ describe('Batch comments draft note component', () => {
}); });
describe('update', () => { describe('update', () => {
it('dispatches updateDraft', done => { it('dispatches updateDraft', (done) => {
createComponent(); createComponent();
const note = wrapper.find(NoteableNote); const note = wrapper.find(NoteableNote);
...@@ -121,7 +121,7 @@ describe('Batch comments draft note component', () => { ...@@ -121,7 +121,7 @@ describe('Batch comments draft note component', () => {
}); });
describe('quick actions', () => { describe('quick actions', () => {
it('renders referenced commands', done => { it('renders referenced commands', (done) => {
createComponent(); createComponent();
wrapper.setProps({ wrapper.setProps({
draft: { draft: {
......
...@@ -27,7 +27,7 @@ describe('Batch comments drafts count component', () => { ...@@ -27,7 +27,7 @@ describe('Batch comments drafts count component', () => {
expect(vm.$el.textContent).toContain('1'); expect(vm.$el.textContent).toContain('1');
}); });
it('renders screen reader text', done => { it('renders screen reader text', (done) => {
const el = vm.$el.querySelector('.sr-only'); const el = vm.$el.querySelector('.sr-only');
expect(el.textContent).toContain('draft'); expect(el.textContent).toContain('draft');
......
...@@ -85,7 +85,7 @@ describe('Batch comments draft preview item component', () => { ...@@ -85,7 +85,7 @@ describe('Batch comments draft preview item component', () => {
describe('for thread', () => { describe('for thread', () => {
beforeEach(() => { beforeEach(() => {
createComponent(false, { discussion_id: '1', resolve_discussion: true }, store => { createComponent(false, { discussion_id: '1', resolve_discussion: true }, (store) => {
store.state.notes.discussions.push({ store.state.notes.discussions.push({
id: '1', id: '1',
notes: [ notes: [
......
...@@ -29,7 +29,7 @@ describe('Batch comments publish button component', () => { ...@@ -29,7 +29,7 @@ describe('Batch comments publish button component', () => {
expect(vm.$store.dispatch).toHaveBeenCalledWith('batchComments/publishReview', undefined); expect(vm.$store.dispatch).toHaveBeenCalledWith('batchComments/publishReview', undefined);
}); });
it('sets loading when isPublishing is true', done => { it('sets loading when isPublishing is true', (done) => {
vm.$store.state.batchComments.isPublishing = true; vm.$store.state.batchComments.isPublishing = true;
vm.$nextTick(() => { vm.$nextTick(() => {
......
...@@ -28,7 +28,7 @@ describe('Batch comments store actions', () => { ...@@ -28,7 +28,7 @@ describe('Batch comments store actions', () => {
}); });
describe('addDraftToDiscussion', () => { describe('addDraftToDiscussion', () => {
it('commits ADD_NEW_DRAFT if no errors returned', done => { it('commits ADD_NEW_DRAFT if no errors returned', (done) => {
res = { id: 1 }; res = { id: 1 };
mock.onAny().reply(200, res); mock.onAny().reply(200, res);
...@@ -42,7 +42,7 @@ describe('Batch comments store actions', () => { ...@@ -42,7 +42,7 @@ describe('Batch comments store actions', () => {
); );
}); });
it('does not commit ADD_NEW_DRAFT if errors returned', done => { it('does not commit ADD_NEW_DRAFT if errors returned', (done) => {
mock.onAny().reply(500); mock.onAny().reply(500);
testAction( testAction(
...@@ -57,7 +57,7 @@ describe('Batch comments store actions', () => { ...@@ -57,7 +57,7 @@ describe('Batch comments store actions', () => {
}); });
describe('createNewDraft', () => { describe('createNewDraft', () => {
it('commits ADD_NEW_DRAFT if no errors returned', done => { it('commits ADD_NEW_DRAFT if no errors returned', (done) => {
res = { id: 1 }; res = { id: 1 };
mock.onAny().reply(200, res); mock.onAny().reply(200, res);
...@@ -71,7 +71,7 @@ describe('Batch comments store actions', () => { ...@@ -71,7 +71,7 @@ describe('Batch comments store actions', () => {
); );
}); });
it('does not commit ADD_NEW_DRAFT if errors returned', done => { it('does not commit ADD_NEW_DRAFT if errors returned', (done) => {
mock.onAny().reply(500); mock.onAny().reply(500);
testAction(actions.createNewDraft, { endpoint: TEST_HOST, data: 'test' }, null, [], [], done); testAction(actions.createNewDraft, { endpoint: TEST_HOST, data: 'test' }, null, [], [], done);
...@@ -89,7 +89,7 @@ describe('Batch comments store actions', () => { ...@@ -89,7 +89,7 @@ describe('Batch comments store actions', () => {
}; };
}); });
it('commits DELETE_DRAFT if no errors returned', done => { it('commits DELETE_DRAFT if no errors returned', (done) => {
const commit = jest.fn(); const commit = jest.fn();
const context = { const context = {
getters, getters,
...@@ -107,7 +107,7 @@ describe('Batch comments store actions', () => { ...@@ -107,7 +107,7 @@ describe('Batch comments store actions', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('does not commit DELETE_DRAFT if errors returned', done => { it('does not commit DELETE_DRAFT if errors returned', (done) => {
const commit = jest.fn(); const commit = jest.fn();
const context = { const context = {
getters, getters,
...@@ -136,7 +136,7 @@ describe('Batch comments store actions', () => { ...@@ -136,7 +136,7 @@ describe('Batch comments store actions', () => {
}; };
}); });
it('commits SET_BATCH_COMMENTS_DRAFTS with returned data', done => { it('commits SET_BATCH_COMMENTS_DRAFTS with returned data', (done) => {
const commit = jest.fn(); const commit = jest.fn();
const context = { const context = {
getters, getters,
...@@ -170,7 +170,7 @@ describe('Batch comments store actions', () => { ...@@ -170,7 +170,7 @@ describe('Batch comments store actions', () => {
rootGetters = { discussionsStructuredByLineCode: 'discussions' }; rootGetters = { discussionsStructuredByLineCode: 'discussions' };
}); });
it('dispatches actions & commits', done => { it('dispatches actions & commits', (done) => {
mock.onAny().reply(200); mock.onAny().reply(200);
actions actions
...@@ -185,7 +185,7 @@ describe('Batch comments store actions', () => { ...@@ -185,7 +185,7 @@ describe('Batch comments store actions', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('dispatches error commits', done => { it('dispatches error commits', (done) => {
mock.onAny().reply(500); mock.onAny().reply(500);
actions actions
...@@ -210,7 +210,7 @@ describe('Batch comments store actions', () => { ...@@ -210,7 +210,7 @@ describe('Batch comments store actions', () => {
}; };
}); });
it('commits RECEIVE_DRAFT_UPDATE_SUCCESS with returned data', done => { it('commits RECEIVE_DRAFT_UPDATE_SUCCESS with returned data', (done) => {
const commit = jest.fn(); const commit = jest.fn();
const context = { const context = {
getters, getters,
...@@ -228,7 +228,7 @@ describe('Batch comments store actions', () => { ...@@ -228,7 +228,7 @@ describe('Batch comments store actions', () => {
.catch(done.fail); .catch(done.fail);
}); });
it('calls passed callback', done => { it('calls passed callback', (done) => {
const commit = jest.fn(); const commit = jest.fn();
const context = { const context = {
getters, getters,
...@@ -249,7 +249,7 @@ describe('Batch comments store actions', () => { ...@@ -249,7 +249,7 @@ describe('Batch comments store actions', () => {
}); });
describe('expandAllDiscussions', () => { describe('expandAllDiscussions', () => {
it('dispatches expandDiscussion for all drafts', done => { it('dispatches expandDiscussion for all drafts', (done) => {
const state = { const state = {
drafts: [ drafts: [
{ {
......
...@@ -6,7 +6,7 @@ function load() { ...@@ -6,7 +6,7 @@ function load() {
jest.mock('~/helpers/startup_css_helper', () => { jest.mock('~/helpers/startup_css_helper', () => {
return { return {
waitForCSSLoaded: jest.fn().mockImplementation(cb => cb.apply()), waitForCSSLoaded: jest.fn().mockImplementation((cb) => cb.apply()),
}; };
}); });
......
...@@ -57,7 +57,7 @@ describe('CopyAsGFM', () => { ...@@ -57,7 +57,7 @@ describe('CopyAsGFM', () => {
const fragment = document.createDocumentFragment(); const fragment = document.createDocumentFragment();
const node = document.createElement('div'); const node = document.createElement('div');
node.innerHTML = html; node.innerHTML = html;
Array.from(node.childNodes).forEach(item => fragment.appendChild(item)); Array.from(node.childNodes).forEach((item) => fragment.appendChild(item));
return fragment; return fragment;
}, },
}), }),
...@@ -80,7 +80,7 @@ describe('CopyAsGFM', () => { ...@@ -80,7 +80,7 @@ describe('CopyAsGFM', () => {
return clipboardData; return clipboardData;
}; };
beforeAll(done => { beforeAll((done) => {
initCopyAsGFM(); initCopyAsGFM();
// Fake call to nodeToGfm so the import of lazy bundle happened // Fake call to nodeToGfm so the import of lazy bundle happened
...@@ -94,7 +94,7 @@ describe('CopyAsGFM', () => { ...@@ -94,7 +94,7 @@ describe('CopyAsGFM', () => {
beforeEach(() => jest.spyOn(clipboardData, 'setData')); beforeEach(() => jest.spyOn(clipboardData, 'setData'));
describe('list handling', () => { describe('list handling', () => {
it('uses correct gfm for unordered lists', done => { it('uses correct gfm for unordered lists', (done) => {
const selection = stubSelection('<li>List Item1</li><li>List Item2</li>\n', 'UL'); const selection = stubSelection('<li>List Item1</li><li>List Item2</li>\n', 'UL');
window.getSelection = jest.fn(() => selection); window.getSelection = jest.fn(() => selection);
...@@ -108,7 +108,7 @@ describe('CopyAsGFM', () => { ...@@ -108,7 +108,7 @@ describe('CopyAsGFM', () => {
}); });
}); });
it('uses correct gfm for ordered lists', done => { it('uses correct gfm for ordered lists', (done) => {
const selection = stubSelection('<li>List Item1</li><li>List Item2</li>\n', 'OL'); const selection = stubSelection('<li>List Item1</li><li>List Item2</li>\n', 'OL');
window.getSelection = jest.fn(() => selection); window.getSelection = jest.fn(() => selection);
...@@ -127,7 +127,7 @@ describe('CopyAsGFM', () => { ...@@ -127,7 +127,7 @@ describe('CopyAsGFM', () => {
describe('CopyAsGFM.quoted', () => { describe('CopyAsGFM.quoted', () => {
const sampleGFM = '* List 1\n* List 2\n\n`Some code`'; const sampleGFM = '* List 1\n* List 2\n\n`Some code`';
it('adds quote char `> ` to each line', done => { it('adds quote char `> ` to each line', (done) => {
const expectedQuotedGFM = '> * List 1\n> * List 2\n> \n> `Some code`'; const expectedQuotedGFM = '> * List 1\n> * List 2\n> \n> `Some code`';
expect(CopyAsGFM.quoted(sampleGFM)).toEqual(expectedQuotedGFM); expect(CopyAsGFM.quoted(sampleGFM)).toEqual(expectedQuotedGFM);
done(); done();
......
...@@ -7,7 +7,7 @@ describe('behaviors/load_startup_css', () => { ...@@ -7,7 +7,7 @@ describe('behaviors/load_startup_css', () => {
const setupListeners = () => { const setupListeners = () => {
document document
.querySelectorAll('link') .querySelectorAll('link')
.forEach(x => x.addEventListener('load', () => loadListener(x))); .forEach((x) => x.addEventListener('load', () => loadListener(x)));
}; };
beforeEach(() => { beforeEach(() => {
......
...@@ -8,7 +8,7 @@ describe('PasteMarkdownTable', () => { ...@@ -8,7 +8,7 @@ describe('PasteMarkdownTable', () => {
Object.defineProperty(event, 'dataTransfer', { Object.defineProperty(event, 'dataTransfer', {
value: { value: {
getData: jest.fn().mockImplementation(type => { getData: jest.fn().mockImplementation((type) => {
if (type === 'text/html') { if (type === 'text/html') {
return '<table><tr><td>First</td><td>Second</td></tr></table>'; return '<table><tr><td>First</td><td>Second</td></tr></table>';
} }
...@@ -48,7 +48,7 @@ describe('PasteMarkdownTable', () => { ...@@ -48,7 +48,7 @@ describe('PasteMarkdownTable', () => {
it('returns false when the number of rows are not consistent', () => { it('returns false when the number of rows are not consistent', () => {
data.types = ['text/html', 'text/plain']; data.types = ['text/html', 'text/plain'];
data.getData = jest.fn().mockImplementation(mimeType => { data.getData = jest.fn().mockImplementation((mimeType) => {
if (mimeType === 'text/html') { if (mimeType === 'text/html') {
return '<table><tr><td>def test<td></tr></table>'; return '<table><tr><td>def test<td></tr></table>';
} }
...@@ -60,7 +60,7 @@ describe('PasteMarkdownTable', () => { ...@@ -60,7 +60,7 @@ describe('PasteMarkdownTable', () => {
it('returns false when the table copy comes from a diff', () => { it('returns false when the table copy comes from a diff', () => {
data.types = ['text/html', 'text/plain']; data.types = ['text/html', 'text/plain'];
data.getData = jest.fn().mockImplementation(mimeType => { data.getData = jest.fn().mockImplementation((mimeType) => {
if (mimeType === 'text/html') { if (mimeType === 'text/html') {
return '<table class="diff-wrap-lines"><tr><td>First</td><td>Second</td></tr></table>'; return '<table class="diff-wrap-lines"><tr><td>First</td><td>Second</td></tr></table>';
} }
...@@ -74,7 +74,7 @@ describe('PasteMarkdownTable', () => { ...@@ -74,7 +74,7 @@ describe('PasteMarkdownTable', () => {
describe('convertToTableMarkdown', () => { describe('convertToTableMarkdown', () => {
it('returns a Markdown table', () => { it('returns a Markdown table', () => {
data.types = ['text/html', 'text/plain']; data.types = ['text/html', 'text/plain'];
data.getData = jest.fn().mockImplementation(type => { data.getData = jest.fn().mockImplementation((type) => {
if (type === 'text/html') { if (type === 'text/html') {
return '<table><tr><td>First</td><td>Last</td><tr><td>John</td><td>Doe</td><tr><td>Jane</td><td>Doe</td></table>'; return '<table><tr><td>First</td><td>Last</td><tr><td>John</td><td>Doe</td><tr><td>Jane</td><td>Doe</td></table>';
} else if (type === 'text/plain') { } else if (type === 'text/plain') {
...@@ -99,7 +99,7 @@ describe('PasteMarkdownTable', () => { ...@@ -99,7 +99,7 @@ describe('PasteMarkdownTable', () => {
it('returns a Markdown table with rows normalized', () => { it('returns a Markdown table with rows normalized', () => {
data.types = ['text/html', 'text/plain']; data.types = ['text/html', 'text/plain'];
data.getData = jest.fn().mockImplementation(type => { data.getData = jest.fn().mockImplementation((type) => {
if (type === 'text/html') { if (type === 'text/html') {
return '<table><tr><td>First</td><td>Last</td><tr><td>John</td><td>Doe</td><tr><td>Jane</td><td>/td></table>'; return '<table><tr><td>First</td><td>Last</td><tr><td>John</td><td>Doe</td><tr><td>Jane</td><td>/td></table>';
} else if (type === 'text/plain') { } else if (type === 'text/plain') {
......
...@@ -17,7 +17,7 @@ describe('Quick Submit behavior', () => { ...@@ -17,7 +17,7 @@ describe('Quick Submit behavior', () => {
submit: jest.fn(), submit: jest.fn(),
}; };
$('form').submit(e => { $('form').submit((e) => {
// Prevent a form submit from moving us off the testing page // Prevent a form submit from moving us off the testing page
e.preventDefault(); e.preventDefault();
// Explicitly call the spie to know this function get's not called // Explicitly call the spie to know this function get's not called
......
...@@ -18,7 +18,7 @@ function generateValueMarkup( ...@@ -18,7 +18,7 @@ function generateValueMarkup(
function generateFixtureMarkup(secrets, isRevealed, valueClass, placeholderClass) { function generateFixtureMarkup(secrets, isRevealed, valueClass, placeholderClass) {
return ` return `
<div class="js-secret-container"> <div class="js-secret-container">
${secrets.map(secret => generateValueMarkup(secret, valueClass, placeholderClass)).join('')} ${secrets.map((secret) => generateValueMarkup(secret, valueClass, placeholderClass)).join('')}
<button <button
class="js-secret-value-reveal-button" class="js-secret-value-reveal-button"
data-secret-reveal-status="${isRevealed}" data-secret-reveal-status="${isRevealed}"
...@@ -122,12 +122,12 @@ describe('setupSecretValues', () => { ...@@ -122,12 +122,12 @@ describe('setupSecretValues', () => {
const placeholders = wrapper.querySelectorAll('.js-secret-value-placeholder'); const placeholders = wrapper.querySelectorAll('.js-secret-value-placeholder');
expect(values.length).toEqual(3); expect(values.length).toEqual(3);
values.forEach(value => { values.forEach((value) => {
expect(value.classList.contains('hide')).toEqual(true); expect(value.classList.contains('hide')).toEqual(true);
}); });
expect(placeholders.length).toEqual(3); expect(placeholders.length).toEqual(3);
placeholders.forEach(placeholder => { placeholders.forEach((placeholder) => {
expect(placeholder.classList.contains('hide')).toEqual(false); expect(placeholder.classList.contains('hide')).toEqual(false);
}); });
}); });
...@@ -141,24 +141,24 @@ describe('setupSecretValues', () => { ...@@ -141,24 +141,24 @@ describe('setupSecretValues', () => {
revealButton.click(); revealButton.click();
expect(values.length).toEqual(3); expect(values.length).toEqual(3);
values.forEach(value => { values.forEach((value) => {
expect(value.classList.contains('hide')).toEqual(false); expect(value.classList.contains('hide')).toEqual(false);
}); });
expect(placeholders.length).toEqual(3); expect(placeholders.length).toEqual(3);
placeholders.forEach(placeholder => { placeholders.forEach((placeholder) => {
expect(placeholder.classList.contains('hide')).toEqual(true); expect(placeholder.classList.contains('hide')).toEqual(true);
}); });
revealButton.click(); revealButton.click();
expect(values.length).toEqual(3); expect(values.length).toEqual(3);
values.forEach(value => { values.forEach((value) => {
expect(value.classList.contains('hide')).toEqual(true); expect(value.classList.contains('hide')).toEqual(true);
}); });
expect(placeholders.length).toEqual(3); expect(placeholders.length).toEqual(3);
placeholders.forEach(placeholder => { placeholders.forEach((placeholder) => {
expect(placeholder.classList.contains('hide')).toEqual(false); expect(placeholder.classList.contains('hide')).toEqual(false);
}); });
}); });
...@@ -181,24 +181,24 @@ describe('setupSecretValues', () => { ...@@ -181,24 +181,24 @@ describe('setupSecretValues', () => {
revealButton.click(); revealButton.click();
expect(values.length).toEqual(4); expect(values.length).toEqual(4);
values.forEach(value => { values.forEach((value) => {
expect(value.classList.contains('hide')).toEqual(false); expect(value.classList.contains('hide')).toEqual(false);
}); });
expect(placeholders.length).toEqual(4); expect(placeholders.length).toEqual(4);
placeholders.forEach(placeholder => { placeholders.forEach((placeholder) => {
expect(placeholder.classList.contains('hide')).toEqual(true); expect(placeholder.classList.contains('hide')).toEqual(true);
}); });
revealButton.click(); revealButton.click();
expect(values.length).toEqual(4); expect(values.length).toEqual(4);
values.forEach(value => { values.forEach((value) => {
expect(value.classList.contains('hide')).toEqual(true); expect(value.classList.contains('hide')).toEqual(true);
}); });
expect(placeholders.length).toEqual(4); expect(placeholders.length).toEqual(4);
placeholders.forEach(placeholder => { placeholders.forEach((placeholder) => {
expect(placeholder.classList.contains('hide')).toEqual(false); expect(placeholder.classList.contains('hide')).toEqual(false);
}); });
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment