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
44fceac5
Commit
44fceac5
authored
Aug 12, 2020
by
Jay Swain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Feedback: use mutation_types
parent
9214463a
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
17 additions
and
9 deletions
+17
-9
app/assets/javascripts/whats_new/components/app.vue
app/assets/javascripts/whats_new/components/app.vue
+1
-1
app/assets/javascripts/whats_new/store/actions.js
app/assets/javascripts/whats_new/store/actions.js
+4
-2
app/assets/javascripts/whats_new/store/mutation_types.js
app/assets/javascripts/whats_new/store/mutation_types.js
+2
-0
app/assets/javascripts/whats_new/store/mutations.js
app/assets/javascripts/whats_new/store/mutations.js
+4
-2
spec/frontend/whats_new/store/actions_spec.js
spec/frontend/whats_new/store/actions_spec.js
+3
-2
spec/frontend/whats_new/store/mutations_spec.js
spec/frontend/whats_new/store/mutations_spec.js
+3
-2
No files found.
app/assets/javascripts/whats_new/components/app.vue
View file @
44fceac5
...
...
@@ -10,7 +10,7 @@ export default {
...
mapState
([
'
open
'
]),
},
methods
:
{
...
mapActions
([
'
closeDrawer
'
,
'
openDrawer
'
]),
...
mapActions
([
'
closeDrawer
'
]),
},
};
</
script
>
...
...
app/assets/javascripts/whats_new/store/actions.js
View file @
44fceac5
import
*
as
types
from
'
./mutation_types
'
;
export
default
{
closeDrawer
({
commit
})
{
commit
(
'
closeDrawer
'
);
commit
(
types
.
CLOSE_DRAWER
);
},
openDrawer
({
commit
})
{
commit
(
'
openDrawer
'
);
commit
(
types
.
OPEN_DRAWER
);
},
};
app/assets/javascripts/whats_new/store/mutation_types.js
0 → 100644
View file @
44fceac5
export
const
CLOSE_DRAWER
=
'
CLOSE_DRAWER
'
;
export
const
OPEN_DRAWER
=
'
OPEN_DRAWER
'
;
app/assets/javascripts/whats_new/store/mutations.js
View file @
44fceac5
import
*
as
types
from
'
./mutation_types
'
;
export
default
{
closeDrawer
(
state
)
{
[
types
.
CLOSE_DRAWER
]
(
state
)
{
state
.
open
=
false
;
},
openDrawer
(
state
)
{
[
types
.
OPEN_DRAWER
]
(
state
)
{
state
.
open
=
true
;
},
};
spec/frontend/whats_new/store/actions_spec.js
View file @
44fceac5
import
testAction
from
'
helpers/vuex_action_helper
'
;
import
actions
from
'
~/whats_new/store/actions
'
;
import
*
as
types
from
'
~/whats_new/store/mutation_types
'
;
describe
(
'
whats new actions
'
,
()
=>
{
describe
(
'
openDrawer
'
,
()
=>
{
it
(
'
should commit openDrawer
'
,
()
=>
{
testAction
(
actions
.
openDrawer
,
{},
{},
[{
type
:
'
openDrawer
'
}]);
testAction
(
actions
.
openDrawer
,
{},
{},
[{
type
:
types
.
OPEN_DRAWER
}]);
});
});
describe
(
'
closeDrawer
'
,
()
=>
{
it
(
'
should commit closeDrawer
'
,
()
=>
{
testAction
(
actions
.
closeDrawer
,
{},
{},
[{
type
:
'
closeDrawer
'
}]);
testAction
(
actions
.
closeDrawer
,
{},
{},
[{
type
:
types
.
CLOSE_DRAWER
}]);
});
});
});
spec/frontend/whats_new/store/mutations_spec.js
View file @
44fceac5
import
mutations
from
'
~/whats_new/store/mutations
'
;
import
createState
from
'
~/whats_new/store/state
'
;
import
*
as
types
from
'
~/whats_new/store/mutation_types
'
;
describe
(
'
whats new mutations
'
,
()
=>
{
let
state
;
...
...
@@ -10,14 +11,14 @@ describe('whats new mutations', () => {
describe
(
'
openDrawer
'
,
()
=>
{
it
(
'
sets open to true
'
,
()
=>
{
mutations
.
openDrawer
(
state
);
mutations
[
types
.
OPEN_DRAWER
]
(
state
);
expect
(
state
.
open
).
toBe
(
true
);
});
});
describe
(
'
closeDrawer
'
,
()
=>
{
it
(
'
sets open to false
'
,
()
=>
{
mutations
.
closeDrawer
(
state
);
mutations
[
types
.
CLOSE_DRAWER
]
(
state
);
expect
(
state
.
open
).
toBe
(
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