Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
325fb305
Commit
325fb305
authored
Dec 23, 2020
by
Lukas Eipert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run prettier on 31 files - 72 of 73
Part of our prettier migration; changing the arrow-parens style.
parent
e37a6d7a
Changes
32
Show whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
91 additions
and
124 deletions
+91
-124
.prettierignore
.prettierignore
+0
-33
spec/frontend/vue_shared/components/rich_content_editor/editor_service_spec.js
...red/components/rich_content_editor/editor_service_spec.js
+1
-1
spec/frontend/vue_shared/components/rich_content_editor/modals/add_image/upload_image_tab_spec.js
..._content_editor/modals/add_image/upload_image_tab_spec.js
+1
-1
spec/frontend/vue_shared/components/rich_content_editor/modals/insert_video_modal_spec.js
...nts/rich_content_editor/modals/insert_video_modal_spec.js
+1
-1
spec/frontend/vue_shared/components/rich_content_editor/services/build_html_to_markdown_renderer_spec.js
...t_editor/services/build_html_to_markdown_renderer_spec.js
+3
-3
spec/frontend/vue_shared/components/rich_content_editor/services/renderers/mock_data.js
...nents/rich_content_editor/services/renderers/mock_data.js
+4
-4
spec/frontend/vue_shared/components/rich_content_editor/services/renderers/render_identifier_instance_text_spec.js
...ervices/renderers/render_identifier_instance_text_spec.js
+1
-1
spec/frontend/vue_shared/components/rich_content_editor/services/renderers/render_identifier_paragraph_spec.js
...or/services/renderers/render_identifier_paragraph_spec.js
+1
-1
spec/frontend/vue_shared/components/rich_content_editor/toolbar_item_spec.js
...hared/components/rich_content_editor/toolbar_item_spec.js
+1
-1
spec/frontend/vue_shared/components/security_reports/help_icon_spec.js
.../vue_shared/components/security_reports/help_icon_spec.js
+1
-1
spec/frontend/vue_shared/components/security_reports/security_summary_spec.js
...ared/components/security_reports/security_summary_spec.js
+2
-2
spec/frontend/vue_shared/components/sidebar/collapsed_grouped_date_picker_spec.js
.../components/sidebar/collapsed_grouped_date_picker_spec.js
+4
-4
spec/frontend/vue_shared/components/sidebar/labels_select/base_spec.js
.../vue_shared/components/sidebar/labels_select/base_spec.js
+1
-1
spec/frontend/vue_shared/components/sidebar/labels_select/dropdown_create_label_spec.js
...nents/sidebar/labels_select/dropdown_create_label_spec.js
+1
-1
spec/frontend/vue_shared/components/sidebar/labels_select/dropdown_value_collapsed_spec.js
...ts/sidebar/labels_select/dropdown_value_collapsed_spec.js
+3
-3
spec/frontend/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_create_view_spec.js
...r/labels_select_vue/dropdown_contents_create_view_spec.js
+1
-1
spec/frontend/vue_shared/components/sidebar/labels_select_vue/store/actions_spec.js
...omponents/sidebar/labels_select_vue/store/actions_spec.js
+15
-15
spec/frontend/vue_shared/components/sidebar/labels_select_vue/store/mutations_spec.js
...ponents/sidebar/labels_select_vue/store/mutations_spec.js
+3
-3
spec/frontend/vue_shared/components/slot_switch_spec.js
spec/frontend/vue_shared/components/slot_switch_spec.js
+2
-2
spec/frontend/vue_shared/components/split_button_spec.js
spec/frontend/vue_shared/components/split_button_spec.js
+3
-3
spec/frontend/vue_shared/components/table_pagination_spec.js
spec/frontend/vue_shared/components/table_pagination_spec.js
+1
-1
spec/frontend/vue_shared/components/tabs/tab_spec.js
spec/frontend/vue_shared/components/tabs/tab_spec.js
+2
-2
spec/frontend/vue_shared/components/tooltip_on_truncate_spec.js
...rontend/vue_shared/components/tooltip_on_truncate_spec.js
+1
-1
spec/frontend/vue_shared/components/user_avatar/user_avatar_link_spec.js
...ue_shared/components/user_avatar/user_avatar_link_spec.js
+1
-1
spec/frontend/vue_shared/components/user_avatar/user_avatar_list_spec.js
...ue_shared/components/user_avatar/user_avatar_list_spec.js
+4
-4
spec/frontend/vue_shared/components/user_popover/user_popover_spec.js
...d/vue_shared/components/user_popover/user_popover_spec.js
+5
-5
spec/frontend/vue_shared/directives/validation_spec.js
spec/frontend/vue_shared/directives/validation_spec.js
+2
-2
spec/frontend/vue_shared/security_reports/components/security_report_download_dropdown_spec.js
...orts/components/security_report_download_dropdown_spec.js
+1
-1
spec/frontend/vue_shared/security_reports/security_reports_app_spec.js
.../vue_shared/security_reports/security_reports_app_spec.js
+8
-8
spec/frontend/vue_shared/security_reports/store/getters_spec.js
...rontend/vue_shared/security_reports/store/getters_spec.js
+1
-1
spec/frontend/vue_shared/security_reports/store/modules/sast/actions_spec.js
...hared/security_reports/store/modules/sast/actions_spec.js
+8
-8
spec/frontend/vue_shared/security_reports/store/modules/secret_detection/actions_spec.js
...ty_reports/store/modules/secret_detection/actions_spec.js
+8
-8
No files found.
.prettierignore
View file @
325fb305
...
@@ -2256,39 +2256,6 @@ spec/frontend/shared/popover_spec.js
...
@@ -2256,39 +2256,6 @@ spec/frontend/shared/popover_spec.js
spec/frontend/shortcuts_spec.js
spec/frontend/shortcuts_spec.js
spec/frontend/sidebar/assignee_title_spec.js
spec/frontend/sidebar/assignee_title_spec.js
## wizardly-agnesi
spec/frontend/vue_shared/components/rich_content_editor/editor_service_spec.js
spec/frontend/vue_shared/components/rich_content_editor/modals/add_image/upload_image_tab_spec.js
spec/frontend/vue_shared/components/rich_content_editor/modals/insert_video_modal_spec.js
spec/frontend/vue_shared/components/rich_content_editor/services/build_html_to_markdown_renderer_spec.js
spec/frontend/vue_shared/components/rich_content_editor/services/renderers/mock_data.js
spec/frontend/vue_shared/components/rich_content_editor/services/renderers/render_identifier_instance_text_spec.js
spec/frontend/vue_shared/components/rich_content_editor/services/renderers/render_identifier_paragraph_spec.js
spec/frontend/vue_shared/components/rich_content_editor/toolbar_item_spec.js
spec/frontend/vue_shared/components/security_reports/help_icon_spec.js
spec/frontend/vue_shared/components/security_reports/security_summary_spec.js
spec/frontend/vue_shared/components/sidebar/collapsed_grouped_date_picker_spec.js
spec/frontend/vue_shared/components/sidebar/labels_select/base_spec.js
spec/frontend/vue_shared/components/sidebar/labels_select/dropdown_create_label_spec.js
spec/frontend/vue_shared/components/sidebar/labels_select/dropdown_value_collapsed_spec.js
spec/frontend/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_create_view_spec.js
spec/frontend/vue_shared/components/sidebar/labels_select_vue/store/actions_spec.js
spec/frontend/vue_shared/components/sidebar/labels_select_vue/store/mutations_spec.js
spec/frontend/vue_shared/components/slot_switch_spec.js
spec/frontend/vue_shared/components/split_button_spec.js
spec/frontend/vue_shared/components/table_pagination_spec.js
spec/frontend/vue_shared/components/tabs/tab_spec.js
spec/frontend/vue_shared/components/tooltip_on_truncate_spec.js
spec/frontend/vue_shared/components/user_avatar/user_avatar_link_spec.js
spec/frontend/vue_shared/components/user_avatar/user_avatar_list_spec.js
spec/frontend/vue_shared/components/user_popover/user_popover_spec.js
spec/frontend/vue_shared/directives/validation_spec.js
spec/frontend/vue_shared/security_reports/components/security_report_download_dropdown_spec.js
spec/frontend/vue_shared/security_reports/security_reports_app_spec.js
spec/frontend/vue_shared/security_reports/store/getters_spec.js
spec/frontend/vue_shared/security_reports/store/modules/sast/actions_spec.js
spec/frontend/vue_shared/security_reports/store/modules/secret_detection/actions_spec.js
## upbeat-elion
## upbeat-elion
spec/frontend/vuex_shared/modules/modal/actions_spec.js
spec/frontend/vuex_shared/modules/modal/actions_spec.js
spec/frontend/whats_new/components/app_spec.js
spec/frontend/whats_new/components/app_spec.js
...
...
spec/frontend/vue_shared/components/rich_content_editor/editor_service_spec.js
View file @
325fb305
...
@@ -20,7 +20,7 @@ describe('Editor Service', () => {
...
@@ -20,7 +20,7 @@ describe('Editor Service', () => {
let
mockInstance
;
let
mockInstance
;
let
event
;
let
event
;
let
handler
;
let
handler
;
const
parseHtml
=
str
=>
{
const
parseHtml
=
(
str
)
=>
{
const
wrapper
=
document
.
createElement
(
'
div
'
);
const
wrapper
=
document
.
createElement
(
'
div
'
);
wrapper
.
innerHTML
=
str
;
wrapper
.
innerHTML
=
str
;
return
wrapper
.
firstChild
;
return
wrapper
.
firstChild
;
...
...
spec/frontend/vue_shared/components/rich_content_editor/modals/add_image/upload_image_tab_spec.js
View file @
325fb305
...
@@ -10,7 +10,7 @@ describe('Upload Image Tab', () => {
...
@@ -10,7 +10,7 @@ describe('Upload Image Tab', () => {
afterEach
(()
=>
wrapper
.
destroy
());
afterEach
(()
=>
wrapper
.
destroy
());
const
triggerInputEvent
=
size
=>
{
const
triggerInputEvent
=
(
size
)
=>
{
const
file
=
{
size
,
name
:
'
file-name.png
'
};
const
file
=
{
size
,
name
:
'
file-name.png
'
};
const
mockEvent
=
new
Event
(
'
input
'
);
const
mockEvent
=
new
Event
(
'
input
'
);
...
...
spec/frontend/vue_shared/components/rich_content_editor/modals/insert_video_modal_spec.js
View file @
325fb305
...
@@ -8,7 +8,7 @@ describe('Insert Video Modal', () => {
...
@@ -8,7 +8,7 @@ describe('Insert Video Modal', () => {
const
findModal
=
()
=>
wrapper
.
find
(
GlModal
);
const
findModal
=
()
=>
wrapper
.
find
(
GlModal
);
const
findUrlInput
=
()
=>
wrapper
.
find
({
ref
:
'
urlInput
'
});
const
findUrlInput
=
()
=>
wrapper
.
find
({
ref
:
'
urlInput
'
});
const
triggerInsertVideo
=
url
=>
{
const
triggerInsertVideo
=
(
url
)
=>
{
const
preventDefault
=
jest
.
fn
();
const
preventDefault
=
jest
.
fn
();
findUrlInput
().
vm
.
$emit
(
'
input
'
,
url
);
findUrlInput
().
vm
.
$emit
(
'
input
'
,
url
);
findModal
().
vm
.
$emit
(
'
primary
'
,
{
preventDefault
});
findModal
().
vm
.
$emit
(
'
primary
'
,
{
preventDefault
});
...
...
spec/frontend/vue_shared/components/rich_content_editor/services/build_html_to_markdown_renderer_spec.js
View file @
325fb305
...
@@ -8,9 +8,9 @@ describe('rich_content_editor/services/html_to_markdown_renderer', () => {
...
@@ -8,9 +8,9 @@ describe('rich_content_editor/services/html_to_markdown_renderer', () => {
beforeEach
(()
=>
{
beforeEach
(()
=>
{
baseRenderer
=
{
baseRenderer
=
{
trim
:
jest
.
fn
(
input
=>
`trimmed
${
input
}
`
),
trim
:
jest
.
fn
(
(
input
)
=>
`trimmed
${
input
}
`
),
getSpaceCollapsedText
:
jest
.
fn
(
input
=>
`space collapsed
${
input
}
`
),
getSpaceCollapsedText
:
jest
.
fn
(
(
input
)
=>
`space collapsed
${
input
}
`
),
getSpaceControlled
:
jest
.
fn
(
input
=>
`space controlled
${
input
}
`
),
getSpaceControlled
:
jest
.
fn
(
(
input
)
=>
`space controlled
${
input
}
`
),
convert
:
jest
.
fn
(),
convert
:
jest
.
fn
(),
};
};
...
...
spec/frontend/vue_shared/components/rich_content_editor/services/renderers/mock_data.js
View file @
325fb305
// Node spec helpers
// Node spec helpers
export
const
buildMockTextNode
=
literal
=>
({
literal
,
type
:
'
text
'
});
export
const
buildMockTextNode
=
(
literal
)
=>
({
literal
,
type
:
'
text
'
});
export
const
normalTextNode
=
buildMockTextNode
(
'
This is just normal text.
'
);
export
const
normalTextNode
=
buildMockTextNode
(
'
This is just normal text.
'
);
// Token spec helpers
// Token spec helpers
const
buildMockUneditableOpenToken
=
type
=>
{
const
buildMockUneditableOpenToken
=
(
type
)
=>
{
return
{
return
{
type
:
'
openTag
'
,
type
:
'
openTag
'
,
tagName
:
type
,
tagName
:
type
,
...
@@ -17,7 +17,7 @@ const buildMockUneditableOpenToken = type => {
...
@@ -17,7 +17,7 @@ const buildMockUneditableOpenToken = type => {
};
};
};
};
const
buildMockTextToken
=
content
=>
{
const
buildMockTextToken
=
(
content
)
=>
{
return
{
return
{
type
:
'
text
'
,
type
:
'
text
'
,
tagName
:
null
,
tagName
:
null
,
...
@@ -25,7 +25,7 @@ const buildMockTextToken = content => {
...
@@ -25,7 +25,7 @@ const buildMockTextToken = content => {
};
};
};
};
const
buildMockUneditableCloseToken
=
type
=>
({
type
:
'
closeTag
'
,
tagName
:
type
});
const
buildMockUneditableCloseToken
=
(
type
)
=>
({
type
:
'
closeTag
'
,
tagName
:
type
});
export
const
originToken
=
buildMockTextToken
(
'
{:.no_toc .hidden-md .hidden-lg}
'
);
export
const
originToken
=
buildMockTextToken
(
'
{:.no_toc .hidden-md .hidden-lg}
'
);
const
uneditableOpenToken
=
buildMockUneditableOpenToken
(
'
div
'
);
const
uneditableOpenToken
=
buildMockUneditableOpenToken
(
'
div
'
);
...
...
spec/frontend/vue_shared/components/rich_content_editor/services/renderers/render_identifier_instance_text_spec.js
View file @
325fb305
...
@@ -36,7 +36,7 @@ describe('Render Identifier Instance Text renderer', () => {
...
@@ -36,7 +36,7 @@ describe('Render Identifier Instance Text renderer', () => {
`
(
`
(
'
should return inline editable, uneditable, and editable tokens in sequence
'
,
'
should return inline editable, uneditable, and editable tokens in sequence
'
,
({
start
,
middle
,
end
})
=>
{
({
start
,
middle
,
end
})
=>
{
const
buildMockTextToken
=
content
=>
({
type
:
'
text
'
,
tagName
:
null
,
content
});
const
buildMockTextToken
=
(
content
)
=>
({
type
:
'
text
'
,
tagName
:
null
,
content
});
const
startToken
=
buildMockTextToken
(
start
);
const
startToken
=
buildMockTextToken
(
start
);
const
middleToken
=
buildMockTextToken
(
middle
);
const
middleToken
=
buildMockTextToken
(
middle
);
...
...
spec/frontend/vue_shared/components/rich_content_editor/services/renderers/render_identifier_paragraph_spec.js
View file @
325fb305
...
@@ -2,7 +2,7 @@ import renderer from '~/vue_shared/components/rich_content_editor/services/rende
...
@@ -2,7 +2,7 @@ import renderer from '~/vue_shared/components/rich_content_editor/services/rende
import
{
buildMockTextNode
}
from
'
./mock_data
'
;
import
{
buildMockTextNode
}
from
'
./mock_data
'
;
const
buildMockParagraphNode
=
literal
=>
{
const
buildMockParagraphNode
=
(
literal
)
=>
{
return
{
return
{
firstChild
:
buildMockTextNode
(
literal
),
firstChild
:
buildMockTextNode
(
literal
),
type
:
'
paragraph
'
,
type
:
'
paragraph
'
,
...
...
spec/frontend/vue_shared/components/rich_content_editor/toolbar_item_spec.js
View file @
325fb305
...
@@ -9,7 +9,7 @@ describe('Toolbar Item', () => {
...
@@ -9,7 +9,7 @@ describe('Toolbar Item', () => {
const
findIcon
=
()
=>
wrapper
.
find
(
GlIcon
);
const
findIcon
=
()
=>
wrapper
.
find
(
GlIcon
);
const
findButton
=
()
=>
wrapper
.
find
(
'
button
'
);
const
findButton
=
()
=>
wrapper
.
find
(
'
button
'
);
const
buildWrapper
=
propsData
=>
{
const
buildWrapper
=
(
propsData
)
=>
{
wrapper
=
shallowMount
(
ToolbarItem
,
{
wrapper
=
shallowMount
(
ToolbarItem
,
{
propsData
,
propsData
,
directives
:
{
directives
:
{
...
...
spec/frontend/vue_shared/components/security_reports/help_icon_spec.js
View file @
325fb305
...
@@ -8,7 +8,7 @@ const discoverProjectSecurityPath = '/discoverProjectSecurityPath';
...
@@ -8,7 +8,7 @@ const discoverProjectSecurityPath = '/discoverProjectSecurityPath';
describe
(
'
HelpIcon component
'
,
()
=>
{
describe
(
'
HelpIcon component
'
,
()
=>
{
let
wrapper
;
let
wrapper
;
const
createWrapper
=
props
=>
{
const
createWrapper
=
(
props
)
=>
{
wrapper
=
shallowMount
(
HelpIcon
,
{
wrapper
=
shallowMount
(
HelpIcon
,
{
propsData
:
{
propsData
:
{
helpPath
,
helpPath
,
...
...
spec/frontend/vue_shared/components/security_reports/security_summary_spec.js
View file @
325fb305
...
@@ -6,7 +6,7 @@ import { groupedTextBuilder } from '~/vue_shared/security_reports/store/utils';
...
@@ -6,7 +6,7 @@ import { groupedTextBuilder } from '~/vue_shared/security_reports/store/utils';
describe
(
'
SecuritySummary component
'
,
()
=>
{
describe
(
'
SecuritySummary component
'
,
()
=>
{
let
wrapper
;
let
wrapper
;
const
createWrapper
=
message
=>
{
const
createWrapper
=
(
message
)
=>
{
wrapper
=
shallowMount
(
SecuritySummary
,
{
wrapper
=
shallowMount
(
SecuritySummary
,
{
propsData
:
{
message
},
propsData
:
{
message
},
stubs
:
{
stubs
:
{
...
@@ -26,7 +26,7 @@ describe('SecuritySummary component', () => {
...
@@ -26,7 +26,7 @@ describe('SecuritySummary component', () => {
groupedTextBuilder
({
reportType
:
'
Security scanning
'
,
critical
:
1
,
high
:
0
,
total
:
1
}),
groupedTextBuilder
({
reportType
:
'
Security scanning
'
,
critical
:
1
,
high
:
0
,
total
:
1
}),
groupedTextBuilder
({
reportType
:
'
Security scanning
'
,
critical
:
0
,
high
:
1
,
total
:
1
}),
groupedTextBuilder
({
reportType
:
'
Security scanning
'
,
critical
:
0
,
high
:
1
,
total
:
1
}),
groupedTextBuilder
({
reportType
:
'
Security scanning
'
,
critical
:
1
,
high
:
2
,
total
:
3
}),
groupedTextBuilder
({
reportType
:
'
Security scanning
'
,
critical
:
1
,
high
:
2
,
total
:
3
}),
])(
'
given the message %p
'
,
message
=>
{
])(
'
given the message %p
'
,
(
message
)
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
createWrapper
(
message
);
createWrapper
(
message
);
});
});
...
...
spec/frontend/vue_shared/components/sidebar/collapsed_grouped_date_picker_spec.js
View file @
325fb305
...
@@ -12,7 +12,7 @@ describe('collapsedGroupedDatePicker', () => {
...
@@ -12,7 +12,7 @@ describe('collapsedGroupedDatePicker', () => {
});
});
describe
(
'
toggleCollapse events
'
,
()
=>
{
describe
(
'
toggleCollapse events
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
jest
.
spyOn
(
vm
,
'
toggleSidebar
'
).
mockImplementation
(()
=>
{});
jest
.
spyOn
(
vm
,
'
toggleSidebar
'
).
mockImplementation
(()
=>
{});
vm
.
minDate
=
new
Date
(
'
07/17/2016
'
);
vm
.
minDate
=
new
Date
(
'
07/17/2016
'
);
Vue
.
nextTick
(
done
);
Vue
.
nextTick
(
done
);
...
@@ -26,7 +26,7 @@ describe('collapsedGroupedDatePicker', () => {
...
@@ -26,7 +26,7 @@ describe('collapsedGroupedDatePicker', () => {
});
});
describe
(
'
minDate and maxDate
'
,
()
=>
{
describe
(
'
minDate and maxDate
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
vm
.
minDate
=
new
Date
(
'
07/17/2016
'
);
vm
.
minDate
=
new
Date
(
'
07/17/2016
'
);
vm
.
maxDate
=
new
Date
(
'
07/17/2017
'
);
vm
.
maxDate
=
new
Date
(
'
07/17/2017
'
);
Vue
.
nextTick
(
done
);
Vue
.
nextTick
(
done
);
...
@@ -42,7 +42,7 @@ describe('collapsedGroupedDatePicker', () => {
...
@@ -42,7 +42,7 @@ describe('collapsedGroupedDatePicker', () => {
});
});
describe
(
'
minDate
'
,
()
=>
{
describe
(
'
minDate
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
vm
.
minDate
=
new
Date
(
'
07/17/2016
'
);
vm
.
minDate
=
new
Date
(
'
07/17/2016
'
);
Vue
.
nextTick
(
done
);
Vue
.
nextTick
(
done
);
});
});
...
@@ -56,7 +56,7 @@ describe('collapsedGroupedDatePicker', () => {
...
@@ -56,7 +56,7 @@ describe('collapsedGroupedDatePicker', () => {
});
});
describe
(
'
maxDate
'
,
()
=>
{
describe
(
'
maxDate
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
vm
.
maxDate
=
new
Date
(
'
07/17/2017
'
);
vm
.
maxDate
=
new
Date
(
'
07/17/2017
'
);
Vue
.
nextTick
(
done
);
Vue
.
nextTick
(
done
);
});
});
...
...
spec/frontend/vue_shared/components/sidebar/labels_select/base_spec.js
View file @
325fb305
...
@@ -15,7 +15,7 @@ describe('BaseComponent', () => {
...
@@ -15,7 +15,7 @@ describe('BaseComponent', () => {
let
wrapper
;
let
wrapper
;
let
vm
;
let
vm
;
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
wrapper
=
createComponent
();
wrapper
=
createComponent
();
({
vm
}
=
wrapper
);
({
vm
}
=
wrapper
);
...
...
spec/frontend/vue_shared/components/sidebar/labels_select/dropdown_create_label_spec.js
View file @
325fb305
...
@@ -5,7 +5,7 @@ import dropdownCreateLabelComponent from '~/vue_shared/components/sidebar/labels
...
@@ -5,7 +5,7 @@ import dropdownCreateLabelComponent from '~/vue_shared/components/sidebar/labels
import
{
mockSuggestedColors
}
from
'
./mock_data
'
;
import
{
mockSuggestedColors
}
from
'
./mock_data
'
;
const
createComponent
=
headerTitle
=>
{
const
createComponent
=
(
headerTitle
)
=>
{
const
Component
=
Vue
.
extend
(
dropdownCreateLabelComponent
);
const
Component
=
Vue
.
extend
(
dropdownCreateLabelComponent
);
return
mountComponent
(
Component
,
{
return
mountComponent
(
Component
,
{
...
...
spec/frontend/vue_shared/components/sidebar/labels_select/dropdown_value_collapsed_spec.js
View file @
325fb305
...
@@ -37,7 +37,7 @@ describe('DropdownValueCollapsedComponent', () => {
...
@@ -37,7 +37,7 @@ describe('DropdownValueCollapsedComponent', () => {
const
labels
=
mockLabels
.
concat
(
mockLabels
);
const
labels
=
mockLabels
.
concat
(
mockLabels
);
const
vmMoreLabels
=
createComponent
(
labels
);
const
vmMoreLabels
=
createComponent
(
labels
);
const
expectedText
=
labels
.
map
(
label
=>
label
.
title
).
join
(
'
,
'
);
const
expectedText
=
labels
.
map
(
(
label
)
=>
label
.
title
).
join
(
'
,
'
);
expect
(
vmMoreLabels
.
labelsList
).
toBe
(
expectedText
);
expect
(
vmMoreLabels
.
labelsList
).
toBe
(
expectedText
);
vmMoreLabels
.
$destroy
();
vmMoreLabels
.
$destroy
();
...
@@ -53,7 +53,7 @@ describe('DropdownValueCollapsedComponent', () => {
...
@@ -53,7 +53,7 @@ describe('DropdownValueCollapsedComponent', () => {
const
expectedText
=
`
${
mockMoreLabels
const
expectedText
=
`
${
mockMoreLabels
.
slice
(
0
,
5
)
.
slice
(
0
,
5
)
.
map
(
label
=>
label
.
title
)
.
map
(
(
label
)
=>
label
.
title
)
.
join
(
'
,
'
)}
, and
${
mockMoreLabels
.
length
-
5
}
more`
;
.
join
(
'
,
'
)}
, and
${
mockMoreLabels
.
length
-
5
}
more`
;
expect
(
vmMoreLabels
.
labelsList
).
toBe
(
expectedText
);
expect
(
vmMoreLabels
.
labelsList
).
toBe
(
expectedText
);
...
@@ -61,7 +61,7 @@ describe('DropdownValueCollapsedComponent', () => {
...
@@ -61,7 +61,7 @@ describe('DropdownValueCollapsedComponent', () => {
});
});
it
(
'
returns first label name when `labels` prop has only one item present
'
,
()
=>
{
it
(
'
returns first label name when `labels` prop has only one item present
'
,
()
=>
{
const
text
=
mockLabels
.
map
(
label
=>
label
.
title
).
join
(
'
,
'
);
const
text
=
mockLabels
.
map
(
(
label
)
=>
label
.
title
).
join
(
'
,
'
);
expect
(
vm
.
labelsList
).
toBe
(
text
);
expect
(
vm
.
labelsList
).
toBe
(
text
);
});
});
...
...
spec/frontend/vue_shared/components/sidebar/labels_select_vue/dropdown_contents_create_view_spec.js
View file @
325fb305
...
@@ -24,7 +24,7 @@ const createComponent = (initialState = mockConfig) => {
...
@@ -24,7 +24,7 @@ const createComponent = (initialState = mockConfig) => {
describe
(
'
DropdownContentsCreateView
'
,
()
=>
{
describe
(
'
DropdownContentsCreateView
'
,
()
=>
{
let
wrapper
;
let
wrapper
;
const
colors
=
Object
.
keys
(
mockSuggestedColors
).
map
(
color
=>
({
const
colors
=
Object
.
keys
(
mockSuggestedColors
).
map
(
(
color
)
=>
({
[
color
]:
mockSuggestedColors
[
color
],
[
color
]:
mockSuggestedColors
[
color
],
}));
}));
...
...
spec/frontend/vue_shared/components/sidebar/labels_select_vue/store/actions_spec.js
View file @
325fb305
...
@@ -19,7 +19,7 @@ describe('LabelsSelect Actions', () => {
...
@@ -19,7 +19,7 @@ describe('LabelsSelect Actions', () => {
});
});
describe
(
'
setInitialState
'
,
()
=>
{
describe
(
'
setInitialState
'
,
()
=>
{
it
(
'
sets initial store state
'
,
done
=>
{
it
(
'
sets initial store state
'
,
(
done
)
=>
{
testAction
(
testAction
(
actions
.
setInitialState
,
actions
.
setInitialState
,
mockInitialState
,
mockInitialState
,
...
@@ -32,7 +32,7 @@ describe('LabelsSelect Actions', () => {
...
@@ -32,7 +32,7 @@ describe('LabelsSelect Actions', () => {
});
});
describe
(
'
toggleDropdownButton
'
,
()
=>
{
describe
(
'
toggleDropdownButton
'
,
()
=>
{
it
(
'
toggles dropdown button
'
,
done
=>
{
it
(
'
toggles dropdown button
'
,
(
done
)
=>
{
testAction
(
testAction
(
actions
.
toggleDropdownButton
,
actions
.
toggleDropdownButton
,
{},
{},
...
@@ -45,7 +45,7 @@ describe('LabelsSelect Actions', () => {
...
@@ -45,7 +45,7 @@ describe('LabelsSelect Actions', () => {
});
});
describe
(
'
toggleDropdownContents
'
,
()
=>
{
describe
(
'
toggleDropdownContents
'
,
()
=>
{
it
(
'
toggles dropdown contents
'
,
done
=>
{
it
(
'
toggles dropdown contents
'
,
(
done
)
=>
{
testAction
(
testAction
(
actions
.
toggleDropdownContents
,
actions
.
toggleDropdownContents
,
{},
{},
...
@@ -58,7 +58,7 @@ describe('LabelsSelect Actions', () => {
...
@@ -58,7 +58,7 @@ describe('LabelsSelect Actions', () => {
});
});
describe
(
'
toggleDropdownContentsCreateView
'
,
()
=>
{
describe
(
'
toggleDropdownContentsCreateView
'
,
()
=>
{
it
(
'
toggles dropdown create view
'
,
done
=>
{
it
(
'
toggles dropdown create view
'
,
(
done
)
=>
{
testAction
(
testAction
(
actions
.
toggleDropdownContentsCreateView
,
actions
.
toggleDropdownContentsCreateView
,
{},
{},
...
@@ -71,13 +71,13 @@ describe('LabelsSelect Actions', () => {
...
@@ -71,13 +71,13 @@ describe('LabelsSelect Actions', () => {
});
});
describe
(
'
requestLabels
'
,
()
=>
{
describe
(
'
requestLabels
'
,
()
=>
{
it
(
'
sets value of `state.labelsFetchInProgress` to `true`
'
,
done
=>
{
it
(
'
sets value of `state.labelsFetchInProgress` to `true`
'
,
(
done
)
=>
{
testAction
(
actions
.
requestLabels
,
{},
state
,
[{
type
:
types
.
REQUEST_LABELS
}],
[],
done
);
testAction
(
actions
.
requestLabels
,
{},
state
,
[{
type
:
types
.
REQUEST_LABELS
}],
[],
done
);
});
});
});
});
describe
(
'
receiveLabelsSuccess
'
,
()
=>
{
describe
(
'
receiveLabelsSuccess
'
,
()
=>
{
it
(
'
sets provided labels to `state.labels`
'
,
done
=>
{
it
(
'
sets provided labels to `state.labels`
'
,
(
done
)
=>
{
const
labels
=
[{
id
:
1
},
{
id
:
2
},
{
id
:
3
},
{
id
:
4
}];
const
labels
=
[{
id
:
1
},
{
id
:
2
},
{
id
:
3
},
{
id
:
4
}];
testAction
(
testAction
(
...
@@ -96,7 +96,7 @@ describe('LabelsSelect Actions', () => {
...
@@ -96,7 +96,7 @@ describe('LabelsSelect Actions', () => {
setFixtures
(
'
<div class="flash-container"></div>
'
);
setFixtures
(
'
<div class="flash-container"></div>
'
);
});
});
it
(
'
sets value `state.labelsFetchInProgress` to `false`
'
,
done
=>
{
it
(
'
sets value `state.labelsFetchInProgress` to `false`
'
,
(
done
)
=>
{
testAction
(
testAction
(
actions
.
receiveLabelsFailure
,
actions
.
receiveLabelsFailure
,
{},
{},
...
@@ -129,7 +129,7 @@ describe('LabelsSelect Actions', () => {
...
@@ -129,7 +129,7 @@ describe('LabelsSelect Actions', () => {
});
});
describe
(
'
on success
'
,
()
=>
{
describe
(
'
on success
'
,
()
=>
{
it
(
'
dispatches `requestLabels` & `receiveLabelsSuccess` actions
'
,
done
=>
{
it
(
'
dispatches `requestLabels` & `receiveLabelsSuccess` actions
'
,
(
done
)
=>
{
const
labels
=
[{
id
:
1
},
{
id
:
2
},
{
id
:
3
},
{
id
:
4
}];
const
labels
=
[{
id
:
1
},
{
id
:
2
},
{
id
:
3
},
{
id
:
4
}];
mock
.
onGet
(
/labels.json/
).
replyOnce
(
200
,
labels
);
mock
.
onGet
(
/labels.json/
).
replyOnce
(
200
,
labels
);
...
@@ -145,7 +145,7 @@ describe('LabelsSelect Actions', () => {
...
@@ -145,7 +145,7 @@ describe('LabelsSelect Actions', () => {
});
});
describe
(
'
on failure
'
,
()
=>
{
describe
(
'
on failure
'
,
()
=>
{
it
(
'
dispatches `requestLabels` & `receiveLabelsFailure` actions
'
,
done
=>
{
it
(
'
dispatches `requestLabels` & `receiveLabelsFailure` actions
'
,
(
done
)
=>
{
mock
.
onGet
(
/labels.json/
).
replyOnce
(
500
,
{});
mock
.
onGet
(
/labels.json/
).
replyOnce
(
500
,
{});
testAction
(
testAction
(
...
@@ -161,7 +161,7 @@ describe('LabelsSelect Actions', () => {
...
@@ -161,7 +161,7 @@ describe('LabelsSelect Actions', () => {
});
});
describe
(
'
requestCreateLabel
'
,
()
=>
{
describe
(
'
requestCreateLabel
'
,
()
=>
{
it
(
'
sets value `state.labelCreateInProgress` to `true`
'
,
done
=>
{
it
(
'
sets value `state.labelCreateInProgress` to `true`
'
,
(
done
)
=>
{
testAction
(
testAction
(
actions
.
requestCreateLabel
,
actions
.
requestCreateLabel
,
{},
{},
...
@@ -174,7 +174,7 @@ describe('LabelsSelect Actions', () => {
...
@@ -174,7 +174,7 @@ describe('LabelsSelect Actions', () => {
});
});
describe
(
'
receiveCreateLabelSuccess
'
,
()
=>
{
describe
(
'
receiveCreateLabelSuccess
'
,
()
=>
{
it
(
'
sets value `state.labelCreateInProgress` to `false`
'
,
done
=>
{
it
(
'
sets value `state.labelCreateInProgress` to `false`
'
,
(
done
)
=>
{
testAction
(
testAction
(
actions
.
receiveCreateLabelSuccess
,
actions
.
receiveCreateLabelSuccess
,
{},
{},
...
@@ -191,7 +191,7 @@ describe('LabelsSelect Actions', () => {
...
@@ -191,7 +191,7 @@ describe('LabelsSelect Actions', () => {
setFixtures
(
'
<div class="flash-container"></div>
'
);
setFixtures
(
'
<div class="flash-container"></div>
'
);
});
});
it
(
'
sets value `state.labelCreateInProgress` to `false`
'
,
done
=>
{
it
(
'
sets value `state.labelCreateInProgress` to `false`
'
,
(
done
)
=>
{
testAction
(
testAction
(
actions
.
receiveCreateLabelFailure
,
actions
.
receiveCreateLabelFailure
,
{},
{},
...
@@ -224,7 +224,7 @@ describe('LabelsSelect Actions', () => {
...
@@ -224,7 +224,7 @@ describe('LabelsSelect Actions', () => {
});
});
describe
(
'
on success
'
,
()
=>
{
describe
(
'
on success
'
,
()
=>
{
it
(
'
dispatches `requestCreateLabel`, `receiveCreateLabelSuccess` & `toggleDropdownContentsCreateView` actions
'
,
done
=>
{
it
(
'
dispatches `requestCreateLabel`, `receiveCreateLabelSuccess` & `toggleDropdownContentsCreateView` actions
'
,
(
done
)
=>
{
const
label
=
{
id
:
1
};
const
label
=
{
id
:
1
};
mock
.
onPost
(
/labels.json/
).
replyOnce
(
200
,
label
);
mock
.
onPost
(
/labels.json/
).
replyOnce
(
200
,
label
);
...
@@ -244,7 +244,7 @@ describe('LabelsSelect Actions', () => {
...
@@ -244,7 +244,7 @@ describe('LabelsSelect Actions', () => {
});
});
describe
(
'
on failure
'
,
()
=>
{
describe
(
'
on failure
'
,
()
=>
{
it
(
'
dispatches `requestCreateLabel` & `receiveCreateLabelFailure` actions
'
,
done
=>
{
it
(
'
dispatches `requestCreateLabel` & `receiveCreateLabelFailure` actions
'
,
(
done
)
=>
{
mock
.
onPost
(
/labels.json/
).
replyOnce
(
500
,
{});
mock
.
onPost
(
/labels.json/
).
replyOnce
(
500
,
{});
testAction
(
testAction
(
...
@@ -260,7 +260,7 @@ describe('LabelsSelect Actions', () => {
...
@@ -260,7 +260,7 @@ describe('LabelsSelect Actions', () => {
});
});
describe
(
'
updateSelectedLabels
'
,
()
=>
{
describe
(
'
updateSelectedLabels
'
,
()
=>
{
it
(
'
updates `state.labels` based on provided `labels` param
'
,
done
=>
{
it
(
'
updates `state.labels` based on provided `labels` param
'
,
(
done
)
=>
{
const
labels
=
[{
id
:
1
},
{
id
:
2
},
{
id
:
3
},
{
id
:
4
}];
const
labels
=
[{
id
:
1
},
{
id
:
2
},
{
id
:
3
},
{
id
:
4
}];
testAction
(
testAction
(
...
...
spec/frontend/vue_shared/components/sidebar/labels_select_vue/store/mutations_spec.js
View file @
325fb305
...
@@ -93,14 +93,14 @@ describe('LabelsSelect Mutations', () => {
...
@@ -93,14 +93,14 @@ describe('LabelsSelect Mutations', () => {
});
});
it
(
'
sets provided `labels` to `state.labels` along with `set` prop based on `state.selectedLabels`
'
,
()
=>
{
it
(
'
sets provided `labels` to `state.labels` along with `set` prop based on `state.selectedLabels`
'
,
()
=>
{
const
selectedLabelIds
=
selectedLabels
.
map
(
label
=>
label
.
id
);
const
selectedLabelIds
=
selectedLabels
.
map
(
(
label
)
=>
label
.
id
);
const
state
=
{
const
state
=
{
selectedLabels
,
selectedLabels
,
labelsFetchInProgress
:
true
,
labelsFetchInProgress
:
true
,
};
};
mutations
[
types
.
RECEIVE_SET_LABELS_SUCCESS
](
state
,
labels
);
mutations
[
types
.
RECEIVE_SET_LABELS_SUCCESS
](
state
,
labels
);
state
.
labels
.
forEach
(
label
=>
{
state
.
labels
.
forEach
(
(
label
)
=>
{
if
(
selectedLabelIds
.
includes
(
label
.
id
))
{
if
(
selectedLabelIds
.
includes
(
label
.
id
))
{
expect
(
label
.
set
).
toBe
(
true
);
expect
(
label
.
set
).
toBe
(
true
);
}
}
...
@@ -162,7 +162,7 @@ describe('LabelsSelect Mutations', () => {
...
@@ -162,7 +162,7 @@ describe('LabelsSelect Mutations', () => {
};
};
mutations
[
types
.
UPDATE_SELECTED_LABELS
](
state
,
{
labels
:
[{
id
:
2
}]
});
mutations
[
types
.
UPDATE_SELECTED_LABELS
](
state
,
{
labels
:
[{
id
:
2
}]
});
state
.
labels
.
forEach
(
label
=>
{
state
.
labels
.
forEach
(
(
label
)
=>
{
if
(
updatedLabelIds
.
includes
(
label
.
id
))
{
if
(
updatedLabelIds
.
includes
(
label
.
id
))
{
expect
(
label
.
touched
).
toBe
(
true
);
expect
(
label
.
touched
).
toBe
(
true
);
expect
(
label
.
set
).
toBe
(
true
);
expect
(
label
.
set
).
toBe
(
true
);
...
...
spec/frontend/vue_shared/components/slot_switch_spec.js
View file @
325fb305
...
@@ -10,14 +10,14 @@ describe('SlotSwitch', () => {
...
@@ -10,14 +10,14 @@ describe('SlotSwitch', () => {
let
wrapper
;
let
wrapper
;
const
createComponent
=
propsData
=>
{
const
createComponent
=
(
propsData
)
=>
{
wrapper
=
shallowMount
(
SlotSwitch
,
{
wrapper
=
shallowMount
(
SlotSwitch
,
{
propsData
,
propsData
,
slots
,
slots
,
});
});
};
};
const
getChildrenHtml
=
()
=>
wrapper
.
findAll
(
'
* *
'
).
wrappers
.
map
(
c
=>
c
.
html
());
const
getChildrenHtml
=
()
=>
wrapper
.
findAll
(
'
* *
'
).
wrappers
.
map
(
(
c
)
=>
c
.
html
());
afterEach
(()
=>
{
afterEach
(()
=>
{
if
(
wrapper
)
{
if
(
wrapper
)
{
...
...
spec/frontend/vue_shared/components/split_button_spec.js
View file @
325fb305
...
@@ -19,7 +19,7 @@ const mockActionItems = [
...
@@ -19,7 +19,7 @@ const mockActionItems = [
describe
(
'
SplitButton
'
,
()
=>
{
describe
(
'
SplitButton
'
,
()
=>
{
let
wrapper
;
let
wrapper
;
const
createComponent
=
propsData
=>
{
const
createComponent
=
(
propsData
)
=>
{
wrapper
=
shallowMount
(
SplitButton
,
{
wrapper
=
shallowMount
(
SplitButton
,
{
propsData
,
propsData
,
});
});
...
@@ -27,7 +27,7 @@ describe('SplitButton', () => {
...
@@ -27,7 +27,7 @@ describe('SplitButton', () => {
const
findDropdown
=
()
=>
wrapper
.
find
(
GlDropdown
);
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
=>
{
const
selectItem
=
(
index
)
=>
{
findDropdownItem
(
index
).
vm
.
$emit
(
'
click
'
);
findDropdownItem
(
index
).
vm
.
$emit
(
'
click
'
);
return
wrapper
.
vm
.
$nextTick
();
return
wrapper
.
vm
.
$nextTick
();
...
@@ -84,7 +84,7 @@ describe('SplitButton', () => {
...
@@ -84,7 +84,7 @@ describe('SplitButton', () => {
const
addChangeEventHandler
=
()
=>
{
const
addChangeEventHandler
=
()
=>
{
changeEventHandler
=
jest
.
fn
();
changeEventHandler
=
jest
.
fn
();
wrapper
.
vm
.
$once
(
'
change
'
,
item
=>
changeEventHandler
(
item
));
wrapper
.
vm
.
$once
(
'
change
'
,
(
item
)
=>
changeEventHandler
(
item
));
};
};
it
(
'
defaults to first actionItems event
'
,
()
=>
{
it
(
'
defaults to first actionItems event
'
,
()
=>
{
...
...
spec/frontend/vue_shared/components/table_pagination_spec.js
View file @
325fb305
...
@@ -6,7 +6,7 @@ describe('Pagination component', () => {
...
@@ -6,7 +6,7 @@ describe('Pagination component', () => {
let
wrapper
;
let
wrapper
;
let
spy
;
let
spy
;
const
mountComponent
=
props
=>
{
const
mountComponent
=
(
props
)
=>
{
wrapper
=
shallowMount
(
TablePagination
,
{
wrapper
=
shallowMount
(
TablePagination
,
{
propsData
:
props
,
propsData
:
props
,
});
});
...
...
spec/frontend/vue_shared/components/tabs/tab_spec.js
View file @
325fb305
...
@@ -10,7 +10,7 @@ describe('Tab component', () => {
...
@@ -10,7 +10,7 @@ describe('Tab component', () => {
vm
=
mountComponent
(
Component
);
vm
=
mountComponent
(
Component
);
});
});
it
(
'
sets localActive to equal active
'
,
done
=>
{
it
(
'
sets localActive to equal active
'
,
(
done
)
=>
{
vm
.
active
=
true
;
vm
.
active
=
true
;
vm
.
$nextTick
(()
=>
{
vm
.
$nextTick
(()
=>
{
...
@@ -20,7 +20,7 @@ describe('Tab component', () => {
...
@@ -20,7 +20,7 @@ describe('Tab component', () => {
});
});
});
});
it
(
'
sets active class
'
,
done
=>
{
it
(
'
sets active class
'
,
(
done
)
=>
{
vm
.
active
=
true
;
vm
.
active
=
true
;
vm
.
$nextTick
(()
=>
{
vm
.
$nextTick
(()
=>
{
...
...
spec/frontend/vue_shared/components/tooltip_on_truncate_spec.js
View file @
325fb305
...
@@ -139,7 +139,7 @@ describe('TooltipOnTruncate component', () => {
...
@@ -139,7 +139,7 @@ describe('TooltipOnTruncate component', () => {
createComponent
({
createComponent
({
propsData
:
{
propsData
:
{
title
:
DUMMY_TEXT
,
title
:
DUMMY_TEXT
,
truncateTarget
:
el
=>
el
.
childNodes
[
1
],
truncateTarget
:
(
el
)
=>
el
.
childNodes
[
1
],
},
},
slots
:
{
slots
:
{
default
:
[
createChildElement
(),
createChildElement
()],
default
:
[
createChildElement
(),
createChildElement
()],
...
...
spec/frontend/vue_shared/components/user_avatar/user_avatar_link_spec.js
View file @
325fb305
...
@@ -20,7 +20,7 @@ describe('User Avatar Link Component', () => {
...
@@ -20,7 +20,7 @@ describe('User Avatar Link Component', () => {
username
:
'
username
'
,
username
:
'
username
'
,
};
};
const
createWrapper
=
props
=>
{
const
createWrapper
=
(
props
)
=>
{
wrapper
=
shallowMount
(
UserAvatarLink
,
{
wrapper
=
shallowMount
(
UserAvatarLink
,
{
propsData
:
{
propsData
:
{
...
defaultProps
,
...
defaultProps
,
...
...
spec/frontend/vue_shared/components/user_avatar/user_avatar_list_spec.js
View file @
325fb305
...
@@ -9,13 +9,13 @@ const TEST_BREAKPOINT = 5;
...
@@ -9,13 +9,13 @@ const TEST_BREAKPOINT = 5;
const
TEST_EMPTY_MESSAGE
=
'
Lorem ipsum empty
'
;
const
TEST_EMPTY_MESSAGE
=
'
Lorem ipsum empty
'
;
const
DEFAULT_EMPTY_MESSAGE
=
'
None
'
;
const
DEFAULT_EMPTY_MESSAGE
=
'
None
'
;
const
createUser
=
id
=>
({
const
createUser
=
(
id
)
=>
({
id
,
id
,
name
:
'
Lorem
'
,
name
:
'
Lorem
'
,
web_url
:
`
${
TEST_HOST
}
/
${
id
}
`
,
web_url
:
`
${
TEST_HOST
}
/
${
id
}
`
,
avatar_url
:
`
${
TEST_HOST
}
/
${
id
}
/avatar`
,
avatar_url
:
`
${
TEST_HOST
}
/
${
id
}
/avatar`
,
});
});
const
createList
=
n
=>
const
createList
=
(
n
)
=>
Array
(
n
)
Array
(
n
)
.
fill
(
1
)
.
fill
(
1
)
.
map
((
x
,
id
)
=>
createUser
(
id
));
.
map
((
x
,
id
)
=>
createUser
(
id
));
...
@@ -79,10 +79,10 @@ describe('UserAvatarList', () => {
...
@@ -79,10 +79,10 @@ describe('UserAvatarList', () => {
factory
({
propsData
:
{
items
}
});
factory
({
propsData
:
{
items
}
});
const
links
=
wrapper
.
findAll
(
UserAvatarLink
);
const
links
=
wrapper
.
findAll
(
UserAvatarLink
);
const
linkProps
=
links
.
wrappers
.
map
(
x
=>
x
.
props
());
const
linkProps
=
links
.
wrappers
.
map
(
(
x
)
=>
x
.
props
());
expect
(
linkProps
).
toEqual
(
expect
(
linkProps
).
toEqual
(
items
.
map
(
x
=>
items
.
map
(
(
x
)
=>
expect
.
objectContaining
({
expect
.
objectContaining
({
linkHref
:
x
.
web_url
,
linkHref
:
x
.
web_url
,
imgSrc
:
x
.
avatar_url
,
imgSrc
:
x
.
avatar_url
,
...
...
spec/frontend/vue_shared/components/user_popover/user_popover_spec.js
View file @
325fb305
...
@@ -33,7 +33,7 @@ describe('User Popover Component', () => {
...
@@ -33,7 +33,7 @@ describe('User Popover Component', () => {
wrapper
.
destroy
();
wrapper
.
destroy
();
});
});
const
findByTestId
=
testid
=>
wrapper
.
find
(
`[data-testid="
${
testid
}
"]`
);
const
findByTestId
=
(
testid
)
=>
wrapper
.
find
(
`[data-testid="
${
testid
}
"]`
);
const
findUserStatus
=
()
=>
wrapper
.
find
(
'
.js-user-status
'
);
const
findUserStatus
=
()
=>
wrapper
.
find
(
'
.js-user-status
'
);
const
findTarget
=
()
=>
document
.
querySelector
(
'
.js-user-link
'
);
const
findTarget
=
()
=>
document
.
querySelector
(
'
.js-user-link
'
);
const
findAvailabilityStatus
=
()
=>
wrapper
.
find
(
UserAvailabilityStatus
);
const
findAvailabilityStatus
=
()
=>
wrapper
.
find
(
UserAvailabilityStatus
);
...
@@ -148,7 +148,7 @@ describe('User Popover Component', () => {
...
@@ -148,7 +148,7 @@ describe('User Popover Component', () => {
createWrapper
({
user
});
createWrapper
({
user
});
expect
(
expect
(
wrapper
.
findAll
(
GlIcon
).
filter
(
icon
=>
icon
.
props
(
'
name
'
)
===
'
profile
'
).
length
,
wrapper
.
findAll
(
GlIcon
).
filter
(
(
icon
)
=>
icon
.
props
(
'
name
'
)
===
'
profile
'
).
length
,
).
toEqual
(
1
);
).
toEqual
(
1
);
});
});
...
@@ -160,9 +160,9 @@ describe('User Popover Component', () => {
...
@@ -160,9 +160,9 @@ describe('User Popover Component', () => {
createWrapper
({
user
});
createWrapper
({
user
});
expect
(
wrapper
.
findAll
(
GlIcon
).
filter
(
icon
=>
icon
.
props
(
'
name
'
)
===
'
work
'
).
length
).
toEqual
(
expect
(
1
,
wrapper
.
findAll
(
GlIcon
).
filter
((
icon
)
=>
icon
.
props
(
'
name
'
)
===
'
work
'
).
length
,
);
)
.
toEqual
(
1
)
;
});
});
});
});
...
...
spec/frontend/vue_shared/directives/validation_spec.js
View file @
325fb305
...
@@ -50,7 +50,7 @@ describe('validation directive', () => {
...
@@ -50,7 +50,7 @@ describe('validation directive', () => {
describe
.
each
([
true
,
false
])(
describe
.
each
([
true
,
false
])(
'
with fields untouched and "showValidation" set to "%s"
'
,
'
with fields untouched and "showValidation" set to "%s"
'
,
showValidation
=>
{
(
showValidation
)
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
createComponent
({
showValidation
});
createComponent
({
showValidation
});
});
});
...
@@ -78,7 +78,7 @@ describe('validation directive', () => {
...
@@ -78,7 +78,7 @@ describe('validation directive', () => {
`
(
`
(
'
with input-attributes set to $inputAttributes
'
,
'
with input-attributes set to $inputAttributes
'
,
({
inputAttributes
,
validValue
,
invalidValue
})
=>
{
({
inputAttributes
,
validValue
,
invalidValue
})
=>
{
const
setValueAndTriggerValidation
=
value
=>
{
const
setValueAndTriggerValidation
=
(
value
)
=>
{
const
input
=
findInput
();
const
input
=
findInput
();
input
.
setValue
(
value
);
input
.
setValue
(
value
);
input
.
trigger
(
'
blur
'
);
input
.
trigger
(
'
blur
'
);
...
...
spec/frontend/vue_shared/security_reports/components/security_report_download_dropdown_spec.js
View file @
325fb305
...
@@ -6,7 +6,7 @@ describe('SecurityReportDownloadDropdown component', () => {
...
@@ -6,7 +6,7 @@ describe('SecurityReportDownloadDropdown component', () => {
let
wrapper
;
let
wrapper
;
let
artifacts
;
let
artifacts
;
const
createComponent
=
props
=>
{
const
createComponent
=
(
props
)
=>
{
wrapper
=
shallowMount
(
SecurityReportDownloadDropdown
,
{
wrapper
=
shallowMount
(
SecurityReportDownloadDropdown
,
{
propsData
:
{
...
props
},
propsData
:
{
...
props
},
});
});
...
...
spec/frontend/vue_shared/security_reports/security_reports_app_spec.js
View file @
325fb305
...
@@ -42,7 +42,7 @@ describe('Security reports app', () => {
...
@@ -42,7 +42,7 @@ describe('Security reports app', () => {
discoverProjectSecurityPath
:
'
/discoverProjectSecurityPath
'
,
discoverProjectSecurityPath
:
'
/discoverProjectSecurityPath
'
,
};
};
const
createComponent
=
options
=>
{
const
createComponent
=
(
options
)
=>
{
wrapper
=
mount
(
wrapper
=
mount
(
SecurityReportsApp
,
SecurityReportsApp
,
merge
(
merge
(
...
@@ -61,7 +61,7 @@ describe('Security reports app', () => {
...
@@ -61,7 +61,7 @@ describe('Security reports app', () => {
const
pendingHandler
=
()
=>
new
Promise
(()
=>
{});
const
pendingHandler
=
()
=>
new
Promise
(()
=>
{});
const
successHandler
=
()
=>
Promise
.
resolve
({
data
:
securityReportDownloadPathsQueryResponse
});
const
successHandler
=
()
=>
Promise
.
resolve
({
data
:
securityReportDownloadPathsQueryResponse
});
const
failureHandler
=
()
=>
Promise
.
resolve
({
errors
:
[{
message
:
'
some error
'
}]
});
const
failureHandler
=
()
=>
Promise
.
resolve
({
errors
:
[{
message
:
'
some error
'
}]
});
const
createMockApolloProvider
=
handler
=>
{
const
createMockApolloProvider
=
(
handler
)
=>
{
localVue
.
use
(
VueApollo
);
localVue
.
use
(
VueApollo
);
const
requestHandlers
=
[[
securityReportDownloadPathsQuery
,
handler
]];
const
requestHandlers
=
[[
securityReportDownloadPathsQuery
,
handler
]];
...
@@ -74,7 +74,7 @@ describe('Security reports app', () => {
...
@@ -74,7 +74,7 @@ describe('Security reports app', () => {
const
findDownloadDropdown
=
()
=>
wrapper
.
find
(
SecurityReportDownloadDropdown
);
const
findDownloadDropdown
=
()
=>
wrapper
.
find
(
SecurityReportDownloadDropdown
);
const
findPipelinesTabAnchor
=
()
=>
wrapper
.
find
(
'
[data-testid="show-pipelines"]
'
);
const
findPipelinesTabAnchor
=
()
=>
wrapper
.
find
(
'
[data-testid="show-pipelines"]
'
);
const
findHelpIconComponent
=
()
=>
wrapper
.
find
(
HelpIcon
);
const
findHelpIconComponent
=
()
=>
wrapper
.
find
(
HelpIcon
);
const
setupMockJobArtifact
=
reportType
=>
{
const
setupMockJobArtifact
=
(
reportType
)
=>
{
jest
jest
.
spyOn
(
Api
,
'
pipelineJobs
'
)
.
spyOn
(
Api
,
'
pipelineJobs
'
)
.
mockResolvedValue
({
data
:
[{
artifacts
:
[{
file_type
:
reportType
}]
}]
});
.
mockResolvedValue
({
data
:
[{
artifacts
:
[{
file_type
:
reportType
}]
}]
});
...
@@ -93,8 +93,8 @@ describe('Security reports app', () => {
...
@@ -93,8 +93,8 @@ describe('Security reports app', () => {
describe
.
each
([
false
,
true
])(
describe
.
each
([
false
,
true
])(
'
given the coreSecurityMrWidgetCounts feature flag is %p
'
,
'
given the coreSecurityMrWidgetCounts feature flag is %p
'
,
coreSecurityMrWidgetCounts
=>
{
(
coreSecurityMrWidgetCounts
)
=>
{
const
createComponentWithFlag
=
options
=>
const
createComponentWithFlag
=
(
options
)
=>
createComponent
(
createComponent
(
merge
(
merge
(
{
{
...
@@ -108,7 +108,7 @@ describe('Security reports app', () => {
...
@@ -108,7 +108,7 @@ describe('Security reports app', () => {
),
),
);
);
describe
.
each
(
SecurityReportsApp
.
reportTypes
)(
'
given a report type %p
'
,
reportType
=>
{
describe
.
each
(
SecurityReportsApp
.
reportTypes
)(
'
given a report type %p
'
,
(
reportType
)
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
window
.
mrTabs
=
{
tabShown
:
jest
.
fn
()
};
window
.
mrTabs
=
{
tabShown
:
jest
.
fn
()
};
setupMockJobArtifact
(
reportType
);
setupMockJobArtifact
(
reportType
);
...
@@ -245,7 +245,7 @@ describe('Security reports app', () => {
...
@@ -245,7 +245,7 @@ describe('Security reports app', () => {
describe
(
'
given the coreSecurityMrWidgetCounts feature flag is enabled
'
,
()
=>
{
describe
(
'
given the coreSecurityMrWidgetCounts feature flag is enabled
'
,
()
=>
{
let
mock
;
let
mock
;
const
createComponentWithFlagEnabled
=
options
=>
const
createComponentWithFlagEnabled
=
(
options
)
=>
createComponent
(
createComponent
(
merge
(
options
,
{
merge
(
options
,
{
provide
:
{
provide
:
{
...
@@ -350,7 +350,7 @@ describe('Security reports app', () => {
...
@@ -350,7 +350,7 @@ describe('Security reports app', () => {
});
});
describe
(
'
given coreSecurityMrWidgetDownloads feature flag is enabled
'
,
()
=>
{
describe
(
'
given coreSecurityMrWidgetDownloads feature flag is enabled
'
,
()
=>
{
const
createComponentWithFlagEnabled
=
options
=>
const
createComponentWithFlagEnabled
=
(
options
)
=>
createComponent
(
createComponent
(
merge
(
options
,
{
merge
(
options
,
{
provide
:
{
provide
:
{
...
...
spec/frontend/vue_shared/security_reports/store/getters_spec.js
View file @
325fb305
...
@@ -13,7 +13,7 @@ import {
...
@@ -13,7 +13,7 @@ import {
}
from
'
~/vue_shared/security_reports/store/getters
'
;
}
from
'
~/vue_shared/security_reports/store/getters
'
;
import
{
CRITICAL
,
HIGH
,
LOW
}
from
'
~/vulnerabilities/constants
'
;
import
{
CRITICAL
,
HIGH
,
LOW
}
from
'
~/vulnerabilities/constants
'
;
const
generateVuln
=
severity
=>
({
severity
});
const
generateVuln
=
(
severity
)
=>
({
severity
});
describe
(
'
Security reports getters
'
,
()
=>
{
describe
(
'
Security reports getters
'
,
()
=>
{
let
state
;
let
state
;
...
...
spec/frontend/vue_shared/security_reports/store/modules/sast/actions_spec.js
View file @
325fb305
...
@@ -26,7 +26,7 @@ describe('sast report actions', () => {
...
@@ -26,7 +26,7 @@ describe('sast report actions', () => {
});
});
describe
(
'
setDiffEndpoint
'
,
()
=>
{
describe
(
'
setDiffEndpoint
'
,
()
=>
{
it
(
`should commit
${
types
.
SET_DIFF_ENDPOINT
}
with the correct path`
,
done
=>
{
it
(
`should commit
${
types
.
SET_DIFF_ENDPOINT
}
with the correct path`
,
(
done
)
=>
{
testAction
(
testAction
(
actions
.
setDiffEndpoint
,
actions
.
setDiffEndpoint
,
diffEndpoint
,
diffEndpoint
,
...
@@ -44,13 +44,13 @@ describe('sast report actions', () => {
...
@@ -44,13 +44,13 @@ describe('sast report actions', () => {
});
});
describe
(
'
requestDiff
'
,
()
=>
{
describe
(
'
requestDiff
'
,
()
=>
{
it
(
`should commit
${
types
.
REQUEST_DIFF
}
`
,
done
=>
{
it
(
`should commit
${
types
.
REQUEST_DIFF
}
`
,
(
done
)
=>
{
testAction
(
actions
.
requestDiff
,
{},
state
,
[{
type
:
types
.
REQUEST_DIFF
}],
[],
done
);
testAction
(
actions
.
requestDiff
,
{},
state
,
[{
type
:
types
.
REQUEST_DIFF
}],
[],
done
);
});
});
});
});
describe
(
'
receiveDiffSuccess
'
,
()
=>
{
describe
(
'
receiveDiffSuccess
'
,
()
=>
{
it
(
`should commit
${
types
.
RECEIVE_DIFF_SUCCESS
}
with the correct response`
,
done
=>
{
it
(
`should commit
${
types
.
RECEIVE_DIFF_SUCCESS
}
with the correct response`
,
(
done
)
=>
{
testAction
(
testAction
(
actions
.
receiveDiffSuccess
,
actions
.
receiveDiffSuccess
,
reports
,
reports
,
...
@@ -68,7 +68,7 @@ describe('sast report actions', () => {
...
@@ -68,7 +68,7 @@ describe('sast report actions', () => {
});
});
describe
(
'
receiveDiffError
'
,
()
=>
{
describe
(
'
receiveDiffError
'
,
()
=>
{
it
(
`should commit
${
types
.
RECEIVE_DIFF_ERROR
}
with the correct response`
,
done
=>
{
it
(
`should commit
${
types
.
RECEIVE_DIFF_ERROR
}
with the correct response`
,
(
done
)
=>
{
testAction
(
testAction
(
actions
.
receiveDiffError
,
actions
.
receiveDiffError
,
error
,
error
,
...
@@ -107,7 +107,7 @@ describe('sast report actions', () => {
...
@@ -107,7 +107,7 @@ describe('sast report actions', () => {
.
replyOnce
(
200
,
reports
.
enrichData
);
.
replyOnce
(
200
,
reports
.
enrichData
);
});
});
it
(
'
should dispatch the `receiveDiffSuccess` action
'
,
done
=>
{
it
(
'
should dispatch the `receiveDiffSuccess` action
'
,
(
done
)
=>
{
const
{
diff
,
enrichData
}
=
reports
;
const
{
diff
,
enrichData
}
=
reports
;
testAction
(
testAction
(
actions
.
fetchDiff
,
actions
.
fetchDiff
,
...
@@ -135,7 +135,7 @@ describe('sast report actions', () => {
...
@@ -135,7 +135,7 @@ describe('sast report actions', () => {
mock
.
onGet
(
diffEndpoint
).
replyOnce
(
200
,
reports
.
diff
);
mock
.
onGet
(
diffEndpoint
).
replyOnce
(
200
,
reports
.
diff
);
});
});
it
(
'
should dispatch the `receiveDiffSuccess` action with empty enrich data
'
,
done
=>
{
it
(
'
should dispatch the `receiveDiffSuccess` action with empty enrich data
'
,
(
done
)
=>
{
const
{
diff
}
=
reports
;
const
{
diff
}
=
reports
;
const
enrichData
=
[];
const
enrichData
=
[];
testAction
(
testAction
(
...
@@ -167,7 +167,7 @@ describe('sast report actions', () => {
...
@@ -167,7 +167,7 @@ describe('sast report actions', () => {
.
replyOnce
(
404
);
.
replyOnce
(
404
);
});
});
it
(
'
should dispatch the `receiveError` action
'
,
done
=>
{
it
(
'
should dispatch the `receiveError` action
'
,
(
done
)
=>
{
testAction
(
testAction
(
actions
.
fetchDiff
,
actions
.
fetchDiff
,
{},
{},
...
@@ -188,7 +188,7 @@ describe('sast report actions', () => {
...
@@ -188,7 +188,7 @@ describe('sast report actions', () => {
.
replyOnce
(
200
,
reports
.
enrichData
);
.
replyOnce
(
200
,
reports
.
enrichData
);
});
});
it
(
'
should dispatch the `receiveDiffError` action
'
,
done
=>
{
it
(
'
should dispatch the `receiveDiffError` action
'
,
(
done
)
=>
{
testAction
(
testAction
(
actions
.
fetchDiff
,
actions
.
fetchDiff
,
{},
{},
...
...
spec/frontend/vue_shared/security_reports/store/modules/secret_detection/actions_spec.js
View file @
325fb305
...
@@ -26,7 +26,7 @@ describe('secret detection report actions', () => {
...
@@ -26,7 +26,7 @@ describe('secret detection report actions', () => {
});
});
describe
(
'
setDiffEndpoint
'
,
()
=>
{
describe
(
'
setDiffEndpoint
'
,
()
=>
{
it
(
`should commit
${
types
.
SET_DIFF_ENDPOINT
}
with the correct path`
,
done
=>
{
it
(
`should commit
${
types
.
SET_DIFF_ENDPOINT
}
with the correct path`
,
(
done
)
=>
{
testAction
(
testAction
(
actions
.
setDiffEndpoint
,
actions
.
setDiffEndpoint
,
diffEndpoint
,
diffEndpoint
,
...
@@ -44,13 +44,13 @@ describe('secret detection report actions', () => {
...
@@ -44,13 +44,13 @@ describe('secret detection report actions', () => {
});
});
describe
(
'
requestDiff
'
,
()
=>
{
describe
(
'
requestDiff
'
,
()
=>
{
it
(
`should commit
${
types
.
REQUEST_DIFF
}
`
,
done
=>
{
it
(
`should commit
${
types
.
REQUEST_DIFF
}
`
,
(
done
)
=>
{
testAction
(
actions
.
requestDiff
,
{},
state
,
[{
type
:
types
.
REQUEST_DIFF
}],
[],
done
);
testAction
(
actions
.
requestDiff
,
{},
state
,
[{
type
:
types
.
REQUEST_DIFF
}],
[],
done
);
});
});
});
});
describe
(
'
receiveDiffSuccess
'
,
()
=>
{
describe
(
'
receiveDiffSuccess
'
,
()
=>
{
it
(
`should commit
${
types
.
RECEIVE_DIFF_SUCCESS
}
with the correct response`
,
done
=>
{
it
(
`should commit
${
types
.
RECEIVE_DIFF_SUCCESS
}
with the correct response`
,
(
done
)
=>
{
testAction
(
testAction
(
actions
.
receiveDiffSuccess
,
actions
.
receiveDiffSuccess
,
reports
,
reports
,
...
@@ -68,7 +68,7 @@ describe('secret detection report actions', () => {
...
@@ -68,7 +68,7 @@ describe('secret detection report actions', () => {
});
});
describe
(
'
receiveDiffError
'
,
()
=>
{
describe
(
'
receiveDiffError
'
,
()
=>
{
it
(
`should commit
${
types
.
RECEIVE_DIFF_ERROR
}
with the correct response`
,
done
=>
{
it
(
`should commit
${
types
.
RECEIVE_DIFF_ERROR
}
with the correct response`
,
(
done
)
=>
{
testAction
(
testAction
(
actions
.
receiveDiffError
,
actions
.
receiveDiffError
,
error
,
error
,
...
@@ -107,7 +107,7 @@ describe('secret detection report actions', () => {
...
@@ -107,7 +107,7 @@ describe('secret detection report actions', () => {
.
replyOnce
(
200
,
reports
.
enrichData
);
.
replyOnce
(
200
,
reports
.
enrichData
);
});
});
it
(
'
should dispatch the `receiveDiffSuccess` action
'
,
done
=>
{
it
(
'
should dispatch the `receiveDiffSuccess` action
'
,
(
done
)
=>
{
const
{
diff
,
enrichData
}
=
reports
;
const
{
diff
,
enrichData
}
=
reports
;
testAction
(
testAction
(
actions
.
fetchDiff
,
actions
.
fetchDiff
,
...
@@ -135,7 +135,7 @@ describe('secret detection report actions', () => {
...
@@ -135,7 +135,7 @@ describe('secret detection report actions', () => {
mock
.
onGet
(
diffEndpoint
).
replyOnce
(
200
,
reports
.
diff
);
mock
.
onGet
(
diffEndpoint
).
replyOnce
(
200
,
reports
.
diff
);
});
});
it
(
'
should dispatch the `receiveDiffSuccess` action with empty enrich data
'
,
done
=>
{
it
(
'
should dispatch the `receiveDiffSuccess` action with empty enrich data
'
,
(
done
)
=>
{
const
{
diff
}
=
reports
;
const
{
diff
}
=
reports
;
const
enrichData
=
[];
const
enrichData
=
[];
testAction
(
testAction
(
...
@@ -167,7 +167,7 @@ describe('secret detection report actions', () => {
...
@@ -167,7 +167,7 @@ describe('secret detection report actions', () => {
.
replyOnce
(
404
);
.
replyOnce
(
404
);
});
});
it
(
'
should dispatch the `receiveDiffError` action
'
,
done
=>
{
it
(
'
should dispatch the `receiveDiffError` action
'
,
(
done
)
=>
{
testAction
(
testAction
(
actions
.
fetchDiff
,
actions
.
fetchDiff
,
{},
{},
...
@@ -188,7 +188,7 @@ describe('secret detection report actions', () => {
...
@@ -188,7 +188,7 @@ describe('secret detection report actions', () => {
.
replyOnce
(
200
,
reports
.
enrichData
);
.
replyOnce
(
200
,
reports
.
enrichData
);
});
});
it
(
'
should dispatch the `receiveDiffError` action
'
,
done
=>
{
it
(
'
should dispatch the `receiveDiffError` action
'
,
(
done
)
=>
{
testAction
(
testAction
(
actions
.
fetchDiff
,
actions
.
fetchDiff
,
{},
{},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment