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
4d2180d0
Commit
4d2180d0
authored
Mar 16, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed store specs
parent
02e7ac9b
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
72 additions
and
116 deletions
+72
-116
ee/app/assets/javascripts/ide/stores/actions/file.js
ee/app/assets/javascripts/ide/stores/actions/file.js
+1
-3
ee/app/assets/javascripts/ide/stores/actions/tree.js
ee/app/assets/javascripts/ide/stores/actions/tree.js
+0
-4
spec/javascripts/ide/stores/actions/file_spec.js
spec/javascripts/ide/stores/actions/file_spec.js
+29
-64
spec/javascripts/ide/stores/actions/tree_spec.js
spec/javascripts/ide/stores/actions/tree_spec.js
+3
-20
spec/javascripts/ide/stores/modules/commit/actions_spec.js
spec/javascripts/ide/stores/modules/commit/actions_spec.js
+8
-0
spec/javascripts/ide/stores/mutations/file_spec.js
spec/javascripts/ide/stores/mutations/file_spec.js
+14
-18
spec/javascripts/ide/stores/mutations/tree_spec.js
spec/javascripts/ide/stores/mutations/tree_spec.js
+15
-7
spec/javascripts/ide/stores/mutations_spec.js
spec/javascripts/ide/stores/mutations_spec.js
+2
-0
No files found.
ee/app/assets/javascripts/ide/stores/actions/file.js
View file @
4d2180d0
...
...
@@ -23,8 +23,6 @@ export const closeFile = ({ commit, state, getters, dispatch }, path) => {
}
else
if
(
!
state
.
openFiles
.
length
)
{
router
.
push
(
`/project/
${
file
.
projectId
}
/tree/
${
file
.
branchId
}
/`
);
}
dispatch
(
'
getLastCommitData
'
);
};
export
const
setFileActive
=
({
commit
,
state
,
getters
,
dispatch
},
path
)
=>
{
...
...
@@ -47,7 +45,7 @@ export const setFileActive = ({ commit, state, getters, dispatch }, path) => {
export
const
getFileData
=
({
state
,
commit
,
dispatch
},
file
)
=>
{
commit
(
types
.
TOGGLE_LOADING
,
{
entry
:
file
});
service
.
getFileData
(
file
.
url
)
return
service
.
getFileData
(
file
.
url
)
.
then
((
res
)
=>
{
const
pageTitle
=
decodeURI
(
normalizeHeaders
(
res
.
headers
)[
'
PAGE-TITLE
'
]);
...
...
ee/app/assets/javascripts/ide/stores/actions/tree.js
View file @
4d2180d0
import
{
visitUrl
}
from
'
~/lib/utils/url_utility
'
;
import
{
normalizeHeaders
}
from
'
~/lib/utils/common_utils
'
;
import
flash
from
'
~/flash
'
;
import
service
from
'
../../services
'
;
...
...
@@ -15,9 +14,6 @@ export const toggleTreeOpen = ({ commit, dispatch }, path) => {
export
const
handleTreeEntryAction
=
({
commit
,
dispatch
},
row
)
=>
{
if
(
row
.
type
===
'
tree
'
)
{
dispatch
(
'
toggleTreeOpen
'
,
row
.
path
);
}
else
if
(
row
.
type
===
'
submodule
'
)
{
commit
(
types
.
TOGGLE_LOADING
,
{
entry
:
row
});
visitUrl
(
row
.
url
);
}
else
if
(
row
.
type
===
'
blob
'
&&
(
row
.
opened
||
row
.
changed
))
{
if
(
row
.
changed
&&
!
row
.
opened
)
{
commit
(
types
.
TOGGLE_FILE_OPEN
,
row
.
path
);
...
...
spec/javascripts/ide/stores/actions/file_spec.js
View file @
4d2180d0
...
...
@@ -15,28 +15,19 @@ describe('Multi-file store file actions', () => {
describe
(
'
closeFile
'
,
()
=>
{
let
localFile
;
let
getLastCommitDataSpy
;
let
oldGetLastCommitData
;
beforeEach
(()
=>
{
getLastCommitDataSpy
=
jasmine
.
createSpy
(
'
getLastCommitData
'
);
oldGetLastCommitData
=
store
.
_actions
.
getLastCommitData
;
// eslint-disable-line
store
.
_actions
.
getLastCommitData
=
[
getLastCommitDataSpy
];
// eslint-disable-line
localFile
=
file
(
'
testFile
'
);
localFile
.
active
=
true
;
localFile
.
opened
=
true
;
localFile
.
parentTreeUrl
=
'
parentTreeUrl
'
;
store
.
state
.
openFiles
.
push
(
localFile
);
});
afterEach
(()
=>
{
store
.
_actions
.
getLastCommitData
=
oldGetLastCommitData
;
// eslint-disable-line
store
.
state
.
entries
[
localFile
.
path
]
=
localFile
;
});
it
(
'
closes open files
'
,
(
done
)
=>
{
store
.
dispatch
(
'
closeFile
'
,
localFile
)
store
.
dispatch
(
'
closeFile
'
,
localFile
.
path
)
.
then
(()
=>
{
expect
(
localFile
.
opened
).
toBeFalsy
();
expect
(
localFile
.
active
).
toBeFalsy
();
...
...
@@ -49,7 +40,7 @@ describe('Multi-file store file actions', () => {
it
(
'
closes file even if file has changes
'
,
(
done
)
=>
{
store
.
state
.
changedFiles
.
push
(
localFile
);
store
.
dispatch
(
'
closeFile
'
,
localFile
)
store
.
dispatch
(
'
closeFile
'
,
localFile
.
path
)
.
then
(
Vue
.
nextTick
)
.
then
(()
=>
{
expect
(
store
.
state
.
openFiles
.
length
).
toBe
(
0
);
...
...
@@ -59,18 +50,10 @@ describe('Multi-file store file actions', () => {
})
.
catch
(
done
.
fail
);
});
it
(
'
calls getLastCommitData
'
,
(
done
)
=>
{
store
.
dispatch
(
'
closeFile
'
,
localFile
)
.
then
(()
=>
{
expect
(
getLastCommitDataSpy
).
toHaveBeenCalled
();
done
();
}).
catch
(
done
.
fail
);
});
});
describe
(
'
setFileActive
'
,
()
=>
{
let
localFile
;
let
scrollToTabSpy
;
let
oldScrollToTab
;
...
...
@@ -78,6 +61,10 @@ describe('Multi-file store file actions', () => {
scrollToTabSpy
=
jasmine
.
createSpy
(
'
scrollToTab
'
);
oldScrollToTab
=
store
.
_actions
.
scrollToTab
;
// eslint-disable-line
store
.
_actions
.
scrollToTab
=
[
scrollToTabSpy
];
// eslint-disable-line
localFile
=
file
(
'
setThisActive
'
);
store
.
state
.
entries
[
localFile
.
path
]
=
localFile
;
});
afterEach
(()
=>
{
...
...
@@ -85,7 +72,7 @@ describe('Multi-file store file actions', () => {
});
it
(
'
calls scrollToTab
'
,
(
done
)
=>
{
store
.
dispatch
(
'
setFileActive
'
,
file
(
'
setThisActive
'
)
)
store
.
dispatch
(
'
setFileActive
'
,
localFile
.
path
)
.
then
(()
=>
{
expect
(
scrollToTabSpy
).
toHaveBeenCalled
();
...
...
@@ -94,9 +81,7 @@ describe('Multi-file store file actions', () => {
});
it
(
'
sets the file active
'
,
(
done
)
=>
{
const
localFile
=
file
(
'
activeFile
'
);
store
.
dispatch
(
'
setFileActive
'
,
localFile
)
store
.
dispatch
(
'
setFileActive
'
,
localFile
.
path
)
.
then
(()
=>
{
expect
(
localFile
.
active
).
toBeTruthy
();
...
...
@@ -105,10 +90,9 @@ describe('Multi-file store file actions', () => {
});
it
(
'
returns early if file is already active
'
,
(
done
)
=>
{
const
localFile
=
file
(
'
earlyActive
'
);
localFile
.
active
=
true
;
store
.
dispatch
(
'
setFileActive
'
,
localFile
)
store
.
dispatch
(
'
setFileActive
'
,
localFile
.
path
)
.
then
(()
=>
{
expect
(
scrollToTabSpy
).
not
.
toHaveBeenCalled
();
...
...
@@ -117,11 +101,12 @@ describe('Multi-file store file actions', () => {
});
it
(
'
sets current active file to not active
'
,
(
done
)
=>
{
const
localFile
=
file
(
'
currentActive
'
);
const
f
=
file
(
'
newActive
'
);
store
.
state
.
entries
[
f
.
path
]
=
f
;
localFile
.
active
=
true
;
store
.
state
.
openFiles
.
push
(
localFile
);
store
.
dispatch
(
'
setFileActive
'
,
f
ile
(
'
newActive
'
)
)
store
.
dispatch
(
'
setFileActive
'
,
f
.
path
)
.
then
(()
=>
{
expect
(
localFile
.
active
).
toBeFalsy
();
...
...
@@ -132,7 +117,7 @@ describe('Multi-file store file actions', () => {
it
(
'
resets location.hash for line highlighting
'
,
(
done
)
=>
{
location
.
hash
=
'
test
'
;
store
.
dispatch
(
'
setFileActive
'
,
file
(
'
otherActive
'
)
)
store
.
dispatch
(
'
setFileActive
'
,
localFile
.
path
)
.
then
(()
=>
{
expect
(
location
.
hash
).
not
.
toBe
(
'
test
'
);
...
...
@@ -162,13 +147,7 @@ describe('Multi-file store file actions', () => {
localFile
=
file
(
`newCreate-
${
Math
.
random
()}
`
);
localFile
.
url
=
'
getFileDataURL
'
;
});
afterEach
(()
=>
{
store
.
dispatch
(
'
closeFile
'
,
{
file
:
localFile
,
force
:
true
,
});
store
.
state
.
entries
[
localFile
.
path
]
=
localFile
;
});
it
(
'
calls the service
'
,
(
done
)
=>
{
...
...
@@ -182,7 +161,6 @@ describe('Multi-file store file actions', () => {
it
(
'
sets the file data
'
,
(
done
)
=>
{
store
.
dispatch
(
'
getFileData
'
,
localFile
)
.
then
(
Vue
.
nextTick
)
.
then
(()
=>
{
expect
(
localFile
.
blamePath
).
toBe
(
'
blame_path
'
);
...
...
@@ -201,7 +179,6 @@ describe('Multi-file store file actions', () => {
it
(
'
sets the file as active
'
,
(
done
)
=>
{
store
.
dispatch
(
'
getFileData
'
,
localFile
)
.
then
(
Vue
.
nextTick
)
.
then
(()
=>
{
expect
(
localFile
.
active
).
toBeTruthy
();
...
...
@@ -211,7 +188,6 @@ describe('Multi-file store file actions', () => {
it
(
'
adds the file to open files
'
,
(
done
)
=>
{
store
.
dispatch
(
'
getFileData
'
,
localFile
)
.
then
(
Vue
.
nextTick
)
.
then
(()
=>
{
expect
(
store
.
state
.
openFiles
.
length
).
toBe
(
1
);
expect
(
store
.
state
.
openFiles
[
0
].
name
).
toBe
(
localFile
.
name
);
...
...
@@ -219,20 +195,6 @@ describe('Multi-file store file actions', () => {
done
();
}).
catch
(
done
.
fail
);
});
it
(
'
toggles the file loading
'
,
(
done
)
=>
{
store
.
dispatch
(
'
getFileData
'
,
localFile
)
.
then
(()
=>
{
expect
(
localFile
.
loading
).
toBeTruthy
();
return
Vue
.
nextTick
();
})
.
then
(()
=>
{
expect
(
localFile
.
loading
).
toBeFalsy
();
done
();
}).
catch
(
done
.
fail
);
});
});
describe
(
'
getRawFileData
'
,
()
=>
{
...
...
@@ -242,6 +204,7 @@ describe('Multi-file store file actions', () => {
spyOn
(
service
,
'
getRawFileData
'
).
and
.
returnValue
(
Promise
.
resolve
(
'
raw
'
));
tmpFile
=
file
(
'
tmpFile
'
);
store
.
state
.
entries
[
tmpFile
.
path
]
=
tmpFile
;
});
it
(
'
calls getRawFileData service method
'
,
(
done
)
=>
{
...
...
@@ -268,11 +231,12 @@ describe('Multi-file store file actions', () => {
beforeEach
(()
=>
{
tmpFile
=
file
(
'
tmpFile
'
);
store
.
state
.
entries
[
tmpFile
.
path
]
=
tmpFile
;
});
it
(
'
updates file content
'
,
(
done
)
=>
{
store
.
dispatch
(
'
changeFileContent
'
,
{
file
:
tmpFile
,
path
:
tmpFile
.
path
,
content
:
'
content
'
,
})
.
then
(()
=>
{
...
...
@@ -284,7 +248,7 @@ describe('Multi-file store file actions', () => {
it
(
'
adds file into changedFiles array
'
,
(
done
)
=>
{
store
.
dispatch
(
'
changeFileContent
'
,
{
file
:
tmpFile
,
path
:
tmpFile
.
path
,
content
:
'
content
'
,
})
.
then
(()
=>
{
...
...
@@ -296,11 +260,11 @@ describe('Multi-file store file actions', () => {
it
(
'
adds file once into changedFiles array
'
,
(
done
)
=>
{
store
.
dispatch
(
'
changeFileContent
'
,
{
file
:
tmpFile
,
path
:
tmpFile
.
path
,
content
:
'
content
'
,
})
.
then
(()
=>
store
.
dispatch
(
'
changeFileContent
'
,
{
file
:
tmpFile
,
path
:
tmpFile
.
path
,
content
:
'
content 123
'
,
}))
.
then
(()
=>
{
...
...
@@ -312,11 +276,11 @@ describe('Multi-file store file actions', () => {
it
(
'
removes file from changedFiles array if not changed
'
,
(
done
)
=>
{
store
.
dispatch
(
'
changeFileContent
'
,
{
file
:
tmpFile
,
path
:
tmpFile
.
path
,
content
:
'
content
'
,
})
.
then
(()
=>
store
.
dispatch
(
'
changeFileContent
'
,
{
file
:
tmpFile
,
path
:
tmpFile
.
path
,
content
:
''
,
}))
.
then
(()
=>
{
...
...
@@ -335,10 +299,11 @@ describe('Multi-file store file actions', () => {
tmpFile
.
content
=
'
testing
'
;
store
.
state
.
changedFiles
.
push
(
tmpFile
);
store
.
state
.
entries
[
tmpFile
.
path
]
=
tmpFile
;
});
it
(
'
resets file content
'
,
(
done
)
=>
{
store
.
dispatch
(
'
discardFileChanges
'
,
tmpFile
)
store
.
dispatch
(
'
discardFileChanges
'
,
tmpFile
.
path
)
.
then
(()
=>
{
expect
(
tmpFile
.
content
).
not
.
toBe
(
'
testing
'
);
...
...
@@ -348,7 +313,7 @@ describe('Multi-file store file actions', () => {
});
it
(
'
removes file from changedFiles array
'
,
(
done
)
=>
{
store
.
dispatch
(
'
discardFileChanges
'
,
tmpFile
)
store
.
dispatch
(
'
discardFileChanges
'
,
tmpFile
.
path
)
.
then
(()
=>
{
expect
(
store
.
state
.
changedFiles
.
length
).
toBe
(
0
);
...
...
@@ -361,7 +326,7 @@ describe('Multi-file store file actions', () => {
tmpFile
.
tempFile
=
true
;
tmpFile
.
opened
=
true
;
store
.
dispatch
(
'
discardFileChanges
'
,
tmpFile
)
store
.
dispatch
(
'
discardFileChanges
'
,
tmpFile
.
path
)
.
then
(()
=>
{
expect
(
tmpFile
.
opened
).
toBeFalsy
();
...
...
@@ -375,7 +340,7 @@ describe('Multi-file store file actions', () => {
expect
(
tmpFile
.
opened
).
toBeFalsy
();
store
.
dispatch
(
'
discardFileChanges
'
,
tmpFile
)
store
.
dispatch
(
'
discardFileChanges
'
,
tmpFile
.
path
)
.
then
(()
=>
{
expect
(
tmpFile
.
opened
).
toBeFalsy
();
...
...
spec/javascripts/ide/stores/actions/tree_spec.js
View file @
4d2180d0
...
...
@@ -70,32 +70,15 @@ describe('Multi-file store tree actions', () => {
});
describe
(
'
toggleTreeOpen
'
,
()
=>
{
let
oldGetTreeData
;
let
getTreeDataSpy
;
let
tree
;
beforeEach
(()
=>
{
getTreeDataSpy
=
jasmine
.
createSpy
(
'
getTreeData
'
);
oldGetTreeData
=
store
.
_actions
.
getTreeData
;
// eslint-disable-line
store
.
_actions
.
getTreeData
=
[
getTreeDataSpy
];
// eslint-disable-line
tree
=
{
projectId
:
'
abcproject
'
,
branchId
:
'
master
'
,
opened
:
false
,
tree
:
[],
};
});
afterEach
(()
=>
{
store
.
_actions
.
getTreeData
=
oldGetTreeData
;
// eslint-disable-line
tree
=
file
(
'
testing
'
,
'
1
'
,
'
tree
'
);
store
.
state
.
entries
[
tree
.
path
]
=
tree
;
});
it
(
'
toggles the tree open
'
,
(
done
)
=>
{
store
.
dispatch
(
'
toggleTreeOpen
'
,
{
tree
,
}).
then
(()
=>
{
store
.
dispatch
(
'
toggleTreeOpen
'
,
tree
.
path
).
then
(()
=>
{
expect
(
tree
.
opened
).
toBeTruthy
();
done
();
...
...
spec/javascripts/ide/stores/modules/commit/actions_spec.js
View file @
4d2180d0
...
...
@@ -197,6 +197,10 @@ describe('IDE commit module actions', () => {
changed
:
true
,
});
store
.
state
.
openFiles
=
store
.
state
.
changedFiles
;
store
.
state
.
changedFiles
.
forEach
((
changedFile
)
=>
{
store
.
state
.
entries
[
changedFile
.
path
]
=
changedFile
;
});
});
it
(
'
updates stores working reference
'
,
(
done
)
=>
{
...
...
@@ -326,6 +330,10 @@ describe('IDE commit module actions', () => {
store
.
state
.
changedFiles
[
0
].
active
=
true
;
store
.
state
.
openFiles
=
store
.
state
.
changedFiles
;
store
.
state
.
openFiles
.
forEach
((
f
)
=>
{
store
.
state
.
entries
[
f
.
path
]
=
f
;
});
store
.
state
.
commit
.
commitAction
=
'
2
'
;
store
.
state
.
commit
.
commitMessage
=
'
testing 123
'
;
});
...
...
spec/javascripts/ide/stores/mutations/file_spec.js
View file @
4d2180d0
...
...
@@ -9,12 +9,14 @@ describe('Multi-file store file mutations', () => {
beforeEach
(()
=>
{
localState
=
state
();
localFile
=
file
();
localState
.
entries
[
localFile
.
path
]
=
localFile
;
});
describe
(
'
SET_FILE_ACTIVE
'
,
()
=>
{
it
(
'
sets the file active
'
,
()
=>
{
mutations
.
SET_FILE_ACTIVE
(
localState
,
{
file
:
localFile
,
path
:
localFile
.
path
,
active
:
true
,
});
...
...
@@ -24,7 +26,7 @@ describe('Multi-file store file mutations', () => {
describe
(
'
TOGGLE_FILE_OPEN
'
,
()
=>
{
beforeEach
(()
=>
{
mutations
.
TOGGLE_FILE_OPEN
(
localState
,
localFile
);
mutations
.
TOGGLE_FILE_OPEN
(
localState
,
localFile
.
path
);
});
it
(
'
adds into opened files
'
,
()
=>
{
...
...
@@ -33,7 +35,7 @@ describe('Multi-file store file mutations', () => {
});
it
(
'
removes from opened files
'
,
()
=>
{
mutations
.
TOGGLE_FILE_OPEN
(
localState
,
localFile
);
mutations
.
TOGGLE_FILE_OPEN
(
localState
,
localFile
.
path
);
expect
(
localFile
.
opened
).
toBeFalsy
();
expect
(
localState
.
openFiles
.
length
).
toBe
(
0
);
...
...
@@ -81,7 +83,7 @@ describe('Multi-file store file mutations', () => {
it
(
'
sets content
'
,
()
=>
{
mutations
.
UPDATE_FILE_CONTENT
(
localState
,
{
file
:
localFile
,
path
:
localFile
.
path
,
content
:
'
test
'
,
});
...
...
@@ -90,7 +92,7 @@ describe('Multi-file store file mutations', () => {
it
(
'
sets changed if content does not match raw
'
,
()
=>
{
mutations
.
UPDATE_FILE_CONTENT
(
localState
,
{
file
:
localFile
,
path
:
localFile
.
path
,
content
:
'
testing
'
,
});
...
...
@@ -102,7 +104,7 @@ describe('Multi-file store file mutations', () => {
localFile
.
tempFile
=
true
;
mutations
.
UPDATE_FILE_CONTENT
(
localState
,
{
file
:
localFile
,
path
:
localFile
.
path
,
content
:
''
,
});
...
...
@@ -117,7 +119,7 @@ describe('Multi-file store file mutations', () => {
});
it
(
'
resets content and changed
'
,
()
=>
{
mutations
.
DISCARD_FILE_CHANGES
(
localState
,
localFile
);
mutations
.
DISCARD_FILE_CHANGES
(
localState
,
localFile
.
path
);
expect
(
localFile
.
content
).
toBe
(
''
);
expect
(
localFile
.
changed
).
toBeFalsy
();
...
...
@@ -126,9 +128,7 @@ describe('Multi-file store file mutations', () => {
describe
(
'
ADD_FILE_TO_CHANGED
'
,
()
=>
{
it
(
'
adds file into changed files array
'
,
()
=>
{
const
f
=
file
();
mutations
.
ADD_FILE_TO_CHANGED
(
localState
,
f
);
mutations
.
ADD_FILE_TO_CHANGED
(
localState
,
localFile
.
path
);
expect
(
localState
.
changedFiles
.
length
).
toBe
(
1
);
});
...
...
@@ -136,11 +136,9 @@ describe('Multi-file store file mutations', () => {
describe
(
'
REMOVE_FILE_FROM_CHANGED
'
,
()
=>
{
it
(
'
removes files from changed files array
'
,
()
=>
{
const
f
=
file
();
localState
.
changedFiles
.
push
(
f
);
localState
.
changedFiles
.
push
(
localFile
);
mutations
.
REMOVE_FILE_FROM_CHANGED
(
localState
,
f
);
mutations
.
REMOVE_FILE_FROM_CHANGED
(
localState
,
localFile
.
path
);
expect
(
localState
.
changedFiles
.
length
).
toBe
(
0
);
});
...
...
@@ -148,14 +146,12 @@ describe('Multi-file store file mutations', () => {
describe
(
'
TOGGLE_FILE_CHANGED
'
,
()
=>
{
it
(
'
updates file changed status
'
,
()
=>
{
const
f
=
file
();
mutations
.
TOGGLE_FILE_CHANGED
(
localState
,
{
file
:
f
,
file
:
localFile
,
changed
:
true
,
});
expect
(
f
.
changed
).
toBeTruthy
();
expect
(
localFile
.
changed
).
toBeTruthy
();
});
});
});
spec/javascripts/ide/stores/mutations/tree_spec.js
View file @
4d2180d0
...
...
@@ -9,15 +9,17 @@ describe('Multi-file store tree mutations', () => {
beforeEach
(()
=>
{
localState
=
state
();
localTree
=
file
();
localState
.
entries
[
localTree
.
path
]
=
localTree
;
});
describe
(
'
TOGGLE_TREE_OPEN
'
,
()
=>
{
it
(
'
toggles tree open
'
,
()
=>
{
mutations
.
TOGGLE_TREE_OPEN
(
localState
,
localTree
);
mutations
.
TOGGLE_TREE_OPEN
(
localState
,
localTree
.
path
);
expect
(
localTree
.
opened
).
toBeTruthy
();
mutations
.
TOGGLE_TREE_OPEN
(
localState
,
localTree
);
mutations
.
TOGGLE_TREE_OPEN
(
localState
,
localTree
.
path
);
expect
(
localTree
.
opened
).
toBeFalsy
();
});
...
...
@@ -35,15 +37,21 @@ describe('Multi-file store tree mutations', () => {
}];
it
(
'
adds directory data
'
,
()
=>
{
localState
.
trees
[
'
project/master
'
]
=
{
tree
:
[],
};
mutations
.
SET_DIRECTORY_DATA
(
localState
,
{
data
,
tree
:
localState
,
tree
Path
:
'
project/master
'
,
});
expect
(
localState
.
tree
.
length
).
toBe
(
3
);
expect
(
localState
.
tree
[
0
].
name
).
toBe
(
'
tree
'
);
expect
(
localState
.
tree
[
1
].
name
).
toBe
(
'
submodule
'
);
expect
(
localState
.
tree
[
2
].
name
).
toBe
(
'
blob
'
);
const
tree
=
localState
.
trees
[
'
project/master
'
];
expect
(
tree
.
tree
.
length
).
toBe
(
3
);
expect
(
tree
.
tree
[
0
].
name
).
toBe
(
'
tree
'
);
expect
(
tree
.
tree
[
1
].
name
).
toBe
(
'
submodule
'
);
expect
(
tree
.
tree
[
2
].
name
).
toBe
(
'
blob
'
);
});
});
...
...
spec/javascripts/ide/stores/mutations_spec.js
View file @
4d2180d0
...
...
@@ -9,6 +9,8 @@ describe('Multi-file store mutations', () => {
beforeEach
(()
=>
{
localState
=
state
();
entry
=
file
();
localState
.
entries
[
entry
.
path
]
=
entry
;
});
describe
(
'
SET_INITIAL_DATA
'
,
()
=>
{
...
...
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