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
7feef84e
Commit
7feef84e
authored
May 18, 2018
by
Winnie Hellmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make stores export a createStore() which can be used in tests
parent
769c4a61
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
doc/development/fe_guide/vuex.md
doc/development/fe_guide/vuex.md
+6
-2
No files found.
doc/development/fe_guide/vuex.md
View file @
7feef84e
...
...
@@ -37,12 +37,13 @@ import state from './state';
Vue
.
use
(
Vuex
);
export
default
new
Vuex
.
Store
({
export
const
createStore
=
()
=>
new
Vuex
.
Store
({
actions
,
getters
,
mutations
,
state
,
});
export
default
createStore
();
```
### `state.js`
...
...
@@ -320,10 +321,11 @@ In order to write unit tests for those components, we need to include the store
```
javascript
//component_spec.js
import
Vue
from
'
vue
'
;
import
store
from
'
./store
'
;
import
{
createStore
}
from
'
./store
'
;
import
component
from
'
./component.vue
'
describe
(
'
component
'
,
()
=>
{
let
store
;
let
vm
;
let
Component
;
...
...
@@ -340,6 +342,8 @@ describe('component', () => {
name
:
'
Foo
'
,
age
:
'
30
'
,
};
store
=
createStore
();
// populate the store
store
.
dispatch
(
'
addUser
'
,
user
);
...
...
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