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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
8186bb39
Commit
8186bb39
authored
Jul 09, 2018
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removes unused store in diffs mr refactor
Removes double export for actions in diffs module in mr refactor
parent
acdac151
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
56 additions
and
66 deletions
+56
-66
app/assets/javascripts/diffs/store/actions.js
app/assets/javascripts/diffs/store/actions.js
+2
-11
app/assets/javascripts/diffs/store/index.js
app/assets/javascripts/diffs/store/index.js
+0
-11
app/assets/javascripts/diffs/store/modules/index.js
app/assets/javascripts/diffs/store/modules/index.js
+1
-1
changelogs/unreleased/48951-clean-up.yml
changelogs/unreleased/48951-clean-up.yml
+5
-0
spec/javascripts/diffs/components/changed_files_spec.js
spec/javascripts/diffs/components/changed_files_spec.js
+48
-43
No files found.
app/assets/javascripts/diffs/store/actions.js
View file @
8186bb39
...
...
@@ -82,14 +82,5 @@ export const expandAllFiles = ({ commit }) => {
commit
(
types
.
EXPAND_ALL_FILES
);
};
export
default
{
setBaseConfig
,
fetchDiffFiles
,
setInlineDiffViewType
,
setParallelDiffViewType
,
showCommentForm
,
cancelCommentForm
,
loadMoreLines
,
loadCollapsedDiff
,
expandAllFiles
,
};
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export
default
()
=>
{};
app/assets/javascripts/diffs/store/index.js
deleted
100644 → 0
View file @
acdac151
import
Vue
from
'
vue
'
;
import
Vuex
from
'
vuex
'
;
import
diffsModule
from
'
./modules
'
;
Vue
.
use
(
Vuex
);
export
default
new
Vuex
.
Store
({
modules
:
{
diffs
:
diffsModule
,
},
});
app/assets/javascripts/diffs/store/modules/index.js
View file @
8186bb39
import
actions
from
'
../actions
'
;
import
*
as
actions
from
'
../actions
'
;
import
*
as
getters
from
'
../getters
'
;
import
mutations
from
'
../mutations
'
;
import
createState
from
'
./diff_state
'
;
...
...
changelogs/unreleased/48951-clean-up.yml
0 → 100644
View file @
8186bb39
---
title
:
Removes unused vuex code in mr refactor and removes unneeded dependencies
merge_request
:
20499
author
:
type
:
other
spec/javascripts/diffs/components/changed_files_spec.js
View file @
8186bb39
import
Vue
from
'
vue
'
;
import
$
from
'
jquery
'
;
import
Vuex
from
'
vuex
'
;
import
{
mountComponentWithStore
}
from
'
spec/helpers
'
;
import
store
from
'
~/diffs/store
'
;
import
C
hangedFiles
from
'
~/diffs/components/changed_files.vue
'
;
import
diffsModule
from
'
~/diffs/store/modules
'
;
import
c
hangedFiles
from
'
~/diffs/components/changed_files.vue
'
;
describe
(
'
ChangedFiles
'
,
()
=>
{
const
Component
=
Vue
.
extend
(
ChangedFiles
);
const
createComponent
=
props
=>
mountComponentWithStore
(
Component
,
{
props
,
store
});
const
Component
=
Vue
.
extend
(
changedFiles
);
const
store
=
new
Vuex
.
Store
({
modules
:
{
diffs
:
diffsModule
,
},
});
let
vm
;
beforeEach
(()
=>
{
...
...
@@ -14,6 +19,7 @@ describe('ChangedFiles', () => {
<div id="dummy-element"></div>
<div class="js-tabs-affix"></div>
`
);
const
props
=
{
diffFiles
:
[
{
...
...
@@ -26,7 +32,8 @@ describe('ChangedFiles', () => {
},
],
};
vm
=
createComponent
(
props
);
vm
=
mountComponentWithStore
(
Component
,
{
props
,
store
});
});
describe
(
'
with single file added
'
,
()
=>
{
...
...
@@ -40,58 +47,56 @@ describe('ChangedFiles', () => {
});
});
describe
(
'
template
'
,
()
=>
{
describe
(
'
diff view mode buttons
'
,
()
=>
{
let
inlineButton
;
let
parallelButton
;
describe
(
'
diff view mode buttons
'
,
()
=>
{
let
inlineButton
;
let
parallelButton
;
beforeEach
(()
=>
{
inlineButton
=
vm
.
$el
.
querySelector
(
'
.js-inline-diff-button
'
);
parallelButton
=
vm
.
$el
.
querySelector
(
'
.js-parallel-diff-button
'
);
});
beforeEach
(()
=>
{
inlineButton
=
vm
.
$el
.
querySelector
(
'
.js-inline-diff-button
'
);
parallelButton
=
vm
.
$el
.
querySelector
(
'
.js-parallel-diff-button
'
);
});
it
(
'
should have Inline and Side-by-side buttons
'
,
()
=>
{
expect
(
inlineButton
).
toBeDefined
();
expect
(
parallelButton
).
toBeDefined
();
});
it
(
'
should add active class to Inline button
'
,
done
=>
{
vm
.
$store
.
state
.
diffs
.
diffViewType
=
'
inline
'
;
vm
.
$nextTick
(()
=>
{
expect
(
inlineButton
.
classList
.
contains
(
'
active
'
)).
toEqual
(
true
);
expect
(
parallelButton
.
classList
.
contains
(
'
active
'
)).
toEqual
(
false
);
it
(
'
should have Inline and Side-by-side buttons
'
,
()
=>
{
expect
(
inlineButton
).
toBeDefined
();
expect
(
parallelButton
).
toBeDefined
();
done
();
});
});
it
(
'
should add active class to Inline button
'
,
done
=>
{
vm
.
$store
.
state
.
diffs
.
diffViewType
=
'
inline
'
;
it
(
'
should toggle active state of buttons when diff view type changed
'
,
done
=>
{
vm
.
$store
.
state
.
diffs
.
diffViewType
=
'
parallel
'
;
vm
.
$nextTick
(()
=>
{
expect
(
inlineButton
.
classList
.
contains
(
'
active
'
)).
toEqual
(
tru
e
);
expect
(
parallelButton
.
classList
.
contains
(
'
active
'
)).
toEqual
(
fals
e
);
vm
.
$nextTick
(()
=>
{
expect
(
inlineButton
.
classList
.
contains
(
'
active
'
)).
toEqual
(
fals
e
);
expect
(
parallelButton
.
classList
.
contains
(
'
active
'
)).
toEqual
(
tru
e
);
done
();
});
done
();
});
});
it
(
'
should toggle active state of buttons when diff view type changed
'
,
done
=>
{
vm
.
$store
.
state
.
diffs
.
diffViewType
=
'
parallel
'
;
describe
(
'
clicking them
'
,
()
=>
{
it
(
'
should toggle the diff view type
'
,
done
=>
{
parallelButton
.
click
();
vm
.
$nextTick
(()
=>
{
expect
(
inlineButton
.
classList
.
contains
(
'
active
'
)).
toEqual
(
false
);
expect
(
parallelButton
.
classList
.
contains
(
'
active
'
)).
toEqual
(
true
);
done
();
});
});
describe
(
'
clicking them
'
,
()
=>
{
it
(
'
should toggle the diff view type
'
,
done
=>
{
$
(
parallelButton
).
click
();
inlineButton
.
click
();
vm
.
$nextTick
(()
=>
{
expect
(
inlineButton
.
classList
.
contains
(
'
active
'
)).
toEqual
(
false
);
expect
(
parallelButton
.
classList
.
contains
(
'
active
'
)).
toEqual
(
true
);
$
(
inlineButton
).
click
();
vm
.
$nextTick
(()
=>
{
expect
(
inlineButton
.
classList
.
contains
(
'
active
'
)).
toEqual
(
true
);
expect
(
parallelButton
.
classList
.
contains
(
'
active
'
)).
toEqual
(
false
);
done
();
});
expect
(
inlineButton
.
classList
.
contains
(
'
active
'
)).
toEqual
(
true
);
expect
(
parallelButton
.
classList
.
contains
(
'
active
'
)).
toEqual
(
false
);
done
();
});
});
});
...
...
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