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
ed218e71
Commit
ed218e71
authored
Dec 03, 2020
by
Thomas Randolph
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unnecessary intermediate local state
parent
ba58e078
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
19 deletions
+8
-19
app/assets/javascripts/diffs/components/settings_dropdown.vue
...assets/javascripts/diffs/components/settings_dropdown.vue
+6
-17
spec/frontend/diffs/components/settings_dropdown_spec.js
spec/frontend/diffs/components/settings_dropdown_spec.js
+2
-2
No files found.
app/assets/javascripts/diffs/components/settings_dropdown.vue
View file @
ed218e71
...
...
@@ -14,26 +14,10 @@ export default {
GlDropdown
,
GlFormCheckbox
,
},
data
()
{
return
{
checked
:
false
,
};
},
computed
:
{
...
mapGetters
(
'
diffs
'
,
[
'
isInlineView
'
,
'
isParallelView
'
]),
...
mapState
(
'
diffs
'
,
[
'
renderTreeList
'
,
'
showWhitespace
'
,
'
viewDiffsFileByFile
'
]),
},
watch
:
{
viewDiffsFileByFile
()
{
this
.
checked
=
this
.
viewDiffsFileByFile
;
},
checked
()
{
eventHub
.
$emit
(
EVT_VIEW_FILE_BY_FILE
,
{
setting
:
this
.
checked
});
},
},
created
()
{
this
.
checked
=
this
.
viewDiffsFileByFile
;
},
methods
:
{
...
mapActions
(
'
diffs
'
,
[
'
setInlineDiffViewType
'
,
...
...
@@ -110,7 +94,12 @@ export default {
</label>
</div>
<div
class=
"gl-mt-3 gl-px-3"
>
<gl-form-checkbox
v-model=
"checked"
data-testid=
"file-by-file"
class=
"gl-mb-0"
>
<gl-form-checkbox
data-testid=
"file-by-file"
class=
"gl-mb-0"
:checked=
"viewDiffsFileByFile"
@
input=
"toggleFileByFile"
>
{{
$options
.
i18n
.
fileByFile
}}
</gl-form-checkbox>
</div>
...
...
spec/frontend/diffs/components/settings_dropdown_spec.js
View file @
ed218e71
...
...
@@ -181,7 +181,7 @@ describe('Diff settings dropdown component', () => {
${
true
}
|
${
true
}
${
false
}
|
${
false
}
`
(
'
sets { checked: $checked } if the fileByFile setting is $fileByFile
'
,
'
sets
the checkbox to
{ checked: $checked } if the fileByFile setting is $fileByFile
'
,
async
({
fileByFile
,
checked
})
=>
{
createComponent
(
store
=>
{
Object
.
assign
(
store
.
state
.
diffs
,
{
...
...
@@ -191,7 +191,7 @@ describe('Diff settings dropdown component', () => {
await
vm
.
$nextTick
();
expect
(
vm
.
checked
).
toBe
(
checked
);
expect
(
getFileByFileCheckbox
(
wrapper
).
element
.
checked
).
toBe
(
checked
);
},
);
...
...
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