Commit a223014a authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 29 spec files: 10 of 10

Mandatory not to break master. Automatically created with prettier.
parent 482d756c
...@@ -9,11 +9,3 @@ doc/api/graphql/reference/gitlab_schema.graphql ...@@ -9,11 +9,3 @@ doc/api/graphql/reference/gitlab_schema.graphql
*.css *.css
*.scss *.scss
*.md *.md
# temporarly ignored in order to migrate to prettier@2 more efficiently and iteratively:
spec/frontend/vue_shared/components
spec/frontend/vue_shared/directives
spec/frontend_integration/ide/helpers
spec/frontend_integration/test_helpers/factories
spec/frontend_integration/test_helpers/utils
spec/javascripts
...@@ -135,9 +135,7 @@ describe('vue_shared/components/awards_list', () => { ...@@ -135,9 +135,7 @@ describe('vue_shared/components/awards_list', () => {
it('with award clicked, it emits award', () => { it('with award clicked, it emits award', () => {
expect(wrapper.emitted().award).toBeUndefined(); expect(wrapper.emitted().award).toBeUndefined();
findAwardButtons() findAwardButtons().at(2).vm.$emit('click');
.at(2)
.vm.$emit('click');
expect(wrapper.emitted().award).toEqual([[EMOJI_SMILE]]); expect(wrapper.emitted().award).toEqual([[EMOJI_SMILE]]);
}); });
...@@ -162,9 +160,7 @@ describe('vue_shared/components/awards_list', () => { ...@@ -162,9 +160,7 @@ describe('vue_shared/components/awards_list', () => {
it('when clicked, it emits award as number', () => { it('when clicked, it emits award as number', () => {
expect(wrapper.emitted().award).toBeUndefined(); expect(wrapper.emitted().award).toBeUndefined();
findAwardButtons() findAwardButtons().at(0).vm.$emit('click');
.at(0)
.vm.$emit('click');
expect(wrapper.emitted().award).toEqual([[Number(EMOJI_100)]]); expect(wrapper.emitted().award).toEqual([[Number(EMOJI_100)]]);
}); });
......
...@@ -130,9 +130,7 @@ describe('ColorPicker', () => { ...@@ -130,9 +130,7 @@ describe('ColorPicker', () => {
it('has preset color selected', async () => { it('has preset color selected', async () => {
createComponent(); createComponent();
await presetColors() await presetColors().at(0).trigger('click');
.at(0)
.trigger('click');
expect(wrapper.vm.$data.selectedColor).toBe(setColor); expect(wrapper.vm.$data.selectedColor).toBe(setColor);
}); });
......
...@@ -43,12 +43,7 @@ describe('Commit component', () => { ...@@ -43,12 +43,7 @@ describe('Commit component', () => {
}, },
}); });
expect( expect(wrapper.find('.icon-container').find(GlIcon).exists()).toBe(true);
wrapper
.find('.icon-container')
.find(GlIcon)
.exists(),
).toBe(true);
}); });
describe('Given all the props', () => { describe('Given all the props', () => {
......
...@@ -41,12 +41,7 @@ describe('Expand button', () => { ...@@ -41,12 +41,7 @@ describe('Expand button', () => {
}); });
it('does not render expanded text', () => { it('does not render expanded text', () => {
expect( expect(wrapper.find(ExpandButton).text().trim()).not.toBe(text.short);
wrapper
.find(ExpandButton)
.text()
.trim(),
).not.toBe(text.short);
}); });
describe('when short text is provided', () => { describe('when short text is provided', () => {
...@@ -60,12 +55,7 @@ describe('Expand button', () => { ...@@ -60,12 +55,7 @@ describe('Expand button', () => {
}); });
it('renders short text', () => { it('renders short text', () => {
expect( expect(wrapper.find(ExpandButton).text().trim()).toBe(text.short);
wrapper
.find(ExpandButton)
.text()
.trim(),
).toBe(text.short);
}); });
it('renders button before text', () => { it('renders button before text', () => {
...@@ -108,12 +98,7 @@ describe('Expand button', () => { ...@@ -108,12 +98,7 @@ describe('Expand button', () => {
}); });
it('only renders expanded text', () => { it('only renders expanded text', () => {
expect( expect(wrapper.find(ExpandButton).text().trim()).toBe(text.expanded);
wrapper
.find(ExpandButton)
.text()
.trim(),
).toBe(text.expanded);
}); });
it('renders button after text', () => { it('renders button after text', () => {
...@@ -140,21 +125,11 @@ describe('Expand button', () => { ...@@ -140,21 +125,11 @@ describe('Expand button', () => {
}); });
it('clicking hides expanded text', () => { it('clicking hides expanded text', () => {
expect( expect(wrapper.find(ExpandButton).text().trim()).toBe(text.expanded);
wrapper
.find(ExpandButton)
.text()
.trim(),
).toBe(text.expanded);
expanderAppendEl().trigger('click'); expanderAppendEl().trigger('click');
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
expect( expect(wrapper.find(ExpandButton).text().trim()).not.toBe(text.expanded);
wrapper
.find(ExpandButton)
.text()
.trim(),
).not.toBe(text.expanded);
}); });
}); });
...@@ -172,21 +147,11 @@ describe('Expand button', () => { ...@@ -172,21 +147,11 @@ describe('Expand button', () => {
}); });
it('clicking reveals short text', () => { it('clicking reveals short text', () => {
expect( expect(wrapper.find(ExpandButton).text().trim()).toBe(text.expanded);
wrapper
.find(ExpandButton)
.text()
.trim(),
).toBe(text.expanded);
expanderAppendEl().trigger('click'); expanderAppendEl().trigger('click');
return wrapper.vm.$nextTick().then(() => { return wrapper.vm.$nextTick().then(() => {
expect( expect(wrapper.find(ExpandButton).text().trim()).toBe(text.short);
wrapper
.find(ExpandButton)
.text()
.trim(),
).toBe(text.short);
}); });
}); });
}); });
......
...@@ -82,7 +82,10 @@ describe('prepareTokens', () => { ...@@ -82,7 +82,10 @@ describe('prepareTokens', () => {
], ],
[ [
'assignees', 'assignees',
[{ value: 'krillin', operator: '=' }, { value: 'piccolo', operator: '!=' }], [
{ value: 'krillin', operator: '=' },
{ value: 'piccolo', operator: '!=' },
],
[ [
{ type: 'assignees', value: { data: 'krillin', operator: '=' } }, { type: 'assignees', value: { data: 'krillin', operator: '=' } },
{ type: 'assignees', value: { data: 'piccolo', operator: '!=' } }, { type: 'assignees', value: { data: 'piccolo', operator: '!=' } },
...@@ -90,7 +93,10 @@ describe('prepareTokens', () => { ...@@ -90,7 +93,10 @@ describe('prepareTokens', () => {
], ],
[ [
'foo', 'foo',
[{ value: 'bar', operator: '!=' }, { value: 'baz', operator: '!=' }], [
{ value: 'bar', operator: '!=' },
{ value: 'baz', operator: '!=' },
],
[ [
{ type: 'foo', value: { data: 'bar', operator: '!=' } }, { type: 'foo', value: { data: 'bar', operator: '!=' } },
{ type: 'foo', value: { data: 'baz', operator: '!=' } }, { type: 'foo', value: { data: 'baz', operator: '!=' } },
...@@ -112,7 +118,10 @@ describe('processFilters', () => { ...@@ -112,7 +118,10 @@ describe('processFilters', () => {
expect(result).toStrictEqual({ expect(result).toStrictEqual({
foo: [{ value: 'foo', operator: '=' }], foo: [{ value: 'foo', operator: '=' }],
bar: [{ value: 'bar1', operator: '=' }, { value: 'bar2', operator: '!=' }], bar: [
{ value: 'bar1', operator: '=' },
{ value: 'bar2', operator: '!=' },
],
}); });
}); });
...@@ -164,17 +173,26 @@ describe('filterToQueryObject', () => { ...@@ -164,17 +173,26 @@ describe('filterToQueryObject', () => {
], ],
[ [
'foo', 'foo',
[{ value: 'bar', operator: '=' }, { value: 'baz', operator: '=' }], [
{ value: 'bar', operator: '=' },
{ value: 'baz', operator: '=' },
],
{ foo: ['bar', 'baz'], 'not[foo]': null }, { foo: ['bar', 'baz'], 'not[foo]': null },
], ],
[ [
'foo', 'foo',
[{ value: 'bar', operator: '!=' }, { value: 'baz', operator: '!=' }], [
{ value: 'bar', operator: '!=' },
{ value: 'baz', operator: '!=' },
],
{ foo: null, 'not[foo]': ['bar', 'baz'] }, { foo: null, 'not[foo]': ['bar', 'baz'] },
], ],
[ [
'foo', 'foo',
[{ value: 'bar', operator: '!=' }, { value: 'baz', operator: '=' }], [
{ value: 'bar', operator: '!=' },
{ value: 'baz', operator: '=' },
],
{ foo: ['baz'], 'not[foo]': ['bar'] }, { foo: ['baz'], 'not[foo]': ['bar'] },
], ],
])('gathers filter values %s=%j into query object=%j', (token, value, result) => { ])('gathers filter values %s=%j into query object=%j', (token, value, result) => {
...@@ -200,15 +218,30 @@ describe('urlQueryToFilter', () => { ...@@ -200,15 +218,30 @@ describe('urlQueryToFilter', () => {
['not[foo]=bar&foo=baz', { foo: { value: 'baz', operator: '=' } }], ['not[foo]=bar&foo=baz', { foo: { value: 'baz', operator: '=' } }],
[ [
'foo[]=bar&foo[]=baz&not[foo]=', 'foo[]=bar&foo[]=baz&not[foo]=',
{ foo: [{ value: 'bar', operator: '=' }, { value: 'baz', operator: '=' }] }, {
foo: [
{ value: 'bar', operator: '=' },
{ value: 'baz', operator: '=' },
],
},
], ],
[ [
'foo[]=&not[foo][]=bar&not[foo][]=baz', 'foo[]=&not[foo][]=bar&not[foo][]=baz',
{ foo: [{ value: 'bar', operator: '!=' }, { value: 'baz', operator: '!=' }] }, {
foo: [
{ value: 'bar', operator: '!=' },
{ value: 'baz', operator: '!=' },
],
},
], ],
[ [
'foo[]=baz&not[foo][]=bar', 'foo[]=baz&not[foo][]=bar',
{ foo: [{ value: 'baz', operator: '=' }, { value: 'bar', operator: '!=' }] }, {
foo: [
{ value: 'baz', operator: '=' },
{ value: 'bar', operator: '!=' },
],
},
], ],
['not[foo][]=bar', { foo: [{ value: 'bar', operator: '!=' }] }], ['not[foo][]=bar', { foo: [{ value: 'bar', operator: '!=' }] }],
])('gathers filter values %s into query object=%j', (query, result) => { ])('gathers filter values %s into query object=%j', (query, result) => {
......
...@@ -110,7 +110,10 @@ export const mockMembershipToken = { ...@@ -110,7 +110,10 @@ export const mockMembershipToken = {
token: GlFilteredSearchToken, token: GlFilteredSearchToken,
unique: true, unique: true,
operators: [{ value: '=', description: 'is' }], operators: [{ value: '=', description: 'is' }],
options: [{ value: 'exclude', title: 'Direct' }, { value: 'only', title: 'Inherited' }], options: [
{ value: 'exclude', title: 'Direct' },
{ value: 'only', title: 'Inherited' },
],
}; };
export const mockMembershipTokenOptionsWithoutTitles = { export const mockMembershipTokenOptionsWithoutTitles = {
......
...@@ -181,12 +181,9 @@ describe('LabelToken', () => { ...@@ -181,12 +181,9 @@ describe('LabelToken', () => {
expect(tokenSegments).toHaveLength(3); // Label, =, "Foo Label" expect(tokenSegments).toHaveLength(3); // Label, =, "Foo Label"
expect(tokenSegments.at(2).text()).toBe(`~${mockRegularLabel.title}`); // "Foo Label" expect(tokenSegments.at(2).text()).toBe(`~${mockRegularLabel.title}`); // "Foo Label"
expect( expect(tokenSegments.at(2).find('.gl-token').attributes('style')).toBe(
tokenSegments 'background-color: rgb(186, 218, 85); color: rgb(255, 255, 255);',
.at(2) );
.find('.gl-token')
.attributes('style'),
).toBe('background-color: rgb(186, 218, 85); color: rgb(255, 255, 255);');
}); });
it('renders provided defaultLabels as suggestions', async () => { it('renders provided defaultLabels as suggestions', async () => {
......
...@@ -140,7 +140,10 @@ describe('MilestoneToken', () => { ...@@ -140,7 +140,10 @@ describe('MilestoneToken', () => {
}); });
describe('template', () => { describe('template', () => {
const defaultMilestones = [{ text: 'foo', value: 'foo' }, { text: 'bar', value: 'baz' }]; const defaultMilestones = [
{ text: 'foo', value: 'foo' },
{ text: 'bar', value: 'baz' },
];
beforeEach(async () => { beforeEach(async () => {
wrapper = createComponent({ value: { data: `"${mockRegularMilestone.title}"` } }); wrapper = createComponent({ value: { data: `"${mockRegularMilestone.title}"` } });
......
...@@ -22,9 +22,7 @@ describe('GlCountdown', () => { ...@@ -22,9 +22,7 @@ describe('GlCountdown', () => {
endDateString: '2000-01-01T01:02:03Z', endDateString: '2000-01-01T01:02:03Z',
}); });
Vue.nextTick() Vue.nextTick().then(done).catch(done.fail);
.then(done)
.catch(done.fail);
}); });
it('displays remaining time', () => { it('displays remaining time', () => {
...@@ -50,9 +48,7 @@ describe('GlCountdown', () => { ...@@ -50,9 +48,7 @@ describe('GlCountdown', () => {
endDateString: '1900-01-01T00:00:00Z', endDateString: '1900-01-01T00:00:00Z',
}); });
Vue.nextTick() Vue.nextTick().then(done).catch(done.fail);
.then(done)
.catch(done.fail);
}); });
it('displays 00:00:00', () => { it('displays 00:00:00', () => {
......
...@@ -115,9 +115,7 @@ describe('RelatedIssuableItem', () => { ...@@ -115,9 +115,7 @@ describe('RelatedIssuableItem', () => {
const tokenMetadata = () => wrapper.find('.item-meta'); const tokenMetadata = () => wrapper.find('.item-meta');
it('renders item path and ID', () => { it('renders item path and ID', () => {
const pathAndID = tokenMetadata() const pathAndID = tokenMetadata().find('.item-path-id').text();
.find('.item-path-id')
.text();
expect(pathAndID).toContain('gitlab-org/gitlab-test'); expect(pathAndID).toContain('gitlab-org/gitlab-test');
expect(pathAndID).toContain('#1'); expect(pathAndID).toContain('#1');
......
...@@ -61,11 +61,7 @@ describe('SuggestionDiffRow', () => { ...@@ -61,11 +61,7 @@ describe('SuggestionDiffRow', () => {
}); });
expect(wrapper.classes()).toContain('line_holder'); expect(wrapper.classes()).toContain('line_holder');
expect( expect(findSuggestionContent().find('span').classes()).toContain('line');
findSuggestionContent()
.find('span')
.classes(),
).toContain('line');
}); });
it('renders the rich text when it is available', () => { it('renders the rich text when it is available', () => {
......
...@@ -124,7 +124,10 @@ describe('AlertManagementEmptyState', () => { ...@@ -124,7 +124,10 @@ describe('AlertManagementEmptyState', () => {
it('renders the tabs selection with valid tabs', () => { it('renders the tabs selection with valid tabs', () => {
mountComponent({ mountComponent({
props: { props: {
statusTabs: [{ status: 'opened', title: 'Open' }, { status: 'closed', title: 'Closed' }], statusTabs: [
{ status: 'opened', title: 'Open' },
{ status: 'closed', title: 'Closed' },
],
}, },
}); });
...@@ -216,12 +219,7 @@ describe('AlertManagementEmptyState', () => { ...@@ -216,12 +219,7 @@ describe('AlertManagementEmptyState', () => {
findPagination().vm.$emit('input', 3); findPagination().vm.$emit('input', 3);
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect( expect(findPagination().findAll('.page-item').at(0).text()).toBe('Prev');
findPagination()
.findAll('.page-item')
.at(0)
.text(),
).toBe('Prev');
}); });
it('returns prevPage number', async () => { it('returns prevPage number', async () => {
...@@ -244,12 +242,7 @@ describe('AlertManagementEmptyState', () => { ...@@ -244,12 +242,7 @@ describe('AlertManagementEmptyState', () => {
findPagination().vm.$emit('input', 3); findPagination().vm.$emit('input', 3);
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect( expect(findPagination().findAll('.page-item').at(1).text()).toBe('Next');
findPagination()
.findAll('.page-item')
.at(1)
.text(),
).toBe('Next');
}); });
it('returns nextPage number', async () => { it('returns nextPage number', async () => {
......
...@@ -142,16 +142,8 @@ describe('title area', () => { ...@@ -142,16 +142,8 @@ describe('title area', () => {
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect( expect(findSlotOrderElements().at(0).attributes('data-testid')).toBe(DYNAMIC_SLOT);
findSlotOrderElements() expect(findSlotOrderElements().at(1).attributes('data-testid')).toBe('metadata-foo');
.at(0)
.attributes('data-testid'),
).toBe(DYNAMIC_SLOT);
expect(
findSlotOrderElements()
.at(1)
.attributes('data-testid'),
).toBe('metadata-foo');
}); });
}); });
......
...@@ -46,12 +46,7 @@ describe('SidebarDatePicker', () => { ...@@ -46,12 +46,7 @@ describe('SidebarDatePicker', () => {
it('should render None if there is no selectedDate', () => { it('should render None if there is no selectedDate', () => {
mountComponent(); mountComponent();
expect( expect(wrapper.find('.value-content span').text().trim()).toEqual('None');
wrapper
.find('.value-content span')
.text()
.trim(),
).toEqual('None');
}); });
it('should render date-picker when editing', () => { it('should render date-picker when editing', () => {
...@@ -63,12 +58,7 @@ describe('SidebarDatePicker', () => { ...@@ -63,12 +58,7 @@ describe('SidebarDatePicker', () => {
it('should render label', () => { it('should render label', () => {
const label = 'label'; const label = 'label';
mountComponent({ label }); mountComponent({ label });
expect( expect(wrapper.find('.title').text().trim()).toEqual(label);
wrapper
.find('.title')
.text()
.trim(),
).toEqual(label);
}); });
it('should render loading-icon when isLoading', () => { it('should render loading-icon when isLoading', () => {
...@@ -82,12 +72,7 @@ describe('SidebarDatePicker', () => { ...@@ -82,12 +72,7 @@ describe('SidebarDatePicker', () => {
}); });
it('should render edit button', () => { it('should render edit button', () => {
expect( expect(wrapper.find('.title .btn-blank').text().trim()).toEqual('Edit');
wrapper
.find('.title .btn-blank')
.text()
.trim(),
).toEqual('Edit');
}); });
it('should enable editing when edit button is clicked', async () => { it('should enable editing when edit button is clicked', async () => {
...@@ -102,12 +87,7 @@ describe('SidebarDatePicker', () => { ...@@ -102,12 +87,7 @@ describe('SidebarDatePicker', () => {
it('should render date if selectedDate', () => { it('should render date if selectedDate', () => {
mountComponent({ selectedDate: new Date('07/07/2017') }); mountComponent({ selectedDate: new Date('07/07/2017') });
expect( expect(wrapper.find('.value-content strong').text().trim()).toEqual('Jul 7, 2017');
wrapper
.find('.value-content strong')
.text()
.trim(),
).toEqual('Jul 7, 2017');
}); });
describe('selectedDate and editable', () => { describe('selectedDate and editable', () => {
...@@ -116,12 +96,7 @@ describe('SidebarDatePicker', () => { ...@@ -116,12 +96,7 @@ describe('SidebarDatePicker', () => {
}); });
it('should render remove button if selectedDate and editable', () => { it('should render remove button if selectedDate and editable', () => {
expect( expect(wrapper.find('.value-content .btn-blank').text().trim()).toEqual('remove');
wrapper
.find('.value-content .btn-blank')
.text()
.trim(),
).toEqual('remove');
}); });
it('should emit saveDate with null when remove button is clicked', () => { it('should emit saveDate with null when remove button is clicked', () => {
......
...@@ -184,11 +184,7 @@ describe('IssuableMoveDropdown', () => { ...@@ -184,11 +184,7 @@ describe('IssuableMoveDropdown', () => {
}); });
it('renders gl-dropdown-form component', () => { it('renders gl-dropdown-form component', () => {
expect( expect(findDropdownEl().find(GlDropdownForm).exists()).toBe(true);
findDropdownEl()
.find(GlDropdownForm)
.exists(),
).toBe(true);
}); });
it('renders header element', () => { it('renders header element', () => {
...@@ -216,11 +212,7 @@ describe('IssuableMoveDropdown', () => { ...@@ -216,11 +212,7 @@ describe('IssuableMoveDropdown', () => {
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect( expect(findDropdownEl().find(GlLoadingIcon).exists()).toBe(true);
findDropdownEl()
.find(GlLoadingIcon)
.exists(),
).toBe(true);
}); });
it('renders gl-dropdown-item components for available projects', async () => { it('renders gl-dropdown-item components for available projects', async () => {
...@@ -288,10 +280,7 @@ describe('IssuableMoveDropdown', () => { ...@@ -288,10 +280,7 @@ describe('IssuableMoveDropdown', () => {
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect( expect(
wrapper wrapper.find('[data-testid="footer"]').find(GlButton).attributes('disabled'),
.find('[data-testid="footer"]')
.find(GlButton)
.attributes('disabled'),
).not.toBeDefined(); ).not.toBeDefined();
}); });
}); });
...@@ -331,10 +320,7 @@ describe('IssuableMoveDropdown', () => { ...@@ -331,10 +320,7 @@ describe('IssuableMoveDropdown', () => {
}); });
it('close icon in dropdown header closes the dropdown when clicked', () => { it('close icon in dropdown header closes the dropdown when clicked', () => {
wrapper wrapper.find('[data-testid="header"]').find(GlButton).vm.$emit('click', mockEvent);
.find('[data-testid="header"]')
.find(GlButton)
.vm.$emit('click', mockEvent);
expect(wrapper.vm.$refs.dropdown.hide).toHaveBeenCalled(); expect(wrapper.vm.$refs.dropdown.hide).toHaveBeenCalled();
}); });
...@@ -346,10 +332,7 @@ describe('IssuableMoveDropdown', () => { ...@@ -346,10 +332,7 @@ describe('IssuableMoveDropdown', () => {
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
wrapper wrapper.findAll(GlDropdownItem).at(0).vm.$emit('click', mockEvent);
.findAll(GlDropdownItem)
.at(0)
.vm.$emit('click', mockEvent);
expect(wrapper.vm.selectedProject).toBe(mockProjects[0]); expect(wrapper.vm.selectedProject).toBe(mockProjects[0]);
}); });
...@@ -361,10 +344,7 @@ describe('IssuableMoveDropdown', () => { ...@@ -361,10 +344,7 @@ describe('IssuableMoveDropdown', () => {
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
wrapper wrapper.find('[data-testid="footer"]').find(GlButton).vm.$emit('click');
.find('[data-testid="footer"]')
.find(GlButton)
.vm.$emit('click');
expect(wrapper.vm.$refs.dropdown.hide).toHaveBeenCalled(); expect(wrapper.vm.$refs.dropdown.hide).toHaveBeenCalled();
expect(wrapper.emitted('move-issuable')).toBeTruthy(); expect(wrapper.emitted('move-issuable')).toBeTruthy();
......
...@@ -71,12 +71,7 @@ describe('DropdownValueComponent', () => { ...@@ -71,12 +71,7 @@ describe('DropdownValueComponent', () => {
it('render slot content inside component when `labels` prop is empty', () => { it('render slot content inside component when `labels` prop is empty', () => {
const vmEmptyLabels = createComponent([]); const vmEmptyLabels = createComponent([]);
expect( expect(vmEmptyLabels.find('.text-secondary').text().trim()).toBe(mockConfig.emptyValueText);
vmEmptyLabels
.find('.text-secondary')
.text()
.trim(),
).toBe(mockConfig.emptyValueText);
vmEmptyLabels.destroy(); vmEmptyLabels.destroy();
}); });
......
...@@ -125,10 +125,7 @@ describe('DropdownContentsCreateView', () => { ...@@ -125,10 +125,7 @@ describe('DropdownContentsCreateView', () => {
}); });
it('renders dropdown back button element', () => { it('renders dropdown back button element', () => {
const backBtnEl = wrapper const backBtnEl = wrapper.find('.dropdown-title').findAll(GlButton).at(0);
.find('.dropdown-title')
.findAll(GlButton)
.at(0);
expect(backBtnEl.exists()).toBe(true); expect(backBtnEl.exists()).toBe(true);
expect(backBtnEl.attributes('aria-label')).toBe('Go back'); expect(backBtnEl.attributes('aria-label')).toBe('Go back');
...@@ -143,10 +140,7 @@ describe('DropdownContentsCreateView', () => { ...@@ -143,10 +140,7 @@ describe('DropdownContentsCreateView', () => {
}); });
it('renders dropdown close button element', () => { it('renders dropdown close button element', () => {
const closeBtnEl = wrapper const closeBtnEl = wrapper.find('.dropdown-title').findAll(GlButton).at(1);
.find('.dropdown-title')
.findAll(GlButton)
.at(1);
expect(closeBtnEl.exists()).toBe(true); expect(closeBtnEl.exists()).toBe(true);
expect(closeBtnEl.attributes('aria-label')).toBe('Close'); expect(closeBtnEl.attributes('aria-label')).toBe('Close');
...@@ -190,10 +184,7 @@ describe('DropdownContentsCreateView', () => { ...@@ -190,10 +184,7 @@ describe('DropdownContentsCreateView', () => {
}); });
it('renders create button element', () => { it('renders create button element', () => {
const createBtnEl = wrapper const createBtnEl = wrapper.find('.dropdown-actions').findAll(GlButton).at(0);
.find('.dropdown-actions')
.findAll(GlButton)
.at(0);
expect(createBtnEl.exists()).toBe(true); expect(createBtnEl.exists()).toBe(true);
expect(createBtnEl.text()).toContain('Create'); expect(createBtnEl.text()).toContain('Create');
...@@ -211,10 +202,7 @@ describe('DropdownContentsCreateView', () => { ...@@ -211,10 +202,7 @@ describe('DropdownContentsCreateView', () => {
}); });
it('renders cancel button element', () => { it('renders cancel button element', () => {
const cancelBtnEl = wrapper const cancelBtnEl = wrapper.find('.dropdown-actions').findAll(GlButton).at(1);
.find('.dropdown-actions')
.findAll(GlButton)
.at(1);
expect(cancelBtnEl.exists()).toBe(true); expect(cancelBtnEl.exists()).toBe(true);
expect(cancelBtnEl.text()).toContain('Cancel'); expect(cancelBtnEl.text()).toContain('Cancel');
......
...@@ -371,9 +371,7 @@ describe('DropdownContentsLabelsView', () => { ...@@ -371,9 +371,7 @@ describe('DropdownContentsLabelsView', () => {
wrapper.vm.$store.state.allowLabelCreate = false; wrapper.vm.$store.state.allowLabelCreate = false;
return wrapper.vm.$nextTick(() => { return wrapper.vm.$nextTick(() => {
const createLabelLink = findDropdownFooter() const createLabelLink = findDropdownFooter().findAll(GlLink).at(0);
.findAll(GlLink)
.at(0);
expect(createLabelLink.text()).not.toBe('Create label'); expect(createLabelLink.text()).not.toBe('Create label');
}); });
......
...@@ -26,7 +26,10 @@ describe('LabelsSelect Getters', () => { ...@@ -26,7 +26,10 @@ describe('LabelsSelect Getters', () => {
}); });
it('returns first label title and remaining labels count when state.labels has more than 1 label', () => { it('returns first label title and remaining labels count when state.labels has more than 1 label', () => {
const labels = [{ id: 1, title: 'Foo', set: true }, { id: 2, title: 'Bar', set: true }]; const labels = [
{ id: 1, title: 'Foo', set: true },
{ id: 2, title: 'Bar', set: true },
];
expect(getters.dropdownButtonText({ labels }, { isDropdownVariantSidebar: true })).toBe( expect(getters.dropdownButtonText({ labels }, { isDropdownVariantSidebar: true })).toBe(
'Foo +1 more', 'Foo +1 more',
......
...@@ -26,10 +26,7 @@ describe('SplitButton', () => { ...@@ -26,10 +26,7 @@ describe('SplitButton', () => {
}; };
const findDropdown = () => wrapper.find(GlDropdown); const findDropdown = () => wrapper.find(GlDropdown);
const findDropdownItem = (index = 0) => const findDropdownItem = (index = 0) => findDropdown().findAll(GlDropdownItem).at(index);
findDropdown()
.findAll(GlDropdownItem)
.at(index);
const selectItem = index => { const selectItem = index => {
findDropdownItem(index).vm.$emit('click'); findDropdownItem(index).vm.$emit('click');
......
...@@ -151,11 +151,7 @@ describe('Tooltip directive', () => { ...@@ -151,11 +151,7 @@ describe('Tooltip directive', () => {
}); });
it('should have tooltip plugin applied to all instances', () => { it('should have tooltip plugin applied to all instances', () => {
expect( expect($(wrapper.vm.$el).find('.js-look-for-tooltip').data('bs.tooltip')).toBeDefined();
$(wrapper.vm.$el)
.find('.js-look-for-tooltip')
.data('bs.tooltip'),
).toBeDefined();
}); });
}); });
}); });
...@@ -122,10 +122,7 @@ export const waitForTabToOpen = fileName => ...@@ -122,10 +122,7 @@ export const waitForTabToOpen = fileName =>
findByText(document.querySelector('.multi-file-edit-pane'), fileName); findByText(document.querySelector('.multi-file-edit-pane'), fileName);
export const createFile = async (path, content) => { export const createFile = async (path, content) => {
const parentPath = path const parentPath = path.split('/').slice(0, -1).join('/');
.split('/')
.slice(0, -1)
.join('/');
const parentRow = await findAndTraverseToPath(parentPath); const parentRow = await findAndTraverseToPath(parentPath);
......
const COMMIT_ID_LENGTH = 40; const COMMIT_ID_LENGTH = 40;
const DEFAULT_COMMIT_ID = Array(COMMIT_ID_LENGTH) const DEFAULT_COMMIT_ID = Array(COMMIT_ID_LENGTH).fill('0').join('');
.fill('0')
.join('');
export const createCommitId = (index = 0) => export const createCommitId = (index = 0) =>
`${index}${DEFAULT_COMMIT_ID}`.substr(0, COMMIT_ID_LENGTH); `${index}${DEFAULT_COMMIT_ID}`.substr(0, COMMIT_ID_LENGTH);
......
...@@ -3,9 +3,9 @@ import { withKeys, withValues } from './obj'; ...@@ -3,9 +3,9 @@ import { withKeys, withValues } from './obj';
describe('frontend_integration/test_helpers/utils/obj', () => { describe('frontend_integration/test_helpers/utils/obj', () => {
describe('withKeys', () => { describe('withKeys', () => {
it('picks and maps keys', () => { it('picks and maps keys', () => {
expect(withKeys({ a: '123', b: 456, c: 'd' }, { b: 'lorem', c: 'ipsum', z: 'zed ' })).toEqual( expect(
{ lorem: 456, ipsum: 'd' }, withKeys({ a: '123', b: 456, c: 'd' }, { b: 'lorem', c: 'ipsum', z: 'zed ' }),
); ).toEqual({ lorem: 456, ipsum: 'd' });
}); });
}); });
......
...@@ -255,8 +255,9 @@ describe('Fly out sidebar navigation', () => { ...@@ -255,8 +255,9 @@ describe('Fly out sidebar navigation', () => {
showSubLevelItems(el); showSubLevelItems(el);
expect(subItems.style.transform).toBe( expect(subItems.style.transform).toBe(
`translate3d(200px, ${Math.floor(el.getBoundingClientRect().top) - `translate3d(200px, ${
getHeaderHeight()}px, 0px)`, Math.floor(el.getBoundingClientRect().top) - getHeaderHeight()
}px, 0px)`,
); );
}); });
......
...@@ -24,7 +24,7 @@ const PIXEL_TOLERANCE = 0.2; ...@@ -24,7 +24,7 @@ const PIXEL_TOLERANCE = 0.2;
const urlToImage = url => const urlToImage = url =>
new Promise(resolve => { new Promise(resolve => {
const img = new Image(); const img = new Image();
img.onload = function() { img.onload = function () {
resolve(img); resolve(img);
}; };
img.src = url; img.src = url;
......
...@@ -32,8 +32,9 @@ export default { ...@@ -32,8 +32,9 @@ export default {
return { return {
pass: differentPixels < 20, pass: differentPixels < 20,
message: `${differentPixels} pixels differ more than ${threshold * message: `${differentPixels} pixels differ more than ${
100} percent between input and output.`, threshold * 100
} percent between input and output.`,
}; };
}, },
}; };
......
...@@ -40,7 +40,7 @@ Vue.config.warnHandler = (msg, vm, trace) => { ...@@ -40,7 +40,7 @@ Vue.config.warnHandler = (msg, vm, trace) => {
}; };
let hasVueErrors = false; let hasVueErrors = false;
Vue.config.errorHandler = function(err) { Vue.config.errorHandler = function (err) {
hasVueErrors = true; hasVueErrors = true;
fail(err); fail(err);
}; };
...@@ -118,8 +118,8 @@ testContexts.forEach(context => { ...@@ -118,8 +118,8 @@ testContexts.forEach(context => {
} catch (err) { } catch (err) {
console.log(err); console.log(err);
console.error('[GL SPEC RUNNER ERROR] Unable to load spec: ', path); console.error('[GL SPEC RUNNER ERROR] Unable to load spec: ', path);
describe('Test bundle', function() { describe('Test bundle', function () {
it(`includes '${path}'`, function() { it(`includes '${path}'`, function () {
expect(err).toBeNull(); expect(err).toBeNull();
}); });
}); });
......
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