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