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
0fdc1fc0
Commit
0fdc1fc0
authored
Dec 23, 2020
by
Lukas Eipert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run prettier on 32 files - 56 of 73
Part of our prettier migration; changing the arrow-parens style.
parent
157e117f
Changes
33
Hide whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
116 additions
and
150 deletions
+116
-150
.prettierignore
.prettierignore
+0
-34
spec/frontend/cycle_analytics/limit_warning_component_spec.js
.../frontend/cycle_analytics/limit_warning_component_spec.js
+1
-1
spec/frontend/deploy_freeze/components/timezone_dropdown_spec.js
...ontend/deploy_freeze/components/timezone_dropdown_spec.js
+1
-1
spec/frontend/deploy_keys/components/key_spec.js
spec/frontend/deploy_keys/components/key_spec.js
+2
-2
spec/frontend/deploy_keys/components/keys_panel_spec.js
spec/frontend/deploy_keys/components/keys_panel_spec.js
+1
-1
spec/frontend/deprecated_jquery_dropdown_spec.js
spec/frontend/deprecated_jquery_dropdown_spec.js
+2
-2
spec/frontend/design_management/components/design_notes/design_discussion_spec.js
...agement/components/design_notes/design_discussion_spec.js
+3
-3
spec/frontend/design_management/components/design_overlay_spec.js
...ntend/design_management/components/design_overlay_spec.js
+3
-3
spec/frontend/design_management/components/design_scaler_spec.js
...ontend/design_management/components/design_scaler_spec.js
+1
-1
spec/frontend/design_management/components/upload/design_version_dropdown_spec.js
...agement/components/upload/design_version_dropdown_spec.js
+2
-2
spec/frontend/design_management/pages/index_spec.js
spec/frontend/design_management/pages/index_spec.js
+1
-1
spec/frontend/design_management/router_spec.js
spec/frontend/design_management/router_spec.js
+2
-2
spec/frontend/design_management/utils/error_messages_spec.js
spec/frontend/design_management/utils/error_messages_spec.js
+2
-2
spec/frontend/diffs/components/app_spec.js
spec/frontend/diffs/components/app_spec.js
+9
-9
spec/frontend/diffs/components/compare_dropdown_layout_spec.js
...frontend/diffs/components/compare_dropdown_layout_spec.js
+1
-1
spec/frontend/diffs/components/compare_versions_spec.js
spec/frontend/diffs/components/compare_versions_spec.js
+2
-2
spec/frontend/diffs/components/diff_content_spec.js
spec/frontend/diffs/components/diff_content_spec.js
+1
-1
spec/frontend/diffs/components/diff_discussions_spec.js
spec/frontend/diffs/components/diff_discussions_spec.js
+1
-1
spec/frontend/diffs/components/diff_expansion_cell_spec.js
spec/frontend/diffs/components/diff_expansion_cell_spec.js
+1
-1
spec/frontend/diffs/components/diff_file_spec.js
spec/frontend/diffs/components/diff_file_spec.js
+9
-9
spec/frontend/diffs/components/diff_line_note_form_spec.js
spec/frontend/diffs/components/diff_line_note_form_spec.js
+2
-2
spec/frontend/diffs/components/diff_stats_spec.js
spec/frontend/diffs/components/diff_stats_spec.js
+3
-3
spec/frontend/diffs/components/diff_view_spec.js
spec/frontend/diffs/components/diff_view_spec.js
+1
-1
spec/frontend/diffs/components/image_diff_overlay_spec.js
spec/frontend/diffs/components/image_diff_overlay_spec.js
+1
-1
spec/frontend/diffs/components/no_changes_spec.js
spec/frontend/diffs/components/no_changes_spec.js
+1
-1
spec/frontend/diffs/components/parallel_diff_table_row_spec.js
...frontend/diffs/components/parallel_diff_table_row_spec.js
+7
-7
spec/frontend/diffs/components/settings_dropdown_spec.js
spec/frontend/diffs/components/settings_dropdown_spec.js
+8
-8
spec/frontend/diffs/store/actions_spec.js
spec/frontend/diffs/store/actions_spec.js
+34
-34
spec/frontend/diffs/store/getters_versions_dropdowns_spec.js
spec/frontend/diffs/store/getters_versions_dropdowns_spec.js
+2
-2
spec/frontend/diffs/store/utils_spec.js
spec/frontend/diffs/store/utils_spec.js
+4
-4
spec/frontend/diffs/utils/uuids_spec.js
spec/frontend/diffs/utils/uuids_spec.js
+1
-1
spec/frontend/dirty_submit/dirty_submit_collection_spec.js
spec/frontend/dirty_submit/dirty_submit_collection_spec.js
+3
-3
spec/frontend/dirty_submit/dirty_submit_form_spec.js
spec/frontend/dirty_submit/dirty_submit_form_spec.js
+4
-4
No files found.
.prettierignore
View file @
0fdc1fc0
...
...
@@ -1706,40 +1706,6 @@ spec/frontend/behaviors/markdown/paste_markdown_table_spec.js
spec/frontend/behaviors/quick_submit_spec.js
spec/frontend/behaviors/secret_values_spec.js
## eloquent-black
spec/frontend/cycle_analytics/limit_warning_component_spec.js
spec/frontend/deploy_freeze/components/timezone_dropdown_spec.js
spec/frontend/deploy_keys/components/key_spec.js
spec/frontend/deploy_keys/components/keys_panel_spec.js
spec/frontend/deprecated_jquery_dropdown_spec.js
spec/frontend/design_management/components/design_notes/design_discussion_spec.js
spec/frontend/design_management/components/design_overlay_spec.js
spec/frontend/design_management/components/design_scaler_spec.js
spec/frontend/design_management/components/upload/design_version_dropdown_spec.js
spec/frontend/design_management/pages/index_spec.js
spec/frontend/design_management/router_spec.js
spec/frontend/design_management/utils/error_messages_spec.js
spec/frontend/diffs/components/app_spec.js
spec/frontend/diffs/components/compare_dropdown_layout_spec.js
spec/frontend/diffs/components/compare_versions_spec.js
spec/frontend/diffs/components/diff_content_spec.js
spec/frontend/diffs/components/diff_discussions_spec.js
spec/frontend/diffs/components/diff_expansion_cell_spec.js
spec/frontend/diffs/components/diff_file_spec.js
spec/frontend/diffs/components/diff_line_note_form_spec.js
spec/frontend/diffs/components/diff_stats_spec.js
spec/frontend/diffs/components/diff_view_spec.js
spec/frontend/diffs/components/image_diff_overlay_spec.js
spec/frontend/diffs/components/no_changes_spec.js
spec/frontend/diffs/components/parallel_diff_table_row_spec.js
spec/frontend/diffs/components/settings_dropdown_spec.js
spec/frontend/diffs/store/actions_spec.js
spec/frontend/diffs/store/getters_versions_dropdowns_spec.js
spec/frontend/diffs/store/utils_spec.js
spec/frontend/diffs/utils/uuids_spec.js
spec/frontend/dirty_submit/dirty_submit_collection_spec.js
spec/frontend/dirty_submit/dirty_submit_form_spec.js
## exciting-driscoll
spec/frontend/droplab/drop_down_spec.js
spec/frontend/droplab/plugins/ajax_filter_spec.js
...
...
spec/frontend/cycle_analytics/limit_warning_component_spec.js
View file @
0fdc1fc0
...
...
@@ -5,7 +5,7 @@ import LimitWarningComponent from '~/cycle_analytics/components/limit_warning_co
Vue
.
use
(
Translate
);
const
createComponent
=
props
=>
const
createComponent
=
(
props
)
=>
shallowMount
(
LimitWarningComponent
,
{
propsData
:
{
...
props
,
...
...
spec/frontend/deploy_freeze/components/timezone_dropdown_spec.js
View file @
0fdc1fc0
...
...
@@ -30,7 +30,7 @@ describe('Deploy freeze timezone dropdown', () => {
};
const
findAllDropdownItems
=
()
=>
wrapper
.
findAll
(
GlDropdownItem
);
const
findDropdownItemByIndex
=
index
=>
wrapper
.
findAll
(
GlDropdownItem
).
at
(
index
);
const
findDropdownItemByIndex
=
(
index
)
=>
wrapper
.
findAll
(
GlDropdownItem
).
at
(
index
);
afterEach
(()
=>
{
wrapper
.
destroy
();
...
...
spec/frontend/deploy_keys/components/key_spec.js
View file @
0fdc1fc0
...
...
@@ -9,9 +9,9 @@ describe('Deploy keys key', () => {
const
data
=
getJSONFixture
(
'
deploy_keys/keys.json
'
);
const
findTextAndTrim
=
selector
=>
wrapper
.
find
(
selector
).
text
().
trim
();
const
findTextAndTrim
=
(
selector
)
=>
wrapper
.
find
(
selector
).
text
().
trim
();
const
createComponent
=
propsData
=>
{
const
createComponent
=
(
propsData
)
=>
{
wrapper
=
mount
(
key
,
{
propsData
:
{
store
,
...
...
spec/frontend/deploy_keys/components/keys_panel_spec.js
View file @
0fdc1fc0
...
...
@@ -8,7 +8,7 @@ describe('Deploy keys panel', () => {
const
findTableRowHeader
=
()
=>
wrapper
.
find
(
'
.table-row-header
'
);
const
mountComponent
=
props
=>
{
const
mountComponent
=
(
props
)
=>
{
const
store
=
new
DeployKeysStore
();
store
.
keys
=
data
;
wrapper
=
mount
(
deployKeysPanel
,
{
...
...
spec/frontend/deprecated_jquery_dropdown_spec.js
View file @
0fdc1fc0
...
...
@@ -56,8 +56,8 @@ describe('deprecatedJQueryDropdown', () => {
search
:
{
fields
:
[
'
name
'
],
},
text
:
project
=>
project
.
name_with_namespace
||
project
.
name
,
id
:
project
=>
project
.
id
,
text
:
(
project
)
=>
project
.
name_with_namespace
||
project
.
name
,
id
:
(
project
)
=>
project
.
id
,
...
extraOpts
,
};
test
.
dropdownButtonElement
=
$
(
'
#js-project-dropdown
'
,
test
.
dropdownContainerElement
);
...
...
spec/frontend/design_management/components/design_notes/design_discussion_spec.js
View file @
0fdc1fc0
...
...
@@ -108,7 +108,7 @@ describe('Design discussions component', () => {
it
(
'
renders correct amount of discussion notes
'
,
()
=>
{
expect
(
findDesignNotes
()).
toHaveLength
(
2
);
expect
(
findDesignNotes
().
wrappers
.
every
(
w
=>
w
.
isVisible
())).
toBe
(
true
);
expect
(
findDesignNotes
().
wrappers
.
every
(
(
w
)
=>
w
.
isVisible
())).
toBe
(
true
);
});
it
(
'
renders reply placeholder
'
,
()
=>
{
...
...
@@ -251,7 +251,7 @@ describe('Design discussions component', () => {
describe
(
'
when any note from a discussion is active
'
,
()
=>
{
it
.
each
([
notes
[
0
],
notes
[
0
].
discussion
.
notes
.
nodes
[
1
]])(
'
applies correct class to all notes in the active discussion
'
,
note
=>
{
(
note
)
=>
{
createComponent
(
{
discussion
:
mockDiscussion
},
{
...
...
@@ -265,7 +265,7 @@ describe('Design discussions component', () => {
expect
(
wrapper
.
findAll
(
DesignNote
)
.
wrappers
.
every
(
designNote
=>
designNote
.
classes
(
'
gl-bg-blue-50
'
)),
.
wrappers
.
every
(
(
designNote
)
=>
designNote
.
classes
(
'
gl-bg-blue-50
'
)),
).
toBe
(
true
);
},
);
...
...
spec/frontend/design_management/components/design_overlay_spec.js
View file @
0fdc1fc0
...
...
@@ -13,7 +13,7 @@ describe('Design overlay component', () => {
const
findAllNotes
=
()
=>
wrapper
.
findAll
(
'
.js-image-badge
'
);
const
findCommentBadge
=
()
=>
wrapper
.
find
(
'
.comment-indicator
'
);
const
findBadgeAtIndex
=
noteIndex
=>
findAllNotes
().
at
(
noteIndex
);
const
findBadgeAtIndex
=
(
noteIndex
)
=>
findAllNotes
().
at
(
noteIndex
);
const
findFirstBadge
=
()
=>
findBadgeAtIndex
(
0
);
const
findSecondBadge
=
()
=>
findBadgeAtIndex
(
1
);
...
...
@@ -108,7 +108,7 @@ describe('Design overlay component', () => {
describe
(
'
when no discussion is active
'
,
()
=>
{
it
(
'
should not apply inactive class to any pins
'
,
()
=>
{
expect
(
findAllNotes
(
0
).
wrappers
.
every
(
designNote
=>
designNote
.
classes
(
'
gl-bg-blue-50
'
)),
findAllNotes
(
0
).
wrappers
.
every
(
(
designNote
)
=>
designNote
.
classes
(
'
gl-bg-blue-50
'
)),
).
toBe
(
false
);
});
});
...
...
@@ -116,7 +116,7 @@ describe('Design overlay component', () => {
describe
(
'
when a discussion is active
'
,
()
=>
{
it
.
each
([
notes
[
0
].
discussion
.
notes
.
nodes
[
1
],
notes
[
0
].
discussion
.
notes
.
nodes
[
0
]])(
'
should not apply inactive class to the pin for the active discussion
'
,
note
=>
{
(
note
)
=>
{
wrapper
.
setData
({
activeDiscussion
:
{
id
:
note
.
id
,
...
...
spec/frontend/design_management/components/design_scaler_spec.js
View file @
0fdc1fc0
...
...
@@ -10,7 +10,7 @@ describe('Design management design scaler component', () => {
const
getResetScaleButton
=
()
=>
getButtons
().
at
(
1
);
const
getIncreaseScaleButton
=
()
=>
getButtons
().
at
(
2
);
const
setScale
=
scale
=>
wrapper
.
vm
.
setScale
(
scale
);
const
setScale
=
(
scale
)
=>
wrapper
.
vm
.
setScale
(
scale
);
const
createComponent
=
()
=>
{
wrapper
=
shallowMount
(
DesignScaler
);
...
...
spec/frontend/design_management/components/upload/design_version_dropdown_spec.js
View file @
0fdc1fc0
...
...
@@ -6,7 +6,7 @@ import mockAllVersions from './mock_data/all_versions';
const
LATEST_VERSION_ID
=
3
;
const
PREVIOUS_VERSION_ID
=
2
;
const
designRouteFactory
=
versionId
=>
({
const
designRouteFactory
=
(
versionId
)
=>
({
path
:
`/designs?version=
${
versionId
}
`
,
query
:
{
version
:
`
${
versionId
}
`
,
...
...
@@ -42,7 +42,7 @@ describe('Design management design version dropdown component', () => {
wrapper
.
destroy
();
});
const
findVersionLink
=
index
=>
wrapper
.
findAll
(
GlDropdownItem
).
at
(
index
);
const
findVersionLink
=
(
index
)
=>
wrapper
.
findAll
(
GlDropdownItem
).
at
(
index
);
it
(
'
renders design version dropdown button
'
,
()
=>
{
createComponent
();
...
...
spec/frontend/design_management/pages/index_spec.js
View file @
0fdc1fc0
...
...
@@ -572,7 +572,7 @@ describe('Design management index page', () => {
return
wrapper
.
vm
.
$nextTick
().
then
(()
=>
{
expect
(
findDeleteButton
().
props
().
hasSelectedDesigns
).
toBe
(
true
);
expect
(
findSelectAllButton
().
text
()).
toBe
(
'
Deselect all
'
);
expect
(
wrapper
.
vm
.
selectedDesigns
).
toEqual
(
mockDesigns
.
map
(
design
=>
design
.
filename
));
expect
(
wrapper
.
vm
.
selectedDesigns
).
toEqual
(
mockDesigns
.
map
(
(
design
)
=>
design
.
filename
));
});
});
...
...
spec/frontend/design_management/router_spec.js
View file @
0fdc1fc0
...
...
@@ -40,7 +40,7 @@ describe('Design management router', () => {
window
.
location
.
hash
=
''
;
});
describe
.
each
([[
'
/
'
],
[{
name
:
DESIGNS_ROUTE_NAME
}]])(
'
root route
'
,
routeArg
=>
{
describe
.
each
([[
'
/
'
],
[{
name
:
DESIGNS_ROUTE_NAME
}]])(
'
root route
'
,
(
routeArg
)
=>
{
it
(
'
pushes home component
'
,
()
=>
{
const
wrapper
=
factory
(
routeArg
);
...
...
@@ -50,7 +50,7 @@ describe('Design management router', () => {
describe
.
each
([[
'
/designs/1
'
],
[{
name
:
DESIGN_ROUTE_NAME
,
params
:
{
id
:
'
1
'
}
}]])(
'
designs detail route
'
,
routeArg
=>
{
(
routeArg
)
=>
{
it
(
'
pushes designs detail component
'
,
()
=>
{
const
wrapper
=
factory
(
routeArg
);
...
...
spec/frontend/design_management/utils/error_messages_spec.js
View file @
0fdc1fc0
...
...
@@ -3,7 +3,7 @@ import {
designUploadSkippedWarning
,
}
from
'
~/design_management/utils/error_messages
'
;
const
mockFilenames
=
n
=>
const
mockFilenames
=
(
n
)
=>
Array
(
n
)
.
fill
(
0
)
.
map
((
_
,
i
)
=>
({
filename
:
`
${
i
+
1
}
.jpg`
}));
...
...
@@ -14,7 +14,7 @@ describe('Error message', () => {
const
pluralMsg
=
'
Could not archive designs. Please try again.
'
;
describe
(
'
when [singular=true]
'
,
()
=>
{
it
.
each
([[
undefined
],
[
true
]])(
'
uses singular grammar
'
,
singularOption
=>
{
it
.
each
([[
undefined
],
[
true
]])(
'
uses singular grammar
'
,
(
singularOption
)
=>
{
expect
(
designDeletionError
({
singular
:
singularOption
})).
toEqual
(
singularMsg
);
});
});
...
...
spec/frontend/diffs/components/app_spec.js
View file @
0fdc1fc0
...
...
@@ -102,13 +102,13 @@ describe('diffs/components/app', () => {
});
describe
(
'
fetch diff methods
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
const
fetchResolver
=
()
=>
{
store
.
state
.
diffs
.
retrievingBatches
=
false
;
store
.
state
.
notes
.
discussions
=
'
test
'
;
return
Promise
.
resolve
({
real_size
:
100
});
};
jest
.
spyOn
(
window
,
'
requestIdleCallback
'
).
mockImplementation
(
fn
=>
fn
());
jest
.
spyOn
(
window
,
'
requestIdleCallback
'
).
mockImplementation
(
(
fn
)
=>
fn
());
createComponent
();
jest
.
spyOn
(
wrapper
.
vm
,
'
fetchDiffFilesMeta
'
).
mockImplementation
(
fetchResolver
);
jest
.
spyOn
(
wrapper
.
vm
,
'
fetchDiffFilesBatch
'
).
mockImplementation
(
fetchResolver
);
...
...
@@ -122,7 +122,7 @@ describe('diffs/components/app', () => {
wrapper
.
vm
.
$nextTick
(
done
);
});
it
(
'
calls batch methods if diffsBatchLoad is enabled, and not latest version
'
,
done
=>
{
it
(
'
calls batch methods if diffsBatchLoad is enabled, and not latest version
'
,
(
done
)
=>
{
expect
(
wrapper
.
vm
.
diffFilesLength
).
toEqual
(
0
);
wrapper
.
vm
.
isLatestVersion
=
()
=>
false
;
wrapper
.
vm
.
fetchData
(
false
);
...
...
@@ -139,7 +139,7 @@ describe('diffs/components/app', () => {
});
});
it
(
'
calls batch methods if diffsBatchLoad is enabled, and latest version
'
,
done
=>
{
it
(
'
calls batch methods if diffsBatchLoad is enabled, and latest version
'
,
(
done
)
=>
{
expect
(
wrapper
.
vm
.
diffFilesLength
).
toEqual
(
0
);
wrapper
.
vm
.
fetchData
(
false
);
...
...
@@ -216,7 +216,7 @@ describe('diffs/components/app', () => {
window
.
location
.
hash
=
'
ABC_123
'
;
});
it
(
'
sets highlighted row if hash exists in location object
'
,
done
=>
{
it
(
'
sets highlighted row if hash exists in location object
'
,
(
done
)
=>
{
createComponent
({
shouldShow
:
true
,
});
...
...
@@ -267,7 +267,7 @@ describe('diffs/components/app', () => {
});
});
it
(
'
marks current diff file based on currently highlighted row
'
,
done
=>
{
it
(
'
marks current diff file based on currently highlighted row
'
,
(
done
)
=>
{
createComponent
({
shouldShow
:
true
,
});
...
...
@@ -439,7 +439,7 @@ describe('diffs/components/app', () => {
wrapper
.
destroy
();
});
it
(
'
jumps to next and previous files in the list
'
,
done
=>
{
it
(
'
jumps to next and previous files in the list
'
,
(
done
)
=>
{
wrapper
.
vm
.
$nextTick
()
.
then
(()
=>
{
...
...
@@ -459,7 +459,7 @@ describe('diffs/components/app', () => {
.
catch
(
done
.
fail
);
});
it
(
'
does not jump to previous file from the first one
'
,
done
=>
{
it
(
'
does not jump to previous file from the first one
'
,
(
done
)
=>
{
wrapper
.
vm
.
$nextTick
()
.
then
(()
=>
{
...
...
@@ -476,7 +476,7 @@ describe('diffs/components/app', () => {
.
catch
(
done
.
fail
);
});
it
(
'
does not jump to next file from the last one
'
,
done
=>
{
it
(
'
does not jump to next file from the last one
'
,
(
done
)
=>
{
wrapper
.
vm
.
$nextTick
()
.
then
(()
=>
{
...
...
spec/frontend/diffs/components/compare_dropdown_layout_spec.js
View file @
0fdc1fc0
...
...
@@ -31,7 +31,7 @@ describe('CompareDropdownLayout', () => {
const
findListItems
=
()
=>
wrapper
.
findAll
(
'
li
'
);
const
findListItemsData
=
()
=>
findListItems
().
wrappers
.
map
(
listItem
=>
({
findListItems
().
wrappers
.
map
(
(
listItem
)
=>
({
href
:
listItem
.
find
(
'
a
'
).
attributes
(
'
href
'
),
text
:
trimText
(
listItem
.
text
()),
createdAt
:
listItem
.
findAll
(
TimeAgo
).
wrappers
[
0
]?.
props
(
'
time
'
),
...
...
spec/frontend/diffs/components/compare_versions_spec.js
View file @
0fdc1fc0
...
...
@@ -13,7 +13,7 @@ describe('CompareVersions', () => {
let
wrapper
;
const
targetBranchName
=
'
tmp-wine-dev
'
;
const
createWrapper
=
props
=>
{
const
createWrapper
=
(
props
)
=>
{
const
store
=
createStore
();
const
mergeRequestDiff
=
diffsMockData
[
0
];
...
...
@@ -121,7 +121,7 @@ describe('CompareVersions', () => {
});
describe
(
'
commit
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
(
done
)
=>
{
wrapper
.
vm
.
$store
.
state
.
diffs
.
commit
=
getDiffWithCommit
().
commit
;
wrapper
.
mergeRequestDiffs
=
[];
...
...
spec/frontend/diffs/components/diff_content_spec.js
View file @
0fdc1fc0
...
...
@@ -102,7 +102,7 @@ describe('DiffContent', () => {
describe
(
'
with text based files
'
,
()
=>
{
afterEach
(()
=>
{
[
isParallelViewGetterMock
,
isInlineViewGetterMock
].
forEach
(
m
=>
m
.
mockRestore
());
[
isParallelViewGetterMock
,
isInlineViewGetterMock
].
forEach
(
(
m
)
=>
m
.
mockRestore
());
});
const
textDiffFile
=
{
...
defaultProps
.
diffFile
,
viewer
:
{
name
:
diffViewerModes
.
text
}
};
...
...
spec/frontend/diffs/components/diff_discussions_spec.js
View file @
0fdc1fc0
...
...
@@ -15,7 +15,7 @@ describe('DiffDiscussions', () => {
let
wrapper
;
const
getDiscussionsMockData
=
()
=>
[{
...
discussionsMockData
}];
const
createComponent
=
props
=>
{
const
createComponent
=
(
props
)
=>
{
store
=
createStore
();
wrapper
=
mount
(
localVue
.
extend
(
DiffDiscussions
),
{
store
,
...
...
spec/frontend/diffs/components/diff_expansion_cell_spec.js
View file @
0fdc1fc0
...
...
@@ -14,7 +14,7 @@ const lineSources = {
[
INLINE_DIFF_VIEW_TYPE
]:
'
highlighted_diff_lines
'
,
};
const
lineHandlers
=
{
[
INLINE_DIFF_VIEW_TYPE
]:
line
=>
line
,
[
INLINE_DIFF_VIEW_TYPE
]:
(
line
)
=>
line
,
};
function
makeLoadMoreLinesPayload
({
...
...
spec/frontend/diffs/components/diff_file_spec.js
View file @
0fdc1fc0
...
...
@@ -96,13 +96,13 @@ function createComponent({ file, first = false, last = false }) {
};
}
const
findDiffHeader
=
wrapper
=>
wrapper
.
find
(
DiffFileHeaderComponent
);
const
findDiffContentArea
=
wrapper
=>
wrapper
.
find
(
'
[data-testid="content-area"]
'
);
const
findLoader
=
wrapper
=>
wrapper
.
find
(
'
[data-testid="loader-icon"]
'
);
const
findToggleButton
=
wrapper
=>
wrapper
.
find
(
'
[data-testid="expand-button"]
'
);
const
findDiffHeader
=
(
wrapper
)
=>
wrapper
.
find
(
DiffFileHeaderComponent
);
const
findDiffContentArea
=
(
wrapper
)
=>
wrapper
.
find
(
'
[data-testid="content-area"]
'
);
const
findLoader
=
(
wrapper
)
=>
wrapper
.
find
(
'
[data-testid="loader-icon"]
'
);
const
findToggleButton
=
(
wrapper
)
=>
wrapper
.
find
(
'
[data-testid="expand-button"]
'
);
const
toggleFile
=
wrapper
=>
findDiffHeader
(
wrapper
).
vm
.
$emit
(
'
toggleFile
'
);
const
isDisplayNone
=
element
=>
element
.
style
.
display
===
'
none
'
;
const
toggleFile
=
(
wrapper
)
=>
findDiffHeader
(
wrapper
).
vm
.
$emit
(
'
toggleFile
'
);
const
isDisplayNone
=
(
element
)
=>
element
.
style
.
display
===
'
none
'
;
const
getReadableFile
=
()
=>
JSON
.
parse
(
JSON
.
stringify
(
diffFileMockDataReadable
));
const
getUnreadableFile
=
()
=>
JSON
.
parse
(
JSON
.
stringify
(
diffFileMockDataUnreadable
));
...
...
@@ -157,7 +157,7 @@ describe('DiffFile', () => {
await
wrapper
.
vm
.
$nextTick
();
expect
(
eventHub
.
$emit
).
toHaveBeenCalledTimes
(
events
.
length
);
events
.
forEach
(
event
=>
{
events
.
forEach
(
(
event
)
=>
{
expect
(
eventHub
.
$emit
).
toHaveBeenCalledWith
(
event
);
});
},
...
...
@@ -174,7 +174,7 @@ describe('DiffFile', () => {
}));
jest
.
spyOn
(
wrapper
.
vm
,
'
loadCollapsedDiff
'
).
mockResolvedValue
(
getReadableFile
());
jest
.
spyOn
(
window
,
'
requestIdleCallback
'
).
mockImplementation
(
fn
=>
fn
());
jest
.
spyOn
(
window
,
'
requestIdleCallback
'
).
mockImplementation
(
(
fn
)
=>
fn
());
makeFileAutomaticallyCollapsed
(
store
);
...
...
@@ -247,7 +247,7 @@ describe('DiffFile', () => {
it
(
'
should not have any content at all
'
,
async
()
=>
{
await
wrapper
.
vm
.
$nextTick
();
Array
.
from
(
findDiffContentArea
(
wrapper
).
element
.
children
).
forEach
(
child
=>
{
Array
.
from
(
findDiffContentArea
(
wrapper
).
element
.
children
).
forEach
(
(
child
)
=>
{
expect
(
isDisplayNone
(
child
)).
toBe
(
true
);
});
});
...
...
spec/frontend/diffs/components/diff_line_note_form_spec.js
View file @
0fdc1fc0
...
...
@@ -51,7 +51,7 @@ describe('DiffLineNoteForm', () => {
expect
(
window
.
confirm
).
not
.
toHaveBeenCalled
();
});
it
(
'
should call cancelCommentForm with lineCode
'
,
done
=>
{
it
(
'
should call cancelCommentForm with lineCode
'
,
(
done
)
=>
{
jest
.
spyOn
(
window
,
'
confirm
'
).
mockImplementation
(()
=>
{});
jest
.
spyOn
(
wrapper
.
vm
,
'
cancelCommentForm
'
).
mockImplementation
(()
=>
{});
jest
.
spyOn
(
wrapper
.
vm
,
'
resetAutoSave
'
).
mockImplementation
(()
=>
{});
...
...
@@ -72,7 +72,7 @@ describe('DiffLineNoteForm', () => {
});
describe
(
'
saveNoteForm
'
,
()
=>
{
it
(
'
should call saveNote action with proper params
'
,
done
=>
{
it
(
'
should call saveNote action with proper params
'
,
(
done
)
=>
{
const
saveDiffDiscussionSpy
=
jest
.
spyOn
(
wrapper
.
vm
,
'
saveDiffDiscussion
'
)
.
mockReturnValue
(
Promise
.
resolve
());
...
...
spec/frontend/diffs/components/diff_stats_spec.js
View file @
0fdc1fc0
...
...
@@ -39,7 +39,7 @@ describe('diff_stats', () => {
});
describe
(
'
line changes
'
,
()
=>
{
const
findFileLine
=
name
=>
wrapper
.
find
(
name
);
const
findFileLine
=
(
name
)
=>
wrapper
.
find
(
name
);
it
(
'
shows the amount of lines added
'
,
()
=>
{
expect
(
findFileLine
(
'
.js-file-addition-line
'
).
text
()).
toBe
(
TEST_ADDED_LINES
.
toString
());
...
...
@@ -51,10 +51,10 @@ describe('diff_stats', () => {
});
describe
(
'
files changes
'
,
()
=>
{
const
findIcon
=
name
=>
const
findIcon
=
(
name
)
=>
wrapper
.
findAll
(
GlIcon
)
.
filter
(
c
=>
c
.
attributes
(
'
name
'
)
===
name
)
.
filter
(
(
c
)
=>
c
.
attributes
(
'
name
'
)
===
name
)
.
at
(
0
).
element
.
parentNode
;
it
(
'
shows amount of file changed with plural "files" when 0 files has changed
'
,
()
=>
{
...
...
spec/frontend/diffs/components/diff_view_spec.js
View file @
0fdc1fc0
...
...
@@ -11,7 +11,7 @@ describe('DiffView', () => {
const
DiffRow
=
{
template
:
`<div/>`
};
const
DiffCommentCell
=
{
template
:
`<div/>`
};
const
DraftNote
=
{
template
:
`<div/>`
};
const
createWrapper
=
props
=>
{
const
createWrapper
=
(
props
)
=>
{
const
localVue
=
createLocalVue
();
localVue
.
use
(
Vuex
);
...
...
spec/frontend/diffs/components/image_diff_overlay_spec.js
View file @
0fdc1fc0
...
...
@@ -114,7 +114,7 @@ describe('Diffs image diff overlay component', () => {
describe
(
'
comment form
'
,
()
=>
{
const
getCommentIndicator
=
()
=>
wrapper
.
find
(
'
.comment-indicator
'
);
beforeEach
(()
=>
{
createComponent
({
canComment
:
true
},
store
=>
{
createComponent
({
canComment
:
true
},
(
store
)
=>
{
store
.
state
.
diffs
.
commentForms
.
push
({
fileHash
:
'
ABC
'
,
x
:
20
,
...
...
spec/frontend/diffs/components/no_changes_spec.js
View file @
0fdc1fc0
...
...
@@ -28,7 +28,7 @@ describe('Diff no changes empty state', () => {
});
it
(
'
prevents XSS
'
,
()
=>
{
createComponent
(
store
=>
{
createComponent
(
(
store
)
=>
{
// eslint-disable-next-line no-param-reassign
store
.
state
.
notes
.
noteableData
=
{
source_branch
:
'
<script>alert("test");</script>
'
,
...
...
spec/frontend/diffs/components/parallel_diff_table_row_spec.js
View file @
0fdc1fc0
...
...
@@ -40,7 +40,7 @@ describe('ParallelDiffTableRow', () => {
vm
=
wrapper
.
vm
;
});
it
(
'
does not highlight non empty line content when line does not match highlighted row
'
,
done
=>
{
it
(
'
does not highlight non empty line content when line does not match highlighted row
'
,
(
done
)
=>
{
vm
.
$nextTick
()
.
then
(()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.line_content.right-side
'
).
classList
).
not
.
toContain
(
'
hll
'
);
...
...
@@ -49,7 +49,7 @@ describe('ParallelDiffTableRow', () => {
.
catch
(
done
.
fail
);
});
it
(
'
highlights nonempty line content when line is the highlighted row
'
,
done
=>
{
it
(
'
highlights nonempty line content when line is the highlighted row
'
,
(
done
)
=>
{
vm
.
$nextTick
()
.
then
(()
=>
{
vm
.
$store
.
state
.
diffs
.
highlightedRow
=
rightLine
.
line_code
;
...
...
@@ -86,7 +86,7 @@ describe('ParallelDiffTableRow', () => {
}).
$mount
();
});
it
(
'
does not highlight either line when line does not match highlighted row
'
,
done
=>
{
it
(
'
does not highlight either line when line does not match highlighted row
'
,
(
done
)
=>
{
vm
.
$nextTick
()
.
then
(()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.line_content.right-side
'
).
classList
).
not
.
toContain
(
'
hll
'
);
...
...
@@ -96,7 +96,7 @@ describe('ParallelDiffTableRow', () => {
.
catch
(
done
.
fail
);
});
it
(
'
adds hll class to lineContent when line is the highlighted row
'
,
done
=>
{
it
(
'
adds hll class to lineContent when line is the highlighted row
'
,
(
done
)
=>
{
vm
.
$nextTick
()
.
then
(()
=>
{
vm
.
$store
.
state
.
diffs
.
highlightedRow
=
rightLine
.
line_code
;
...
...
@@ -112,7 +112,7 @@ describe('ParallelDiffTableRow', () => {
});
describe
(
'
sets coverage title and class
'
,
()
=>
{
it
(
'
for lines with coverage
'
,
done
=>
{
it
(
'
for lines with coverage
'
,
(
done
)
=>
{
vm
.
$nextTick
()
.
then
(()
=>
{
const
name
=
diffFileMockData
.
file_path
;
...
...
@@ -132,7 +132,7 @@ describe('ParallelDiffTableRow', () => {
.
catch
(
done
.
fail
);
});
it
(
'
for lines without coverage
'
,
done
=>
{
it
(
'
for lines without coverage
'
,
(
done
)
=>
{
vm
.
$nextTick
()
.
then
(()
=>
{
const
name
=
diffFileMockData
.
file_path
;
...
...
@@ -152,7 +152,7 @@ describe('ParallelDiffTableRow', () => {
.
catch
(
done
.
fail
);
});
it
(
'
for unknown lines
'
,
done
=>
{
it
(
'
for unknown lines
'
,
(
done
)
=>
{
vm
.
$nextTick
()
.
then
(()
=>
{
vm
.
$store
.
state
.
diffs
.
coverageFiles
=
{};
...
...
spec/frontend/diffs/components/settings_dropdown_spec.js
View file @
0fdc1fc0
...
...
@@ -73,7 +73,7 @@ describe('Diff settings dropdown component', () => {
});
it
(
'
sets list button as selected when renderTreeList is false
'
,
()
=>
{
createComponent
(
store
=>
{
createComponent
(
(
store
)
=>
{
Object
.
assign
(
store
.
state
.
diffs
,
{
renderTreeList
:
false
,
});
...
...
@@ -84,7 +84,7 @@ describe('Diff settings dropdown component', () => {
});
it
(
'
sets tree button as selected when renderTreeList is true
'
,
()
=>
{
createComponent
(
store
=>
{
createComponent
(
(
store
)
=>
{
Object
.
assign
(
store
.
state
.
diffs
,
{
renderTreeList
:
true
,
});
...
...
@@ -97,7 +97,7 @@ describe('Diff settings dropdown component', () => {
describe
(
'
compare changes
'
,
()
=>
{
it
(
'
sets inline button as selected
'
,
()
=>
{
createComponent
(
store
=>
{
createComponent
(
(
store
)
=>
{
Object
.
assign
(
store
.
state
.
diffs
,
{
diffViewType
:
INLINE_DIFF_VIEW_TYPE
,
});
...
...
@@ -108,7 +108,7 @@ describe('Diff settings dropdown component', () => {
});
it
(
'
sets parallel button as selected
'
,
()
=>
{
createComponent
(
store
=>
{
createComponent
(
(
store
)
=>
{
Object
.
assign
(
store
.
state
.
diffs
,
{
diffViewType
:
PARALLEL_DIFF_VIEW_TYPE
,
});
...
...
@@ -137,7 +137,7 @@ describe('Diff settings dropdown component', () => {
describe
(
'
whitespace toggle
'
,
()
=>
{
it
(
'
does not set as checked when showWhitespace is false
'
,
()
=>
{
createComponent
(
store
=>
{
createComponent
(
(
store
)
=>
{
Object
.
assign
(
store
.
state
.
diffs
,
{
showWhitespace
:
false
,
});
...
...
@@ -147,7 +147,7 @@ describe('Diff settings dropdown component', () => {
});
it
(
'
sets as checked when showWhitespace is true
'
,
()
=>
{
createComponent
(
store
=>
{
createComponent
(
(
store
)
=>
{
Object
.
assign
(
store
.
state
.
diffs
,
{
showWhitespace
:
true
,
});
...
...
@@ -183,7 +183,7 @@ describe('Diff settings dropdown component', () => {
`
(
'
sets the checkbox to { checked: $checked } if the fileByFile setting is $fileByFile
'
,
async
({
fileByFile
,
checked
})
=>
{
createComponent
(
store
=>
{
createComponent
(
(
store
)
=>
{
Object
.
assign
(
store
.
state
.
diffs
,
{
viewDiffsFileByFile
:
fileByFile
,
});
...
...
@@ -202,7 +202,7 @@ describe('Diff settings dropdown component', () => {
`
(
'
when the file by file setting starts as $start, toggling the checkbox should emit an event set to $emit
'
,
async
({
start
,
emit
})
=>
{
createComponent
(
store
=>
{
createComponent
(
(
store
)
=>
{
Object
.
assign
(
store
.
state
.
diffs
,
{
viewDiffsFileByFile
:
start
,
});
...
...
spec/frontend/diffs/store/actions_spec.js
View file @
0fdc1fc0
...
...
@@ -78,22 +78,22 @@ describe('DiffsStoreActions', () => {
jest
.
spyOn
(
commonUtils
,
'
scrollToElement
'
).
mockImplementation
(()
=>
null
);
jest
.
spyOn
(
utils
,
'
convertExpandLines
'
).
mockImplementation
(()
=>
null
);
jest
.
spyOn
(
utils
,
'
idleCallback
'
).
mockImplementation
(()
=>
null
);
[
'
requestAnimationFrame
'
,
'
requestIdleCallback
'
].
forEach
(
method
=>
{
global
[
method
]
=
cb
=>
{
[
'
requestAnimationFrame
'
,
'
requestIdleCallback
'
].
forEach
(
(
method
)
=>
{
global
[
method
]
=
(
cb
)
=>
{
cb
();
};
});
});
afterEach
(()
=>
{
[
'
requestAnimationFrame
'
,
'
requestIdleCallback
'
].
forEach
(
method
=>
{
[
'
requestAnimationFrame
'
,
'
requestIdleCallback
'
].
forEach
(
(
method
)
=>
{
global
[
method
]
=
originalMethods
[
method
];
});
createFlash
.
mockClear
();
});
describe
(
'
setBaseConfig
'
,
()
=>
{
it
(
'
should set given endpoint and project path
'
,
done
=>
{
it
(
'
should set given endpoint and project path
'
,
(
done
)
=>
{
const
endpoint
=
'
/diffs/set/endpoint
'
;
const
endpointMetadata
=
'
/diffs/set/endpoint/metadata
'
;
const
endpointBatch
=
'
/diffs/set/endpoint/batch
'
;
...
...
@@ -153,7 +153,7 @@ describe('DiffsStoreActions', () => {
mock
.
restore
();
});
it
(
'
should fetch batch diff files
'
,
done
=>
{
it
(
'
should fetch batch diff files
'
,
(
done
)
=>
{
const
endpointBatch
=
'
/fetch/diffs_batch
'
;
const
res1
=
{
diff_files
:
[{
file_hash
:
'
test
'
}],
pagination
:
{
next_page
:
2
}
};
const
res2
=
{
diff_files
:
[{
file_hash
:
'
test2
'
}],
pagination
:
{}
};
...
...
@@ -241,7 +241,7 @@ describe('DiffsStoreActions', () => {
mock
.
onGet
(
endpointMetadata
).
reply
(
200
,
diffMetadata
);
});
it
(
'
should fetch diff meta information
'
,
done
=>
{
it
(
'
should fetch diff meta information
'
,
(
done
)
=>
{
testAction
(
fetchDiffFilesMeta
,
{},
...
...
@@ -271,7 +271,7 @@ describe('DiffsStoreActions', () => {
afterEach
(()
=>
mock
.
restore
());
it
(
'
should commit SET_COVERAGE_DATA with received response
'
,
done
=>
{
it
(
'
should commit SET_COVERAGE_DATA with received response
'
,
(
done
)
=>
{
const
data
=
{
files
:
{
'
app.js
'
:
{
1
:
0
,
2
:
1
}
}
};
mock
.
onGet
(
endpointCoverage
).
reply
(
200
,
{
data
});
...
...
@@ -286,7 +286,7 @@ describe('DiffsStoreActions', () => {
);
});
it
(
'
should show flash on API error
'
,
done
=>
{
it
(
'
should show flash on API error
'
,
(
done
)
=>
{
mock
.
onGet
(
endpointCoverage
).
reply
(
400
);
testAction
(
fetchCoverageFiles
,
{},
{
endpointCoverage
},
[],
[],
()
=>
{
...
...
@@ -311,7 +311,7 @@ describe('DiffsStoreActions', () => {
window
.
location
.
hash
=
''
;
});
it
(
'
should merge discussions into diffs
'
,
done
=>
{
it
(
'
should merge discussions into diffs
'
,
(
done
)
=>
{
window
.
location
.
hash
=
'
ABC_123
'
;
const
state
=
{
...
...
@@ -405,7 +405,7 @@ describe('DiffsStoreActions', () => {
);
});
it
(
'
dispatches setCurrentDiffFileIdFromNote with note ID
'
,
done
=>
{
it
(
'
dispatches setCurrentDiffFileIdFromNote with note ID
'
,
(
done
)
=>
{
window
.
location
.
hash
=
'
note_123
'
;
testAction
(
...
...
@@ -420,7 +420,7 @@ describe('DiffsStoreActions', () => {
});
describe
(
'
removeDiscussionsFromDiff
'
,
()
=>
{
it
(
'
should remove discussions from diffs
'
,
done
=>
{
it
(
'
should remove discussions from diffs
'
,
(
done
)
=>
{
const
state
=
{
diffFiles
:
[
{
...
...
@@ -512,7 +512,7 @@ describe('DiffsStoreActions', () => {
});
describe
(
'
setInlineDiffViewType
'
,
()
=>
{
it
(
'
should set diff view type to inline and also set the cookie properly
'
,
done
=>
{
it
(
'
should set diff view type to inline and also set the cookie properly
'
,
(
done
)
=>
{
testAction
(
setInlineDiffViewType
,
null
,
...
...
@@ -530,7 +530,7 @@ describe('DiffsStoreActions', () => {
});
describe
(
'
setParallelDiffViewType
'
,
()
=>
{
it
(
'
should set diff view type to parallel and also set the cookie properly
'
,
done
=>
{
it
(
'
should set diff view type to parallel and also set the cookie properly
'
,
(
done
)
=>
{
testAction
(
setParallelDiffViewType
,
null
,
...
...
@@ -548,7 +548,7 @@ describe('DiffsStoreActions', () => {
});
describe
(
'
showCommentForm
'
,
()
=>
{
it
(
'
should call mutation to show comment form
'
,
done
=>
{
it
(
'
should call mutation to show comment form
'
,
(
done
)
=>
{
const
payload
=
{
lineCode
:
'
lineCode
'
,
fileHash
:
'
hash
'
};
testAction
(
...
...
@@ -563,7 +563,7 @@ describe('DiffsStoreActions', () => {
});
describe
(
'
cancelCommentForm
'
,
()
=>
{
it
(
'
should call mutation to cancel comment form
'
,
done
=>
{
it
(
'
should call mutation to cancel comment form
'
,
(
done
)
=>
{
const
payload
=
{
lineCode
:
'
lineCode
'
,
fileHash
:
'
hash
'
};
testAction
(
...
...
@@ -578,7 +578,7 @@ describe('DiffsStoreActions', () => {
});
describe
(
'
loadMoreLines
'
,
()
=>
{
it
(
'
should call mutation to show comment form
'
,
done
=>
{
it
(
'
should call mutation to show comment form
'
,
(
done
)
=>
{
const
endpoint
=
'
/diffs/load/more/lines
'
;
const
params
=
{
since
:
6
,
to
:
26
};
const
lineNumbers
=
{
oldLineNumber
:
3
,
newLineNumber
:
5
};
...
...
@@ -611,7 +611,7 @@ describe('DiffsStoreActions', () => {
describe
(
'
loadCollapsedDiff
'
,
()
=>
{
const
state
=
{
showWhitespace
:
true
};
it
(
'
should fetch data and call mutation with response and the give parameter
'
,
done
=>
{
it
(
'
should fetch data and call mutation with response and the give parameter
'
,
(
done
)
=>
{
const
file
=
{
hash
:
123
,
load_collapsed_diff_url
:
'
/load/collapsed/diff/url
'
};
const
data
=
{
hash
:
123
,
parallelDiffLines
:
[{
lineCode
:
1
}]
};
const
mock
=
new
MockAdapter
(
axios
);
...
...
@@ -811,7 +811,7 @@ describe('DiffsStoreActions', () => {
});
describe
(
'
saveDiffDiscussion
'
,
()
=>
{
it
(
'
dispatches actions
'
,
done
=>
{
it
(
'
dispatches actions
'
,
(
done
)
=>
{
const
commitId
=
'
something
'
;
const
formData
=
{
diffFile
:
{
...
mockDiffFile
},
...
...
@@ -823,7 +823,7 @@ describe('DiffsStoreActions', () => {
id
:
commitId
,
},
};
const
dispatch
=
jest
.
fn
(
name
=>
{
const
dispatch
=
jest
.
fn
(
(
name
)
=>
{
switch
(
name
)
{
case
'
saveNote
'
:
return
Promise
.
resolve
({
...
...
@@ -855,7 +855,7 @@ describe('DiffsStoreActions', () => {
});
describe
(
'
toggleTreeOpen
'
,
()
=>
{
it
(
'
commits TOGGLE_FOLDER_OPEN
'
,
done
=>
{
it
(
'
commits TOGGLE_FOLDER_OPEN
'
,
(
done
)
=>
{
testAction
(
toggleTreeOpen
,
'
path
'
,
...
...
@@ -904,7 +904,7 @@ describe('DiffsStoreActions', () => {
});
describe
(
'
setShowTreeList
'
,
()
=>
{
it
(
'
commits toggle
'
,
done
=>
{
it
(
'
commits toggle
'
,
(
done
)
=>
{
testAction
(
setShowTreeList
,
{
showTreeList
:
true
},
...
...
@@ -992,7 +992,7 @@ describe('DiffsStoreActions', () => {
});
describe
(
'
setRenderTreeList
'
,
()
=>
{
it
(
'
commits SET_RENDER_TREE_LIST
'
,
done
=>
{
it
(
'
commits SET_RENDER_TREE_LIST
'
,
(
done
)
=>
{
testAction
(
setRenderTreeList
,
true
,
...
...
@@ -1015,7 +1015,7 @@ describe('DiffsStoreActions', () => {
jest
.
spyOn
(
eventHub
,
'
$emit
'
).
mockImplementation
();
});
it
(
'
commits SET_SHOW_WHITESPACE
'
,
done
=>
{
it
(
'
commits SET_SHOW_WHITESPACE
'
,
(
done
)
=>
{
testAction
(
setShowWhitespace
,
{
showWhitespace
:
true
},
...
...
@@ -1058,13 +1058,13 @@ describe('DiffsStoreActions', () => {
});
describe
(
'
setRenderIt
'
,
()
=>
{
it
(
'
commits RENDER_FILE
'
,
done
=>
{
it
(
'
commits RENDER_FILE
'
,
(
done
)
=>
{
testAction
(
setRenderIt
,
'
file
'
,
{},
[{
type
:
types
.
RENDER_FILE
,
payload
:
'
file
'
}],
[],
done
);
});
});
describe
(
'
receiveFullDiffError
'
,
()
=>
{
it
(
'
updates state with the file that did not load
'
,
done
=>
{
it
(
'
updates state with the file that did not load
'
,
(
done
)
=>
{
testAction
(
receiveFullDiffError
,
'
file
'
,
...
...
@@ -1092,7 +1092,7 @@ describe('DiffsStoreActions', () => {
mock
.
onGet
(
`
${
TEST_HOST
}
/context`
).
replyOnce
(
200
,
[
'
test
'
]);
});
it
(
'
commits the success and dispatches an action to expand the new lines
'
,
done
=>
{
it
(
'
commits the success and dispatches an action to expand the new lines
'
,
(
done
)
=>
{
const
file
=
{
context_lines_path
:
`
${
TEST_HOST
}
/context`
,
file_path
:
'
test
'
,
...
...
@@ -1114,7 +1114,7 @@ describe('DiffsStoreActions', () => {
mock
.
onGet
(
`
${
TEST_HOST
}
/context`
).
replyOnce
(
500
);
});
it
(
'
dispatches receiveFullDiffError
'
,
done
=>
{
it
(
'
dispatches receiveFullDiffError
'
,
(
done
)
=>
{
testAction
(
fetchFullDiff
,
{
context_lines_path
:
`
${
TEST_HOST
}
/context`
,
file_path
:
'
test
'
,
file_hash
:
'
test
'
},
...
...
@@ -1136,7 +1136,7 @@ describe('DiffsStoreActions', () => {
};
});
it
(
'
dispatches fetchFullDiff when file is not expanded
'
,
done
=>
{
it
(
'
dispatches fetchFullDiff when file is not expanded
'
,
(
done
)
=>
{
testAction
(
toggleFullDiff
,
'
test
'
,
...
...
@@ -1212,7 +1212,7 @@ describe('DiffsStoreActions', () => {
});
describe
(
'
setFileUserCollapsed
'
,
()
=>
{
it
(
'
commits SET_FILE_COLLAPSED
'
,
done
=>
{
it
(
'
commits SET_FILE_COLLAPSED
'
,
(
done
)
=>
{
testAction
(
setFileCollapsedByUser
,
{
filePath
:
'
test
'
,
collapsed
:
true
},
...
...
@@ -1231,12 +1231,12 @@ describe('DiffsStoreActions', () => {
describe
(
'
setExpandedDiffLines
'
,
()
=>
{
beforeEach
(()
=>
{
utils
.
idleCallback
.
mockImplementation
(
cb
=>
{
utils
.
idleCallback
.
mockImplementation
(
(
cb
)
=>
{
cb
({
timeRemaining
:
()
=>
50
});
});
});
it
(
'
commits SET_CURRENT_VIEW_DIFF_FILE_LINES when lines less than MAX_RENDERING_DIFF_LINES
'
,
done
=>
{
it
(
'
commits SET_CURRENT_VIEW_DIFF_FILE_LINES when lines less than MAX_RENDERING_DIFF_LINES
'
,
(
done
)
=>
{
utils
.
convertExpandLines
.
mockImplementation
(()
=>
[
'
test
'
]);
testAction
(
...
...
@@ -1254,7 +1254,7 @@ describe('DiffsStoreActions', () => {
);
});
it
(
'
commits ADD_CURRENT_VIEW_DIFF_FILE_LINES when lines more than MAX_RENDERING_DIFF_LINES
'
,
done
=>
{
it
(
'
commits ADD_CURRENT_VIEW_DIFF_FILE_LINES when lines more than MAX_RENDERING_DIFF_LINES
'
,
(
done
)
=>
{
const
lines
=
new
Array
(
501
).
fill
().
map
((
_
,
i
)
=>
`line-
${
i
}
`
);
utils
.
convertExpandLines
.
mockReturnValue
(
lines
);
...
...
@@ -1281,7 +1281,7 @@ describe('DiffsStoreActions', () => {
});
describe
(
'
setSuggestPopoverDismissed
'
,
()
=>
{
it
(
'
commits SET_SHOW_SUGGEST_POPOVER
'
,
done
=>
{
it
(
'
commits SET_SHOW_SUGGEST_POPOVER
'
,
(
done
)
=>
{
const
state
=
{
dismissEndpoint
:
`
${
TEST_HOST
}
/-/user_callouts`
};
const
mock
=
new
MockAdapter
(
axios
);
mock
.
onPost
(
state
.
dismissEndpoint
).
reply
(
200
,
{});
...
...
@@ -1446,7 +1446,7 @@ describe('DiffsStoreActions', () => {
});
describe
(
'
navigateToDiffFileIndex
'
,
()
=>
{
it
(
'
commits VIEW_DIFF_FILE
'
,
done
=>
{
it
(
'
commits VIEW_DIFF_FILE
'
,
(
done
)
=>
{
testAction
(
navigateToDiffFileIndex
,
0
,
...
...
spec/frontend/diffs/store/getters_versions_dropdowns_spec.js
View file @
0fdc1fc0
...
...
@@ -49,7 +49,7 @@ describe('Compare diff version dropdowns', () => {
let
expectedHeadVersion
;
const
originalLocation
=
window
.
location
;
const
setupTest
=
includeDiffHeadParam
=>
{
const
setupTest
=
(
includeDiffHeadParam
)
=>
{
const
diffHeadParam
=
includeDiffHeadParam
?
'
?diff_head=true
'
:
''
;
Object
.
defineProperty
(
window
,
'
location
'
,
{
...
...
@@ -81,7 +81,7 @@ describe('Compare diff version dropdowns', () => {
};
};
const
assertVersions
=
targetVersions
=>
{
const
assertVersions
=
(
targetVersions
)
=>
{
// base and head should be the last two versions in that order
const
targetBaseVersion
=
targetVersions
[
targetVersions
.
length
-
2
];
const
targetHeadVersion
=
targetVersions
[
targetVersions
.
length
-
1
];
...
...
spec/frontend/diffs/store/utils_spec.js
View file @
0fdc1fc0
...
...
@@ -481,7 +481,7 @@ describe('DiffsStoreUtils', () => {
});
it
(
'
adds the `.brokenSymlink` property to each diff file
'
,
()
=>
{
preparedDiff
.
diff_files
.
forEach
(
file
=>
{
preparedDiff
.
diff_files
.
forEach
(
(
file
)
=>
{
expect
(
file
).
toEqual
(
expect
.
objectContaining
({
brokenSymlink
:
false
}));
});
});
...
...
@@ -492,9 +492,9 @@ describe('DiffsStoreUtils', () => {
...
splitInlineDiff
.
diff_files
,
...
splitParallelDiff
.
diff_files
,
...
completedDiff
.
diff_files
,
].
flatMap
(
file
=>
[...
file
[
INLINE_DIFF_LINES_KEY
]]);
].
flatMap
(
(
file
)
=>
[...
file
[
INLINE_DIFF_LINES_KEY
]]);
lines
.
forEach
(
line
=>
{
lines
.
forEach
(
(
line
)
=>
{
expect
(
line
.
commentsDisabled
).
toBe
(
false
);
});
});
...
...
@@ -560,7 +560,7 @@ describe('DiffsStoreUtils', () => {
});
it
(
'
adds the `.brokenSymlink` property to each meta diff file
'
,
()
=>
{
preparedDiffFiles
.
forEach
(
file
=>
{
preparedDiffFiles
.
forEach
(
(
file
)
=>
{
expect
(
file
).
toMatchObject
({
brokenSymlink
:
false
});
});
});
...
...
spec/frontend/diffs/utils/uuids_spec.js
View file @
0fdc1fc0
...
...
@@ -32,7 +32,7 @@ describe('UUIDs Util', () => {
const
ids
=
uuids
({
count
:
11
});
expect
(
ids
.
length
).
toEqual
(
11
);
expect
(
ids
.
every
(
id
=>
UUIDV4
.
test
(
id
))).
toEqual
(
true
);
expect
(
ids
.
every
(
(
id
)
=>
UUIDV4
.
test
(
id
))).
toEqual
(
true
);
});
it
.
each
`
...
...
spec/frontend/dirty_submit/dirty_submit_collection_spec.js
View file @
0fdc1fc0
import
DirtySubmitCollection
from
'
~/dirty_submit/dirty_submit_collection
'
;
import
{
setInputValue
,
createForm
}
from
'
./helper
'
;
jest
.
mock
(
'
lodash/throttle
'
,
()
=>
jest
.
fn
(
fn
=>
fn
));
jest
.
mock
(
'
lodash/throttle
'
,
()
=>
jest
.
fn
(
(
fn
)
=>
fn
));
describe
(
'
DirtySubmitCollection
'
,
()
=>
{
const
testElementsCollection
=
[
createForm
(),
createForm
()];
const
forms
=
testElementsCollection
.
map
(
testElements
=>
testElements
.
form
);
const
forms
=
testElementsCollection
.
map
(
(
testElements
)
=>
testElements
.
form
);
new
DirtySubmitCollection
(
forms
);
// eslint-disable-line no-new
it
.
each
(
testElementsCollection
)(
'
disables submits until there are changes
'
,
testElements
=>
{
it
.
each
(
testElementsCollection
)(
'
disables submits until there are changes
'
,
(
testElements
)
=>
{
const
{
input
,
submit
}
=
testElements
;
const
originalValue
=
input
.
value
;
...
...
spec/frontend/dirty_submit/dirty_submit_form_spec.js
View file @
0fdc1fc0
...
...
@@ -2,7 +2,7 @@ import { range as rge, throttle } from 'lodash';
import
DirtySubmitForm
from
'
~/dirty_submit/dirty_submit_form
'
;
import
{
getInputValue
,
setInputValue
,
createForm
}
from
'
./helper
'
;
jest
.
mock
(
'
lodash/throttle
'
,
()
=>
jest
.
fn
(
fn
=>
fn
));
jest
.
mock
(
'
lodash/throttle
'
,
()
=>
jest
.
fn
(
(
fn
)
=>
fn
));
const
lodash
=
jest
.
requireActual
(
'
lodash
'
);
function
expectToToggleDisableOnDirtyUpdate
(
submit
,
input
)
{
...
...
@@ -66,7 +66,7 @@ describe('DirtySubmitForm', () => {
const
{
form
,
input
}
=
createForm
();
const
updateDirtyInputSpy
=
jest
.
spyOn
(
new
DirtySubmitForm
(
form
),
'
updateDirtyInput
'
);
rge
(
10
).
forEach
(
i
=>
{
rge
(
10
).
forEach
(
(
i
)
=>
{
setInputValue
(
input
,
`change
${
i
}
`
,
false
);
});
...
...
@@ -78,13 +78,13 @@ describe('DirtySubmitForm', () => {
it
(
'
does not throttle updates when rapid changes are made to different form elements
'
,
()
=>
{
const
form
=
document
.
createElement
(
'
form
'
);
const
range
=
rge
(
10
);
range
.
forEach
(
i
=>
{
range
.
forEach
(
(
i
)
=>
{
form
.
innerHTML
+=
`<input type="text" name="input-
${
i
}
" class="js-input-
${
i
}
"/>`
;
});
const
updateDirtyInputSpy
=
jest
.
spyOn
(
new
DirtySubmitForm
(
form
),
'
updateDirtyInput
'
);
range
.
forEach
(
i
=>
{
range
.
forEach
(
(
i
)
=>
{
const
input
=
form
.
querySelector
(
`.js-input-
${
i
}
`
);
setInputValue
(
input
,
`change`
,
false
);
});
...
...
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