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
af22ddaf
Commit
af22ddaf
authored
Mar 20, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated file references in specs
parent
f527e6e1
Changes
44
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
44 changed files
with
632 additions
and
431 deletions
+632
-431
app/assets/javascripts/ide/stores/modules/commit/actions.js
app/assets/javascripts/ide/stores/modules/commit/actions.js
+3
-3
spec/javascripts/ide/components/changed_file_icon_spec.js
spec/javascripts/ide/components/changed_file_icon_spec.js
+1
-1
spec/javascripts/ide/components/commit_sidebar/actions_spec.js
...javascripts/ide/components/commit_sidebar/actions_spec.js
+3
-3
spec/javascripts/ide/components/commit_sidebar/list_collapsed_spec.js
...ipts/ide/components/commit_sidebar/list_collapsed_spec.js
+2
-2
spec/javascripts/ide/components/commit_sidebar/list_item_spec.js
...vascripts/ide/components/commit_sidebar/list_item_spec.js
+5
-3
spec/javascripts/ide/components/commit_sidebar/list_spec.js
spec/javascripts/ide/components/commit_sidebar/list_spec.js
+4
-4
spec/javascripts/ide/components/commit_sidebar/radio_group_spec.js
...scripts/ide/components/commit_sidebar/radio_group_spec.js
+9
-9
spec/javascripts/ide/components/ide_context_bar_spec.js
spec/javascripts/ide/components/ide_context_bar_spec.js
+3
-3
spec/javascripts/ide/components/ide_external_links_spec.js
spec/javascripts/ide/components/ide_external_links_spec.js
+1
-1
spec/javascripts/ide/components/ide_repo_tree_spec.js
spec/javascripts/ide/components/ide_repo_tree_spec.js
+5
-3
spec/javascripts/ide/components/ide_side_bar_spec.js
spec/javascripts/ide/components/ide_side_bar_spec.js
+12
-6
spec/javascripts/ide/components/ide_spec.js
spec/javascripts/ide/components/ide_spec.js
+3
-3
spec/javascripts/ide/components/new_dropdown/index_spec.js
spec/javascripts/ide/components/new_dropdown/index_spec.js
+2
-2
spec/javascripts/ide/components/new_dropdown/modal_spec.js
spec/javascripts/ide/components/new_dropdown/modal_spec.js
+20
-10
spec/javascripts/ide/components/new_dropdown/upload_spec.js
spec/javascripts/ide/components/new_dropdown/upload_spec.js
+1
-1
spec/javascripts/ide/components/repo_commit_section_spec.js
spec/javascripts/ide/components/repo_commit_section_spec.js
+49
-30
spec/javascripts/ide/components/repo_editor_spec.js
spec/javascripts/ide/components/repo_editor_spec.js
+10
-10
spec/javascripts/ide/components/repo_file_buttons_spec.js
spec/javascripts/ide/components/repo_file_buttons_spec.js
+5
-3
spec/javascripts/ide/components/repo_file_spec.js
spec/javascripts/ide/components/repo_file_spec.js
+3
-3
spec/javascripts/ide/components/repo_loading_file_spec.js
spec/javascripts/ide/components/repo_loading_file_spec.js
+4
-4
spec/javascripts/ide/components/repo_tab_spec.js
spec/javascripts/ide/components/repo_tab_spec.js
+9
-7
spec/javascripts/ide/components/repo_tabs_spec.js
spec/javascripts/ide/components/repo_tabs_spec.js
+1
-1
spec/javascripts/ide/helpers.js
spec/javascripts/ide/helpers.js
+14
-13
spec/javascripts/ide/lib/common/disposable_spec.js
spec/javascripts/ide/lib/common/disposable_spec.js
+1
-1
spec/javascripts/ide/lib/common/model_manager_spec.js
spec/javascripts/ide/lib/common/model_manager_spec.js
+12
-6
spec/javascripts/ide/lib/common/model_spec.js
spec/javascripts/ide/lib/common/model_spec.js
+13
-7
spec/javascripts/ide/lib/decorations/controller_spec.js
spec/javascripts/ide/lib/decorations/controller_spec.js
+33
-14
spec/javascripts/ide/lib/diff/controller_spec.js
spec/javascripts/ide/lib/diff/controller_spec.js
+49
-29
spec/javascripts/ide/lib/diff/diff_spec.js
spec/javascripts/ide/lib/diff/diff_spec.js
+1
-1
spec/javascripts/ide/lib/editor_options_spec.js
spec/javascripts/ide/lib/editor_options_spec.js
+1
-1
spec/javascripts/ide/lib/editor_spec.js
spec/javascripts/ide/lib/editor_spec.js
+2
-2
spec/javascripts/ide/monaco_loader_spec.js
spec/javascripts/ide/monaco_loader_spec.js
+8
-6
spec/javascripts/ide/stores/actions/file_spec.js
spec/javascripts/ide/stores/actions/file_spec.js
+4
-4
spec/javascripts/ide/stores/actions/tree_spec.js
spec/javascripts/ide/stores/actions/tree_spec.js
+76
-49
spec/javascripts/ide/stores/actions_spec.js
spec/javascripts/ide/stores/actions_spec.js
+2
-2
spec/javascripts/ide/stores/getters_spec.js
spec/javascripts/ide/stores/getters_spec.js
+2
-2
spec/javascripts/ide/stores/modules/commit/actions_spec.js
spec/javascripts/ide/stores/modules/commit/actions_spec.js
+194
-139
spec/javascripts/ide/stores/modules/commit/getters_spec.js
spec/javascripts/ide/stores/modules/commit/getters_spec.js
+25
-11
spec/javascripts/ide/stores/modules/commit/mutations_spec.js
spec/javascripts/ide/stores/modules/commit/mutations_spec.js
+2
-2
spec/javascripts/ide/stores/mutations/branch_spec.js
spec/javascripts/ide/stores/mutations/branch_spec.js
+2
-2
spec/javascripts/ide/stores/mutations/file_spec.js
spec/javascripts/ide/stores/mutations/file_spec.js
+2
-2
spec/javascripts/ide/stores/mutations/tree_spec.js
spec/javascripts/ide/stores/mutations/tree_spec.js
+13
-11
spec/javascripts/ide/stores/mutations_spec.js
spec/javascripts/ide/stores/mutations_spec.js
+2
-2
spec/javascripts/ide/stores/utils_spec.js
spec/javascripts/ide/stores/utils_spec.js
+19
-13
No files found.
app/assets/javascripts/ide/stores/modules/commit/actions.js
View file @
af22ddaf
...
...
@@ -30,9 +30,9 @@ export const setLastCommitMessage = ({ rootState, commit }, data) => {
const
currentProject
=
rootState
.
projects
[
rootState
.
currentProjectId
];
const
commitStats
=
data
.
stats
?
sprintf
(
__
(
'
with %{additions} additions, %{deletions} deletions.
'
),
{
additions
:
data
.
stats
.
additions
,
deletions
:
data
.
stats
.
deletions
,
})
additions
:
data
.
stats
.
additions
,
// eslint-disable-line indent
deletions
:
data
.
stats
.
deletions
,
// eslint-disable-line indent
})
// eslint-disable-line indent
:
''
;
const
commitMsg
=
sprintf
(
__
(
'
Your changes have been committed. Commit %{commitId} %{commitStats}
'
),
...
...
spec/javascripts/ide/components/changed_file_icon_spec.js
View file @
af22ddaf
import
Vue
from
'
vue
'
;
import
changedFileIcon
from
'
ee
/ide/components/changed_file_icon.vue
'
;
import
changedFileIcon
from
'
~
/ide/components/changed_file_icon.vue
'
;
import
createComponent
from
'
spec/helpers/vue_mount_component_helper
'
;
describe
(
'
IDE changed file icon
'
,
()
=>
{
...
...
spec/javascripts/ide/components/commit_sidebar/actions_spec.js
View file @
af22ddaf
import
Vue
from
'
vue
'
;
import
store
from
'
ee
/ide/stores
'
;
import
commitActions
from
'
ee
/ide/components/commit_sidebar/actions.vue
'
;
import
store
from
'
~
/ide/stores
'
;
import
commitActions
from
'
~
/ide/components/commit_sidebar/actions.vue
'
;
import
{
createComponentWithStore
}
from
'
spec/helpers/vue_mount_component_helper
'
;
import
{
resetStore
}
from
'
spec/ide/helpers
'
;
describe
(
'
IDE commit sidebar actions
'
,
()
=>
{
let
vm
;
beforeEach
(
(
done
)
=>
{
beforeEach
(
done
=>
{
const
Component
=
Vue
.
extend
(
commitActions
);
vm
=
createComponentWithStore
(
Component
,
store
);
...
...
spec/javascripts/ide/components/commit_sidebar/list_collapsed_spec.js
View file @
af22ddaf
import
Vue
from
'
vue
'
;
import
store
from
'
ee
/ide/stores
'
;
import
listCollapsed
from
'
ee
/ide/components/commit_sidebar/list_collapsed.vue
'
;
import
store
from
'
~
/ide/stores
'
;
import
listCollapsed
from
'
~
/ide/components/commit_sidebar/list_collapsed.vue
'
;
import
{
createComponentWithStore
}
from
'
spec/helpers/vue_mount_component_helper
'
;
import
{
file
}
from
'
../../helpers
'
;
...
...
spec/javascripts/ide/components/commit_sidebar/list_item_spec.js
View file @
af22ddaf
import
Vue
from
'
vue
'
;
import
listItem
from
'
ee
/ide/components/commit_sidebar/list_item.vue
'
;
import
router
from
'
ee
/ide/ide_router
'
;
import
listItem
from
'
~
/ide/components/commit_sidebar/list_item.vue
'
;
import
router
from
'
~
/ide/ide_router
'
;
import
mountComponent
from
'
spec/helpers/vue_mount_component_helper
'
;
import
{
file
}
from
'
../../helpers
'
;
...
...
@@ -23,7 +23,9 @@ describe('Multi-file editor commit sidebar list item', () => {
});
it
(
'
renders file path
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.multi-file-commit-list-path
'
).
textContent
.
trim
()).
toBe
(
f
.
path
);
expect
(
vm
.
$el
.
querySelector
(
'
.multi-file-commit-list-path
'
).
textContent
.
trim
(),
).
toBe
(
f
.
path
);
});
it
(
'
calls discardFileChanges when clicking discard button
'
,
()
=>
{
...
...
spec/javascripts/ide/components/commit_sidebar/list_spec.js
View file @
af22ddaf
import
Vue
from
'
vue
'
;
import
store
from
'
ee
/ide/stores
'
;
import
commitSidebarList
from
'
ee
/ide/components/commit_sidebar/list.vue
'
;
import
store
from
'
~
/ide/stores
'
;
import
commitSidebarList
from
'
~
/ide/components/commit_sidebar/list.vue
'
;
import
{
createComponentWithStore
}
from
'
spec/helpers/vue_mount_component_helper
'
;
import
{
file
}
from
'
../../helpers
'
;
...
...
@@ -25,7 +25,7 @@ describe('Multi-file editor commit sidebar list', () => {
});
describe
(
'
with a list of files
'
,
()
=>
{
beforeEach
(
(
done
)
=>
{
beforeEach
(
done
=>
{
const
f
=
file
(
'
file name
'
);
f
.
changed
=
true
;
vm
.
fileList
.
push
(
f
);
...
...
@@ -39,7 +39,7 @@ describe('Multi-file editor commit sidebar list', () => {
});
describe
(
'
collapsed
'
,
()
=>
{
beforeEach
(
(
done
)
=>
{
beforeEach
(
done
=>
{
vm
.
$store
.
state
.
rightPanelCollapsed
=
true
;
Vue
.
nextTick
(
done
);
...
...
spec/javascripts/ide/components/commit_sidebar/radio_group_spec.js
View file @
af22ddaf
import
Vue
from
'
vue
'
;
import
store
from
'
ee
/ide/stores
'
;
import
radioGroup
from
'
ee
/ide/components/commit_sidebar/radio_group.vue
'
;
import
store
from
'
~
/ide/stores
'
;
import
radioGroup
from
'
~
/ide/components/commit_sidebar/radio_group.vue
'
;
import
{
createComponentWithStore
}
from
'
spec/helpers/vue_mount_component_helper
'
;
import
{
resetStore
}
from
'
spec/ide/helpers
'
;
describe
(
'
IDE commit sidebar radio group
'
,
()
=>
{
let
vm
;
beforeEach
(
(
done
)
=>
{
beforeEach
(
done
=>
{
const
Component
=
Vue
.
extend
(
radioGroup
);
store
.
state
.
commit
.
commitAction
=
'
2
'
;
...
...
@@ -33,7 +33,7 @@ describe('IDE commit sidebar radio group', () => {
expect
(
vm
.
$el
.
textContent
).
toContain
(
'
test
'
);
});
it
(
'
uses slot if label is not present
'
,
(
done
)
=>
{
it
(
'
uses slot if label is not present
'
,
done
=>
{
vm
.
$destroy
();
vm
=
new
Vue
({
...
...
@@ -59,7 +59,7 @@ describe('IDE commit sidebar radio group', () => {
});
});
it
(
'
updates store when changing radio button
'
,
(
done
)
=>
{
it
(
'
updates store when changing radio button
'
,
done
=>
{
vm
.
$el
.
querySelector
(
'
input
'
).
dispatchEvent
(
new
Event
(
'
change
'
));
Vue
.
nextTick
(()
=>
{
...
...
@@ -69,7 +69,7 @@ describe('IDE commit sidebar radio group', () => {
});
});
it
(
'
renders helpText tooltip
'
,
(
done
)
=>
{
it
(
'
renders helpText tooltip
'
,
done
=>
{
vm
.
helpText
=
'
help text
'
;
Vue
.
nextTick
(()
=>
{
...
...
@@ -83,7 +83,7 @@ describe('IDE commit sidebar radio group', () => {
});
describe
(
'
with input
'
,
()
=>
{
beforeEach
(
(
done
)
=>
{
beforeEach
(
done
=>
{
vm
.
$destroy
();
const
Component
=
Vue
.
extend
(
radioGroup
);
...
...
@@ -106,7 +106,7 @@ describe('IDE commit sidebar radio group', () => {
expect
(
vm
.
$el
.
querySelector
(
'
.form-control
'
)).
not
.
toBeNull
();
});
it
(
'
hides input when commitAction doesnt match value
'
,
(
done
)
=>
{
it
(
'
hides input when commitAction doesnt match value
'
,
done
=>
{
store
.
state
.
commit
.
commitAction
=
'
2
'
;
Vue
.
nextTick
(()
=>
{
...
...
@@ -115,7 +115,7 @@ describe('IDE commit sidebar radio group', () => {
});
});
it
(
'
updates branch name in store on input
'
,
(
done
)
=>
{
it
(
'
updates branch name in store on input
'
,
done
=>
{
const
input
=
vm
.
$el
.
querySelector
(
'
.form-control
'
);
input
.
value
=
'
testing-123
'
;
input
.
dispatchEvent
(
new
Event
(
'
input
'
));
...
...
spec/javascripts/ide/components/ide_context_bar_spec.js
View file @
af22ddaf
import
Vue
from
'
vue
'
;
import
store
from
'
ee
/ide/stores
'
;
import
ideContextBar
from
'
ee
/ide/components/ide_context_bar.vue
'
;
import
store
from
'
~
/ide/stores
'
;
import
ideContextBar
from
'
~
/ide/components/ide_context_bar.vue
'
;
import
{
createComponentWithStore
}
from
'
spec/helpers/vue_mount_component_helper
'
;
describe
(
'
Multi-file editor right context bar
'
,
()
=>
{
...
...
@@ -24,7 +24,7 @@ describe('Multi-file editor right context bar', () => {
});
describe
(
'
collapsed
'
,
()
=>
{
beforeEach
(
(
done
)
=>
{
beforeEach
(
done
=>
{
vm
.
$store
.
state
.
rightPanelCollapsed
=
true
;
Vue
.
nextTick
(
done
);
...
...
spec/javascripts/ide/components/ide_external_links_spec.js
View file @
af22ddaf
import
Vue
from
'
vue
'
;
import
ideExternalLinks
from
'
ee
/ide/components/ide_external_links.vue
'
;
import
ideExternalLinks
from
'
~
/ide/components/ide_external_links.vue
'
;
import
createComponent
from
'
spec/helpers/vue_mount_component_helper
'
;
describe
(
'
ide external links component
'
,
()
=>
{
...
...
spec/javascripts/ide/components/ide_repo_tree_spec.js
View file @
af22ddaf
import
Vue
from
'
vue
'
;
import
ideRepoTree
from
'
ee
/ide/components/ide_repo_tree.vue
'
;
import
ideRepoTree
from
'
~
/ide/components/ide_repo_tree.vue
'
;
import
createComponent
from
'
../../helpers/vue_mount_component_helper
'
;
import
{
file
}
from
'
../helpers
'
;
...
...
@@ -29,11 +29,13 @@ describe('IdeRepoTree', () => {
expect
(
vm
.
$el
.
querySelector
(
'
.file
'
)).
not
.
toBeNull
();
});
it
(
'
renders 3 loading files if tree is loading
'
,
(
done
)
=>
{
it
(
'
renders 3 loading files if tree is loading
'
,
done
=>
{
tree
.
loading
=
true
;
vm
.
$nextTick
(()
=>
{
expect
(
vm
.
$el
.
querySelectorAll
(
'
.multi-file-loading-container
'
).
length
).
toEqual
(
3
);
expect
(
vm
.
$el
.
querySelectorAll
(
'
.multi-file-loading-container
'
).
length
,
).
toEqual
(
3
);
done
();
});
...
...
spec/javascripts/ide/components/ide_side_bar_spec.js
View file @
af22ddaf
import
Vue
from
'
vue
'
;
import
store
from
'
ee
/ide/stores
'
;
import
ideSidebar
from
'
ee
/ide/components/ide_side_bar.vue
'
;
import
store
from
'
~
/ide/stores
'
;
import
ideSidebar
from
'
~
/ide/components/ide_side_bar.vue
'
;
import
{
createComponentWithStore
}
from
'
spec/helpers/vue_mount_component_helper
'
;
import
{
resetStore
}
from
'
../helpers
'
;
...
...
@@ -20,15 +20,21 @@ describe('IdeSidebar', () => {
});
it
(
'
renders a sidebar
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.multi-file-commit-panel-inner
'
)).
not
.
toBeNull
();
expect
(
vm
.
$el
.
querySelector
(
'
.multi-file-commit-panel-inner
'
),
).
not
.
toBeNull
();
});
it
(
'
renders loading icon component
'
,
(
done
)
=>
{
it
(
'
renders loading icon component
'
,
done
=>
{
vm
.
$store
.
state
.
loading
=
true
;
vm
.
$nextTick
(()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.multi-file-loading-container
'
)).
not
.
toBeNull
();
expect
(
vm
.
$el
.
querySelectorAll
(
'
.multi-file-loading-container
'
).
length
).
toBe
(
3
);
expect
(
vm
.
$el
.
querySelector
(
'
.multi-file-loading-container
'
),
).
not
.
toBeNull
();
expect
(
vm
.
$el
.
querySelectorAll
(
'
.multi-file-loading-container
'
).
length
,
).
toBe
(
3
);
done
();
});
...
...
spec/javascripts/ide/components/ide_spec.js
View file @
af22ddaf
import
Vue
from
'
vue
'
;
import
store
from
'
ee
/ide/stores
'
;
import
ide
from
'
ee
/ide/components/ide.vue
'
;
import
store
from
'
~
/ide/stores
'
;
import
ide
from
'
~
/ide/components/ide.vue
'
;
import
{
createComponentWithStore
}
from
'
spec/helpers/vue_mount_component_helper
'
;
import
{
file
,
resetStore
}
from
'
../helpers
'
;
...
...
@@ -27,7 +27,7 @@ describe('ide component', () => {
expect
(
vm
.
$el
.
querySelector
(
'
.panel-right
'
)).
toBeNull
();
});
it
(
'
renders panel right when files are open
'
,
(
done
)
=>
{
it
(
'
renders panel right when files are open
'
,
done
=>
{
vm
.
$store
.
state
.
trees
[
'
abcproject/mybranch
'
]
=
{
tree
:
[
file
()],
};
...
...
spec/javascripts/ide/components/new_dropdown/index_spec.js
View file @
af22ddaf
import
Vue
from
'
vue
'
;
import
store
from
'
ee
/ide/stores
'
;
import
newDropdown
from
'
ee
/ide/components/new_dropdown/index.vue
'
;
import
store
from
'
~
/ide/stores
'
;
import
newDropdown
from
'
~
/ide/components/new_dropdown/index.vue
'
;
import
{
createComponentWithStore
}
from
'
spec/helpers/vue_mount_component_helper
'
;
import
{
resetStore
}
from
'
../../helpers
'
;
...
...
spec/javascripts/ide/components/new_dropdown/modal_spec.js
View file @
af22ddaf
import
Vue
from
'
vue
'
;
import
modal
from
'
ee
/ide/components/new_dropdown/modal.vue
'
;
import
modal
from
'
~
/ide/components/new_dropdown/modal.vue
'
;
import
createComponent
from
'
spec/helpers/vue_mount_component_helper
'
;
describe
(
'
new file modal component
'
,
()
=>
{
...
...
@@ -10,7 +10,7 @@ describe('new file modal component', () => {
vm
.
$destroy
();
});
[
'
tree
'
,
'
blob
'
].
forEach
(
(
type
)
=>
{
[
'
tree
'
,
'
blob
'
].
forEach
(
type
=>
{
describe
(
type
,
()
=>
{
beforeEach
(()
=>
{
vm
=
createComponent
(
Component
,
{
...
...
@@ -25,19 +25,25 @@ describe('new file modal component', () => {
it
(
`sets modal title as
${
type
}
`
,
()
=>
{
const
title
=
type
===
'
tree
'
?
'
directory
'
:
'
file
'
;
expect
(
vm
.
$el
.
querySelector
(
'
.modal-title
'
).
textContent
.
trim
()).
toBe
(
`Create new
${
title
}
`
);
expect
(
vm
.
$el
.
querySelector
(
'
.modal-title
'
).
textContent
.
trim
()).
toBe
(
`Create new
${
title
}
`
,
);
});
it
(
`sets button label as
${
type
}
`
,
()
=>
{
const
title
=
type
===
'
tree
'
?
'
directory
'
:
'
file
'
;
expect
(
vm
.
$el
.
querySelector
(
'
.btn-success
'
).
textContent
.
trim
()).
toBe
(
`Create
${
title
}
`
);
expect
(
vm
.
$el
.
querySelector
(
'
.btn-success
'
).
textContent
.
trim
()).
toBe
(
`Create
${
title
}
`
,
);
});
it
(
`sets form label as
${
type
}
`
,
()
=>
{
const
title
=
type
===
'
tree
'
?
'
Directory
'
:
'
File
'
;
expect
(
vm
.
$el
.
querySelector
(
'
.label-light
'
).
textContent
.
trim
()).
toBe
(
`
${
title
}
name`
);
expect
(
vm
.
$el
.
querySelector
(
'
.label-light
'
).
textContent
.
trim
()).
toBe
(
`
${
title
}
name`
,
);
});
describe
(
'
createEntryInStore
'
,
()
=>
{
...
...
@@ -59,11 +65,15 @@ describe('new file modal component', () => {
it
(
'
focuses field on mount
'
,
()
=>
{
document
.
body
.
innerHTML
+=
'
<div class="js-test"></div>
'
;
vm
=
createComponent
(
Component
,
{
vm
=
createComponent
(
Component
,
{
type
:
'
tree
'
,
branchId
:
'
master
'
,
path
:
''
,
},
'
.js-test
'
);
},
'
.js-test
'
,
);
expect
(
document
.
activeElement
).
toBe
(
vm
.
$refs
.
fieldName
);
...
...
spec/javascripts/ide/components/new_dropdown/upload_spec.js
View file @
af22ddaf
import
Vue
from
'
vue
'
;
import
upload
from
'
ee
/ide/components/new_dropdown/upload.vue
'
;
import
upload
from
'
~
/ide/components/new_dropdown/upload.vue
'
;
import
createComponent
from
'
spec/helpers/vue_mount_component_helper
'
;
describe
(
'
new dropdown upload
'
,
()
=>
{
...
...
spec/javascripts/ide/components/repo_commit_section_spec.js
View file @
af22ddaf
import
Vue
from
'
vue
'
;
import
store
from
'
ee
/ide/stores
'
;
import
service
from
'
ee
/ide/services
'
;
import
repoCommitSection
from
'
ee
/ide/components/repo_commit_section.vue
'
;
import
store
from
'
~
/ide/stores
'
;
import
service
from
'
~
/ide/services
'
;
import
repoCommitSection
from
'
~
/ide/components/repo_commit_section.vue
'
;
import
{
createComponentWithStore
}
from
'
spec/helpers/vue_mount_component_helper
'
;
import
getSetTimeoutPromise
from
'
spec/helpers/set_timeout_promise_helper
'
;
import
{
file
,
resetStore
}
from
'
../helpers
'
;
...
...
@@ -31,22 +31,26 @@ describe('RepoCommitSection', () => {
vm
.
$store
.
state
.
rightPanelCollapsed
=
false
;
vm
.
$store
.
state
.
currentBranch
=
'
master
'
;
vm
.
$store
.
state
.
changedFiles
=
[
file
(
'
file1
'
),
file
(
'
file2
'
)];
vm
.
$store
.
state
.
changedFiles
.
forEach
(
f
=>
Object
.
assign
(
f
,
{
vm
.
$store
.
state
.
changedFiles
.
forEach
(
f
=>
Object
.
assign
(
f
,
{
changed
:
true
,
content
:
'
testing
'
,
}));
}),
);
return
vm
.
$mount
();
}
beforeEach
(
(
done
)
=>
{
beforeEach
(
done
=>
{
vm
=
createComponent
();
spyOn
(
service
,
'
getTreeData
'
).
and
.
returnValue
(
Promise
.
resolve
({
spyOn
(
service
,
'
getTreeData
'
).
and
.
returnValue
(
Promise
.
resolve
({
headers
:
{
'
page-title
'
:
'
test
'
,
},
json
:
()
=>
Promise
.
resolve
({
json
:
()
=>
Promise
.
resolve
({
last_commit_path
:
'
last_commit_path
'
,
parent_tree_url
:
'
parent_tree_url
'
,
path
:
'
/
'
,
...
...
@@ -54,7 +58,8 @@ describe('RepoCommitSection', () => {
blobs
:
[{
name
:
'
blob
'
}],
submodules
:
[{
name
:
'
submodule
'
}],
}),
}));
}),
);
Vue
.
nextTick
(
done
);
});
...
...
@@ -75,27 +80,35 @@ describe('RepoCommitSection', () => {
committedStateSvgPath
:
'
svg
'
,
}).
$mount
();
expect
(
vm
.
$el
.
querySelector
(
'
.js-empty-state
'
).
textContent
.
trim
()).
toContain
(
'
No changes
'
);
expect
(
vm
.
$el
.
querySelector
(
'
.js-empty-state img
'
).
getAttribute
(
'
src
'
)).
toBe
(
'
nochangessvg
'
);
expect
(
vm
.
$el
.
querySelector
(
'
.js-empty-state
'
).
textContent
.
trim
(),
).
toContain
(
'
No changes
'
);
expect
(
vm
.
$el
.
querySelector
(
'
.js-empty-state img
'
).
getAttribute
(
'
src
'
),
).
toBe
(
'
nochangessvg
'
);
});
});
it
(
'
renders a commit section
'
,
()
=>
{
const
changedFileElements
=
[...
vm
.
$el
.
querySelectorAll
(
'
.multi-file-commit-list li
'
)];
const
changedFileElements
=
[
...
vm
.
$el
.
querySelectorAll
(
'
.multi-file-commit-list li
'
),
];
const
submitCommit
=
vm
.
$el
.
querySelector
(
'
form .btn
'
);
expect
(
vm
.
$el
.
querySelector
(
'
.multi-file-commit-form
'
)).
not
.
toBeNull
();
expect
(
changedFileElements
.
length
).
toEqual
(
2
);
changedFileElements
.
forEach
((
changedFile
,
i
)
=>
{
expect
(
changedFile
.
textContent
.
trim
()).
toContain
(
vm
.
$store
.
state
.
changedFiles
[
i
].
path
);
expect
(
changedFile
.
textContent
.
trim
()).
toContain
(
vm
.
$store
.
state
.
changedFiles
[
i
].
path
,
);
});
expect
(
submitCommit
.
disabled
).
toBeTruthy
();
expect
(
submitCommit
.
querySelector
(
'
.fa-spinner.fa-spin
'
)).
toBeNull
();
});
it
(
'
updates commitMessage in store on input
'
,
(
done
)
=>
{
it
(
'
updates commitMessage in store on input
'
,
done
=>
{
const
textarea
=
vm
.
$el
.
querySelector
(
'
textarea
'
);
textarea
.
value
=
'
testing commit message
'
;
...
...
@@ -104,7 +117,9 @@ describe('RepoCommitSection', () => {
getSetTimeoutPromise
()
.
then
(()
=>
{
expect
(
vm
.
$store
.
state
.
commit
.
commitMessage
).
toBe
(
'
testing commit message
'
);
expect
(
vm
.
$store
.
state
.
commit
.
commitMessage
).
toBe
(
'
testing commit message
'
,
);
})
.
then
(
done
)
.
catch
(
done
.
fail
);
...
...
@@ -112,10 +127,12 @@ describe('RepoCommitSection', () => {
describe
(
'
discard draft button
'
,
()
=>
{
it
(
'
hidden when commitMessage is empty
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.multi-file-commit-form .btn-default
'
)).
toBeNull
();
expect
(
vm
.
$el
.
querySelector
(
'
.multi-file-commit-form .btn-default
'
),
).
toBeNull
();
});
it
(
'
resets commitMessage when clicking discard button
'
,
(
done
)
=>
{
it
(
'
resets commitMessage when clicking discard button
'
,
done
=>
{
vm
.
$store
.
state
.
commit
.
commitMessage
=
'
testing commit message
'
;
getSetTimeoutPromise
()
...
...
@@ -124,7 +141,9 @@ describe('RepoCommitSection', () => {
})
.
then
(
Vue
.
nextTick
)
.
then
(()
=>
{
expect
(
vm
.
$store
.
state
.
commit
.
commitMessage
).
not
.
toBe
(
'
testing commit message
'
);
expect
(
vm
.
$store
.
state
.
commit
.
commitMessage
).
not
.
toBe
(
'
testing commit message
'
,
);
})
.
then
(
done
)
.
catch
(
done
.
fail
);
...
...
@@ -136,7 +155,7 @@ describe('RepoCommitSection', () => {
spyOn
(
vm
,
'
commitChanges
'
);
});
it
(
'
calls commitChanges
'
,
(
done
)
=>
{
it
(
'
calls commitChanges
'
,
done
=>
{
vm
.
$store
.
state
.
commit
.
commitMessage
=
'
testing commit message
'
;
getSetTimeoutPromise
()
...
...
spec/javascripts/ide/components/repo_editor_spec.js
View file @
af22ddaf
import
Vue
from
'
vue
'
;
import
store
from
'
ee
/ide/stores
'
;
import
repoEditor
from
'
ee
/ide/components/repo_editor.vue
'
;
import
monacoLoader
from
'
ee
/ide/monaco_loader
'
;
import
Editor
from
'
ee
/ide/lib/editor
'
;
import
store
from
'
~
/ide/stores
'
;
import
repoEditor
from
'
~
/ide/components/repo_editor.vue
'
;
import
monacoLoader
from
'
~
/ide/monaco_loader
'
;
import
Editor
from
'
~
/ide/lib/editor
'
;
import
{
createComponentWithStore
}
from
'
../../helpers/vue_mount_component_helper
'
;
import
{
file
,
resetStore
}
from
'
../helpers
'
;
describe
(
'
RepoEditor
'
,
()
=>
{
let
vm
;
beforeEach
(
(
done
)
=>
{
beforeEach
(
done
=>
{
const
f
=
file
();
const
RepoEditor
=
Vue
.
extend
(
repoEditor
);
...
...
@@ -39,7 +39,7 @@ describe('RepoEditor', () => {
Editor
.
editorInstance
.
modelManager
.
dispose
();
});
it
(
'
renders an ide container
'
,
(
done
)
=>
{
it
(
'
renders an ide container
'
,
done
=>
{
Vue
.
nextTick
(()
=>
{
expect
(
vm
.
shouldHideEditor
).
toBeFalsy
();
...
...
@@ -48,7 +48,7 @@ describe('RepoEditor', () => {
});
describe
(
'
when open file is binary and not raw
'
,
()
=>
{
beforeEach
(
(
done
)
=>
{
beforeEach
(
done
=>
{
vm
.
file
.
binary
=
true
;
vm
.
$nextTick
(
done
);
...
...
@@ -64,7 +64,7 @@ describe('RepoEditor', () => {
});
describe
(
'
createEditorInstance
'
,
()
=>
{
it
(
'
calls createInstance when viewer is editor
'
,
(
done
)
=>
{
it
(
'
calls createInstance when viewer is editor
'
,
done
=>
{
spyOn
(
vm
.
editor
,
'
createInstance
'
);
vm
.
createEditorInstance
();
...
...
@@ -76,7 +76,7 @@ describe('RepoEditor', () => {
});
});
it
(
'
calls createDiffInstance when viewer is diff
'
,
(
done
)
=>
{
it
(
'
calls createDiffInstance when viewer is diff
'
,
done
=>
{
vm
.
$store
.
state
.
viewer
=
'
diff
'
;
spyOn
(
vm
.
editor
,
'
createDiffInstance
'
);
...
...
@@ -124,7 +124,7 @@ describe('RepoEditor', () => {
expect
(
vm
.
model
.
events
.
size
).
toBe
(
1
);
});
it
(
'
updates state when model content changed
'
,
(
done
)
=>
{
it
(
'
updates state when model content changed
'
,
done
=>
{
vm
.
model
.
setValue
(
'
testing 123
'
);
setTimeout
(()
=>
{
...
...
spec/javascripts/ide/components/repo_file_buttons_spec.js
View file @
af22ddaf
import
Vue
from
'
vue
'
;
import
repoFileButtons
from
'
ee
/ide/components/repo_file_buttons.vue
'
;
import
repoFileButtons
from
'
~
/ide/components/repo_file_buttons.vue
'
;
import
createVueComponent
from
'
../../helpers/vue_mount_component_helper
'
;
import
{
file
}
from
'
../helpers
'
;
...
...
@@ -23,7 +23,7 @@ describe('RepoFileButtons', () => {
vm
.
$destroy
();
});
it
(
'
renders Raw, Blame, History, Permalink and Preview toggle
'
,
(
done
)
=>
{
it
(
'
renders Raw, Blame, History, Permalink and Preview toggle
'
,
done
=>
{
vm
=
createComponent
();
vm
.
$nextTick
(()
=>
{
...
...
@@ -37,7 +37,9 @@ describe('RepoFileButtons', () => {
expect
(
blame
.
textContent
.
trim
()).
toEqual
(
'
Blame
'
);
expect
(
history
.
href
).
toMatch
(
`/
${
activeFile
.
commitsPath
}
`
);
expect
(
history
.
textContent
.
trim
()).
toEqual
(
'
History
'
);
expect
(
vm
.
$el
.
querySelector
(
'
.permalink
'
).
textContent
.
trim
()).
toEqual
(
'
Permalink
'
);
expect
(
vm
.
$el
.
querySelector
(
'
.permalink
'
).
textContent
.
trim
()).
toEqual
(
'
Permalink
'
,
);
done
();
});
...
...
spec/javascripts/ide/components/repo_file_spec.js
View file @
af22ddaf
import
Vue
from
'
vue
'
;
import
store
from
'
ee
/ide/stores
'
;
import
repoFile
from
'
ee
/ide/components/repo_file.vue
'
;
import
router
from
'
ee
/ide/ide_router
'
;
import
store
from
'
~
/ide/stores
'
;
import
repoFile
from
'
~
/ide/components/repo_file.vue
'
;
import
router
from
'
~
/ide/ide_router
'
;
import
{
createComponentWithStore
}
from
'
../../helpers/vue_mount_component_helper
'
;
import
{
file
}
from
'
../helpers
'
;
...
...
spec/javascripts/ide/components/repo_loading_file_spec.js
View file @
af22ddaf
import
Vue
from
'
vue
'
;
import
store
from
'
ee
/ide/stores
'
;
import
repoLoadingFile
from
'
ee
/ide/components/repo_loading_file.vue
'
;
import
store
from
'
~
/ide/stores
'
;
import
repoLoadingFile
from
'
~
/ide/components/repo_loading_file.vue
'
;
import
{
resetStore
}
from
'
../helpers
'
;
describe
(
'
RepoLoadingFile
'
,
()
=>
{
...
...
@@ -22,7 +22,7 @@ describe('RepoLoadingFile', () => {
}
function
assertColumns
(
columns
)
{
columns
.
forEach
(
(
column
)
=>
{
columns
.
forEach
(
column
=>
{
const
container
=
column
.
querySelector
(
'
.animation-container
'
);
const
lines
=
[...
container
.
querySelectorAll
(
'
:scope > div
'
)];
...
...
@@ -46,7 +46,7 @@ describe('RepoLoadingFile', () => {
assertColumns
(
columns
);
});
it
(
'
renders 1 column of animated LoC if isMini
'
,
(
done
)
=>
{
it
(
'
renders 1 column of animated LoC if isMini
'
,
done
=>
{
vm
=
createComponent
();
vm
.
$store
.
state
.
leftPanelCollapsed
=
true
;
vm
.
$store
.
state
.
openFiles
.
push
(
'
test
'
);
...
...
spec/javascripts/ide/components/repo_tab_spec.js
View file @
af22ddaf
import
Vue
from
'
vue
'
;
import
store
from
'
ee
/ide/stores
'
;
import
repoTab
from
'
ee
/ide/components/repo_tab.vue
'
;
import
router
from
'
ee
/ide/ide_router
'
;
import
store
from
'
~
/ide/stores
'
;
import
repoTab
from
'
~
/ide/components/repo_tab.vue
'
;
import
router
from
'
~
/ide/ide_router
'
;
import
{
file
,
resetStore
}
from
'
../helpers
'
;
describe
(
'
RepoTab
'
,
()
=>
{
...
...
@@ -62,7 +62,7 @@ describe('RepoTab', () => {
expect
(
vm
.
closeFile
).
toHaveBeenCalledWith
(
vm
.
tab
.
path
);
});
it
(
'
changes icon on hover
'
,
(
done
)
=>
{
it
(
'
changes icon on hover
'
,
done
=>
{
const
tab
=
file
();
tab
.
changed
=
true
;
vm
=
createComponent
({
...
...
@@ -112,13 +112,15 @@ describe('RepoTab', () => {
});
it
(
'
renders a tooltip
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
span:nth-child(2)
'
).
dataset
.
originalTitle
).
toContain
(
'
Locked by testuser
'
);
expect
(
vm
.
$el
.
querySelector
(
'
span:nth-child(2)
'
).
dataset
.
originalTitle
,
).
toContain
(
'
Locked by testuser
'
);
});
});
describe
(
'
methods
'
,
()
=>
{
describe
(
'
closeTab
'
,
()
=>
{
it
(
'
closes tab if file has changed
'
,
(
done
)
=>
{
it
(
'
closes tab if file has changed
'
,
done
=>
{
const
tab
=
file
();
tab
.
changed
=
true
;
tab
.
opened
=
true
;
...
...
@@ -140,7 +142,7 @@ describe('RepoTab', () => {
});
});
it
(
'
closes tab when clicking close btn
'
,
(
done
)
=>
{
it
(
'
closes tab when clicking close btn
'
,
done
=>
{
const
tab
=
file
(
'
lose
'
);
tab
.
opened
=
true
;
vm
=
createComponent
({
...
...
spec/javascripts/ide/components/repo_tabs_spec.js
View file @
af22ddaf
import
Vue
from
'
vue
'
;
import
repoTabs
from
'
ee
/ide/components/repo_tabs.vue
'
;
import
repoTabs
from
'
~
/ide/components/repo_tabs.vue
'
;
import
createComponent
from
'
../../helpers/vue_mount_component_helper
'
;
import
{
file
}
from
'
../helpers
'
;
...
...
spec/javascripts/ide/helpers.js
View file @
af22ddaf
import
{
decorateData
}
from
'
ee
/ide/stores/utils
'
;
import
state
from
'
ee
/ide/stores/state
'
;
import
commitState
from
'
ee
/ide/stores/modules/commit/state
'
;
import
{
decorateData
}
from
'
~
/ide/stores/utils
'
;
import
state
from
'
~
/ide/stores/state
'
;
import
commitState
from
'
~
/ide/stores/modules/commit/state
'
;
export
const
resetStore
=
(
store
)
=>
{
export
const
resetStore
=
store
=>
{
const
newState
=
{
...
state
(),
commit
:
commitState
(),
...
...
@@ -10,7 +10,8 @@ export const resetStore = (store) => {
store
.
replaceState
(
newState
);
};
export
const
file
=
(
name
=
'
name
'
,
id
=
name
,
type
=
''
)
=>
decorateData
({
export
const
file
=
(
name
=
'
name
'
,
id
=
name
,
type
=
''
)
=>
decorateData
({
id
,
type
,
icon
:
'
icon
'
,
...
...
@@ -18,4 +19,4 @@ export const file = (name = 'name', id = name, type = '') => decorateData({
name
,
path
:
name
,
lastCommit
:
{},
});
});
spec/javascripts/ide/lib/common/disposable_spec.js
View file @
af22ddaf
import
Disposable
from
'
ee
/ide/lib/common/disposable
'
;
import
Disposable
from
'
~
/ide/lib/common/disposable
'
;
describe
(
'
Multi-file editor library disposable class
'
,
()
=>
{
let
instance
;
...
...
spec/javascripts/ide/lib/common/model_manager_spec.js
View file @
af22ddaf
/* global monaco */
import
eventHub
from
'
ee
/ide/eventhub
'
;
import
monacoLoader
from
'
ee
/ide/monaco_loader
'
;
import
ModelManager
from
'
ee
/ide/lib/common/model_manager
'
;
import
eventHub
from
'
~
/ide/eventhub
'
;
import
monacoLoader
from
'
~
/ide/monaco_loader
'
;
import
ModelManager
from
'
~
/ide/lib/common/model_manager
'
;
import
{
file
}
from
'
../../helpers
'
;
describe
(
'
Multi-file editor library model manager
'
,
()
=>
{
let
instance
;
beforeEach
(
(
done
)
=>
{
beforeEach
(
done
=>
{
monacoLoader
([
'
vs/editor/editor.main
'
],
()
=>
{
instance
=
new
ModelManager
(
monaco
);
...
...
@@ -55,7 +55,10 @@ describe('Multi-file editor library model manager', () => {
instance
.
addModel
(
f
);
expect
(
eventHub
.
$on
).
toHaveBeenCalledWith
(
`editor.update.model.dispose.
${
f
.
path
}
`
,
jasmine
.
anything
());
expect
(
eventHub
.
$on
).
toHaveBeenCalledWith
(
`editor.update.model.dispose.
${
f
.
path
}
`
,
jasmine
.
anything
(),
);
});
});
...
...
@@ -99,7 +102,10 @@ describe('Multi-file editor library model manager', () => {
instance
.
removeCachedModel
(
f
);
expect
(
eventHub
.
$off
).
toHaveBeenCalledWith
(
`editor.update.model.dispose.
${
f
.
path
}
`
,
jasmine
.
anything
());
expect
(
eventHub
.
$off
).
toHaveBeenCalledWith
(
`editor.update.model.dispose.
${
f
.
path
}
`
,
jasmine
.
anything
(),
);
});
});
...
...
spec/javascripts/ide/lib/common/model_spec.js
View file @
af22ddaf
/* global monaco */
import
eventHub
from
'
ee
/ide/eventhub
'
;
import
monacoLoader
from
'
ee
/ide/monaco_loader
'
;
import
Model
from
'
ee
/ide/lib/common/model
'
;
import
eventHub
from
'
~
/ide/eventhub
'
;
import
monacoLoader
from
'
~
/ide/monaco_loader
'
;
import
Model
from
'
~
/ide/lib/common/model
'
;
import
{
file
}
from
'
../../helpers
'
;
describe
(
'
Multi-file editor library model
'
,
()
=>
{
let
model
;
beforeEach
(
(
done
)
=>
{
beforeEach
(
done
=>
{
spyOn
(
eventHub
,
'
$on
'
).
and
.
callThrough
();
monacoLoader
([
'
vs/editor/editor.main
'
],
()
=>
{
...
...
@@ -27,7 +27,10 @@ describe('Multi-file editor library model', () => {
});
it
(
'
adds eventHub listener
'
,
()
=>
{
expect
(
eventHub
.
$on
).
toHaveBeenCalledWith
(
`editor.update.model.dispose.
${
model
.
file
.
path
}
`
,
jasmine
.
anything
());
expect
(
eventHub
.
$on
).
toHaveBeenCalledWith
(
`editor.update.model.dispose.
${
model
.
file
.
path
}
`
,
jasmine
.
anything
(),
);
});
describe
(
'
path
'
,
()
=>
{
...
...
@@ -64,7 +67,7 @@ describe('Multi-file editor library model', () => {
expect
(
model
.
events
.
keys
().
next
().
value
).
toBe
(
'
path
'
);
});
it
(
'
calls callback on change
'
,
(
done
)
=>
{
it
(
'
calls callback on change
'
,
done
=>
{
const
spy
=
jasmine
.
createSpy
();
model
.
onChange
(
spy
);
...
...
@@ -101,7 +104,10 @@ describe('Multi-file editor library model', () => {
model
.
dispose
();
expect
(
eventHub
.
$off
).
toHaveBeenCalledWith
(
`editor.update.model.dispose.
${
model
.
file
.
path
}
`
,
jasmine
.
anything
());
expect
(
eventHub
.
$off
).
toHaveBeenCalledWith
(
`editor.update.model.dispose.
${
model
.
file
.
path
}
`
,
jasmine
.
anything
(),
);
});
});
});
spec/javascripts/ide/lib/decorations/controller_spec.js
View file @
af22ddaf
/* global monaco */
import
monacoLoader
from
'
ee
/ide/monaco_loader
'
;
import
editor
from
'
ee
/ide/lib/editor
'
;
import
DecorationsController
from
'
ee
/ide/lib/decorations/controller
'
;
import
Model
from
'
ee
/ide/lib/common/model
'
;
import
monacoLoader
from
'
~
/ide/monaco_loader
'
;
import
editor
from
'
~
/ide/lib/editor
'
;
import
DecorationsController
from
'
~
/ide/lib/decorations/controller
'
;
import
Model
from
'
~
/ide/lib/common/model
'
;
import
{
file
}
from
'
../../helpers
'
;
describe
(
'
Multi-file editor library decorations controller
'
,
()
=>
{
...
...
@@ -10,7 +10,7 @@ describe('Multi-file editor library decorations controller', () => {
let
controller
;
let
model
;
beforeEach
(
(
done
)
=>
{
beforeEach
(
done
=>
{
monacoLoader
([
'
vs/editor/editor.main
'
],
()
=>
{
editorInstance
=
editor
.
create
(
monaco
);
editorInstance
.
createInstance
(
document
.
createElement
(
'
div
'
));
...
...
@@ -36,7 +36,9 @@ describe('Multi-file editor library decorations controller', () => {
});
it
(
'
returns decorations by model URL
'
,
()
=>
{
controller
.
addDecorations
(
model
,
'
key
'
,
[{
decoration
:
'
decorationValue
'
}]);
controller
.
addDecorations
(
model
,
'
key
'
,
[
{
decoration
:
'
decorationValue
'
},
]);
const
decorations
=
controller
.
getAllDecorationsForModel
(
model
);
...
...
@@ -46,20 +48,28 @@ describe('Multi-file editor library decorations controller', () => {
describe
(
'
addDecorations
'
,
()
=>
{
it
(
'
caches decorations in a new map
'
,
()
=>
{
controller
.
addDecorations
(
model
,
'
key
'
,
[{
decoration
:
'
decorationValue
'
}]);
controller
.
addDecorations
(
model
,
'
key
'
,
[
{
decoration
:
'
decorationValue
'
},
]);
expect
(
controller
.
decorations
.
size
).
toBe
(
1
);
});
it
(
'
does not create new cache model
'
,
()
=>
{
controller
.
addDecorations
(
model
,
'
key
'
,
[{
decoration
:
'
decorationValue
'
}]);
controller
.
addDecorations
(
model
,
'
key
'
,
[{
decoration
:
'
decorationValue2
'
}]);
controller
.
addDecorations
(
model
,
'
key
'
,
[
{
decoration
:
'
decorationValue
'
},
]);
controller
.
addDecorations
(
model
,
'
key
'
,
[
{
decoration
:
'
decorationValue2
'
},
]);
expect
(
controller
.
decorations
.
size
).
toBe
(
1
);
});
it
(
'
caches decorations by model URL
'
,
()
=>
{
controller
.
addDecorations
(
model
,
'
key
'
,
[{
decoration
:
'
decorationValue
'
}]);
controller
.
addDecorations
(
model
,
'
key
'
,
[
{
decoration
:
'
decorationValue
'
},
]);
expect
(
controller
.
decorations
.
size
).
toBe
(
1
);
expect
(
controller
.
decorations
.
keys
().
next
().
value
).
toBe
(
'
path
'
);
...
...
@@ -68,7 +78,9 @@ describe('Multi-file editor library decorations controller', () => {
it
(
'
calls decorate method
'
,
()
=>
{
spyOn
(
controller
,
'
decorate
'
);
controller
.
addDecorations
(
model
,
'
key
'
,
[{
decoration
:
'
decorationValue
'
}]);
controller
.
addDecorations
(
model
,
'
key
'
,
[
{
decoration
:
'
decorationValue
'
},
]);
expect
(
controller
.
decorate
).
toHaveBeenCalled
();
});
...
...
@@ -80,7 +92,10 @@ describe('Multi-file editor library decorations controller', () => {
controller
.
decorate
(
model
);
expect
(
controller
.
editor
.
instance
.
deltaDecorations
).
toHaveBeenCalledWith
([],
[]);
expect
(
controller
.
editor
.
instance
.
deltaDecorations
).
toHaveBeenCalledWith
(
[],
[],
);
});
it
(
'
caches decorations
'
,
()
=>
{
...
...
@@ -102,7 +117,9 @@ describe('Multi-file editor library decorations controller', () => {
describe
(
'
dispose
'
,
()
=>
{
it
(
'
clears cached decorations
'
,
()
=>
{
controller
.
addDecorations
(
model
,
'
key
'
,
[{
decoration
:
'
decorationValue
'
}]);
controller
.
addDecorations
(
model
,
'
key
'
,
[
{
decoration
:
'
decorationValue
'
},
]);
controller
.
dispose
();
...
...
@@ -110,7 +127,9 @@ describe('Multi-file editor library decorations controller', () => {
});
it
(
'
clears cached editorDecorations
'
,
()
=>
{
controller
.
addDecorations
(
model
,
'
key
'
,
[{
decoration
:
'
decorationValue
'
}]);
controller
.
addDecorations
(
model
,
'
key
'
,
[
{
decoration
:
'
decorationValue
'
},
]);
controller
.
dispose
();
...
...
spec/javascripts/ide/lib/diff/controller_spec.js
View file @
af22ddaf
/* global monaco */
import
monacoLoader
from
'
ee/ide/monaco_loader
'
;
import
editor
from
'
ee/ide/lib/editor
'
;
import
ModelManager
from
'
ee/ide/lib/common/model_manager
'
;
import
DecorationsController
from
'
ee/ide/lib/decorations/controller
'
;
import
DirtyDiffController
,
{
getDiffChangeType
,
getDecorator
}
from
'
ee/ide/lib/diff/controller
'
;
import
{
computeDiff
}
from
'
ee/ide/lib/diff/diff
'
;
import
monacoLoader
from
'
~/ide/monaco_loader
'
;
import
editor
from
'
~/ide/lib/editor
'
;
import
ModelManager
from
'
~/ide/lib/common/model_manager
'
;
import
DecorationsController
from
'
~/ide/lib/decorations/controller
'
;
import
DirtyDiffController
,
{
getDiffChangeType
,
getDecorator
,
}
from
'
~/ide/lib/diff/controller
'
;
import
{
computeDiff
}
from
'
~/ide/lib/diff/diff
'
;
import
{
file
}
from
'
../../helpers
'
;
describe
(
'
Multi-file editor library dirty diff controller
'
,
()
=>
{
...
...
@@ -14,7 +17,7 @@ describe('Multi-file editor library dirty diff controller', () => {
let
decorationsController
;
let
model
;
beforeEach
(
(
done
)
=>
{
beforeEach
(
done
=>
{
monacoLoader
([
'
vs/editor/editor.main
'
],
()
=>
{
editorInstance
=
editor
.
create
(
monaco
);
editorInstance
.
createInstance
(
document
.
createElement
(
'
div
'
));
...
...
@@ -38,7 +41,7 @@ describe('Multi-file editor library dirty diff controller', () => {
});
describe
(
'
getDiffChangeType
'
,
()
=>
{
[
'
added
'
,
'
removed
'
,
'
modified
'
].
forEach
(
(
type
)
=>
{
[
'
added
'
,
'
removed
'
,
'
modified
'
].
forEach
(
type
=>
{
it
(
`returns
${
type
}
`
,
()
=>
{
const
change
=
{
[
type
]:
true
,
...
...
@@ -50,15 +53,15 @@ describe('Multi-file editor library dirty diff controller', () => {
});
describe
(
'
getDecorator
'
,
()
=>
{
[
'
added
'
,
'
removed
'
,
'
modified
'
].
forEach
(
(
type
)
=>
{
[
'
added
'
,
'
removed
'
,
'
modified
'
].
forEach
(
type
=>
{
it
(
`returns with linesDecorationsClassName for
${
type
}
`
,
()
=>
{
const
change
=
{
[
type
]:
true
,
};
expect
(
getDecorator
(
change
).
options
.
linesDecorationsClassName
,
)
.
toBe
(
`dirty-diff dirty-diff-
${
type
}
`
)
;
expect
(
getDecorator
(
change
).
options
.
linesDecorationsClassName
).
toBe
(
`dirty-diff dirty-diff-
${
type
}
`
,
);
});
it
(
'
returns with line numbers
'
,
()
=>
{
...
...
@@ -118,7 +121,9 @@ describe('Multi-file editor library dirty diff controller', () => {
controller
.
reDecorate
(
model
);
expect
(
controller
.
decorationsController
.
decorate
).
toHaveBeenCalledWith
(
model
);
expect
(
controller
.
decorationsController
.
decorate
).
toHaveBeenCalledWith
(
model
,
);
});
});
...
...
@@ -128,23 +133,33 @@ describe('Multi-file editor library dirty diff controller', () => {
controller
.
decorate
({
data
:
{
changes
:
[],
path
:
'
path
'
}
});
expect
(
controller
.
decorationsController
.
addDecorations
).
toHaveBeenCalledWith
(
model
,
'
dirtyDiff
'
,
jasmine
.
anything
());
expect
(
controller
.
decorationsController
.
addDecorations
,
).
toHaveBeenCalledWith
(
model
,
'
dirtyDiff
'
,
jasmine
.
anything
());
});
it
(
'
adds decorations into editor
'
,
()
=>
{
const
spy
=
spyOn
(
controller
.
decorationsController
.
editor
.
instance
,
'
deltaDecorations
'
);
const
spy
=
spyOn
(
controller
.
decorationsController
.
editor
.
instance
,
'
deltaDecorations
'
,
);
controller
.
decorate
({
data
:
{
changes
:
computeDiff
(
'
123
'
,
'
1234
'
),
path
:
'
path
'
}
});
controller
.
decorate
({
data
:
{
changes
:
computeDiff
(
'
123
'
,
'
1234
'
),
path
:
'
path
'
},
});
expect
(
spy
).
toHaveBeenCalledWith
([],
[{
range
:
new
monaco
.
Range
(
1
,
1
,
1
,
1
,
),
expect
(
spy
).
toHaveBeenCalledWith
(
[],
[
{
range
:
new
monaco
.
Range
(
1
,
1
,
1
,
1
),
options
:
{
isWholeLine
:
true
,
linesDecorationsClassName
:
'
dirty-diff dirty-diff-modified
'
,
},
}]);
},
],
);
});
});
...
...
@@ -166,11 +181,16 @@ describe('Multi-file editor library dirty diff controller', () => {
});
it
(
'
removes worker event listener
'
,
()
=>
{
spyOn
(
controller
.
dirtyDiffWorker
,
'
removeEventListener
'
).
and
.
callThrough
();
spyOn
(
controller
.
dirtyDiffWorker
,
'
removeEventListener
'
,
).
and
.
callThrough
();
controller
.
dispose
();
expect
(
controller
.
dirtyDiffWorker
.
removeEventListener
).
toHaveBeenCalledWith
(
'
message
'
,
jasmine
.
anything
());
expect
(
controller
.
dirtyDiffWorker
.
removeEventListener
,
).
toHaveBeenCalledWith
(
'
message
'
,
jasmine
.
anything
());
});
});
});
spec/javascripts/ide/lib/diff/diff_spec.js
View file @
af22ddaf
import
{
computeDiff
}
from
'
ee
/ide/lib/diff/diff
'
;
import
{
computeDiff
}
from
'
~
/ide/lib/diff/diff
'
;
describe
(
'
Multi-file editor library diff calculator
'
,
()
=>
{
describe
(
'
computeDiff
'
,
()
=>
{
...
...
spec/javascripts/ide/lib/editor_options_spec.js
View file @
af22ddaf
import
editorOptions
from
'
ee
/ide/lib/editor_options
'
;
import
editorOptions
from
'
~
/ide/lib/editor_options
'
;
describe
(
'
Multi-file editor library editor options
'
,
()
=>
{
it
(
'
returns an array
'
,
()
=>
{
...
...
spec/javascripts/ide/lib/editor_spec.js
View file @
af22ddaf
/* global monaco */
import
monacoLoader
from
'
ee
/ide/monaco_loader
'
;
import
editor
from
'
ee
/ide/lib/editor
'
;
import
monacoLoader
from
'
~
/ide/monaco_loader
'
;
import
editor
from
'
~
/ide/lib/editor
'
;
import
{
file
}
from
'
../helpers
'
;
describe
(
'
Multi-file editor library
'
,
()
=>
{
...
...
spec/javascripts/ide/monaco_loader_spec.js
View file @
af22ddaf
import
monacoContext
from
'
monaco-editor/dev/vs/loader
'
;
import
monacoLoader
from
'
ee
/ide/monaco_loader
'
;
import
monacoLoader
from
'
~
/ide/monaco_loader
'
;
describe
(
'
MonacoLoader
'
,
()
=>
{
it
(
'
calls require.config and exports require
'
,
()
=>
{
expect
(
monacoContext
.
require
.
getConfig
()).
toEqual
(
jasmine
.
objectContaining
({
expect
(
monacoContext
.
require
.
getConfig
()).
toEqual
(
jasmine
.
objectContaining
({
paths
:
{
vs
:
`
${
__webpack_public_path__
}
monaco-editor/vs`
,
// eslint-disable-line camelcase
},
}));
}),
);
expect
(
monacoLoader
).
toBe
(
monacoContext
.
require
);
});
});
spec/javascripts/ide/stores/actions/file_spec.js
View file @
af22ddaf
import
Vue
from
'
vue
'
;
import
store
from
'
ee
/ide/stores
'
;
import
service
from
'
ee
/ide/services
'
;
import
router
from
'
ee
/ide/ide_router
'
;
import
eventHub
from
'
ee
/ide/eventhub
'
;
import
store
from
'
~
/ide/stores
'
;
import
service
from
'
~
/ide/services
'
;
import
router
from
'
~
/ide/ide_router
'
;
import
eventHub
from
'
~
/ide/eventhub
'
;
import
{
file
,
resetStore
}
from
'
../../helpers
'
;
describe
(
'
Multi-file store file actions
'
,
()
=>
{
...
...
spec/javascripts/ide/stores/actions/tree_spec.js
View file @
af22ddaf
import
Vue
from
'
vue
'
;
import
store
from
'
ee
/ide/stores
'
;
import
service
from
'
ee
/ide/services
'
;
import
router
from
'
ee
/ide/ide_router
'
;
import
store
from
'
~
/ide/stores
'
;
import
service
from
'
~
/ide/services
'
;
import
router
from
'
~
/ide/ide_router
'
;
import
{
file
,
resetStore
}
from
'
../../helpers
'
;
describe
(
'
Multi-file store tree actions
'
,
()
=>
{
...
...
@@ -35,26 +35,32 @@ describe('Multi-file store tree actions', () => {
describe
(
'
getFiles
'
,
()
=>
{
beforeEach
(()
=>
{
spyOn
(
service
,
'
getFiles
'
).
and
.
returnValue
(
Promise
.
resolve
({
json
:
()
=>
Promise
.
resolve
([
spyOn
(
service
,
'
getFiles
'
).
and
.
returnValue
(
Promise
.
resolve
({
json
:
()
=>
Promise
.
resolve
([
'
file.txt
'
,
'
folder/fileinfolder.js
'
,
'
folder/subfolder/fileinsubfolder.js
'
,
]),
}));
}),
);
});
it
(
'
calls service getFiles
'
,
(
done
)
=>
{
store
.
dispatch
(
'
getFiles
'
,
basicCallParameters
)
it
(
'
calls service getFiles
'
,
done
=>
{
store
.
dispatch
(
'
getFiles
'
,
basicCallParameters
)
.
then
(()
=>
{
expect
(
service
.
getFiles
).
toHaveBeenCalledWith
(
''
,
'
master
'
);
done
();
}).
catch
(
done
.
fail
);
})
.
catch
(
done
.
fail
);
});
it
(
'
adds data into tree
'
,
(
done
)
=>
{
store
.
dispatch
(
'
getFiles
'
,
basicCallParameters
)
it
(
'
adds data into tree
'
,
done
=>
{
store
.
dispatch
(
'
getFiles
'
,
basicCallParameters
)
.
then
(()
=>
{
projectTree
=
store
.
state
.
trees
[
'
abcproject/master
'
];
expect
(
projectTree
.
tree
.
length
).
toBe
(
2
);
...
...
@@ -62,10 +68,13 @@ describe('Multi-file store tree actions', () => {
expect
(
projectTree
.
tree
[
0
].
tree
[
1
].
name
).
toBe
(
'
fileinfolder.js
'
);
expect
(
projectTree
.
tree
[
1
].
type
).
toBe
(
'
blob
'
);
expect
(
projectTree
.
tree
[
0
].
tree
[
0
].
tree
[
0
].
type
).
toBe
(
'
blob
'
);
expect
(
projectTree
.
tree
[
0
].
tree
[
0
].
tree
[
0
].
name
).
toBe
(
'
fileinsubfolder.js
'
);
expect
(
projectTree
.
tree
[
0
].
tree
[
0
].
tree
[
0
].
name
).
toBe
(
'
fileinsubfolder.js
'
,
);
done
();
}).
catch
(
done
.
fail
);
})
.
catch
(
done
.
fail
);
});
});
...
...
@@ -77,30 +86,38 @@ describe('Multi-file store tree actions', () => {
store
.
state
.
entries
[
tree
.
path
]
=
tree
;
});
it
(
'
toggles the tree open
'
,
(
done
)
=>
{
store
.
dispatch
(
'
toggleTreeOpen
'
,
tree
.
path
).
then
(()
=>
{
it
(
'
toggles the tree open
'
,
done
=>
{
store
.
dispatch
(
'
toggleTreeOpen
'
,
tree
.
path
)
.
then
(()
=>
{
expect
(
tree
.
opened
).
toBeTruthy
();
done
();
}).
catch
(
done
.
fail
);
})
.
catch
(
done
.
fail
);
});
});
describe
(
'
getLastCommitData
'
,
()
=>
{
beforeEach
(()
=>
{
spyOn
(
service
,
'
getTreeLastCommit
'
).
and
.
returnValue
(
Promise
.
resolve
({
spyOn
(
service
,
'
getTreeLastCommit
'
).
and
.
returnValue
(
Promise
.
resolve
({
headers
:
{
'
more-logs-url
'
:
null
,
},
json
:
()
=>
Promise
.
resolve
([{
json
:
()
=>
Promise
.
resolve
([
{
type
:
'
tree
'
,
file_name
:
'
testing
'
,
commit
:
{
message
:
'
commit message
'
,
authored_date
:
'
123
'
,
},
}]),
}));
},
]),
}),
);
store
.
state
.
trees
[
'
abcproject/mybranch
'
]
=
{
tree
:
[],
...
...
@@ -111,35 +128,45 @@ describe('Multi-file store tree actions', () => {
projectTree
.
lastCommitPath
=
'
lastcommitpath
'
;
});
it
(
'
calls service with lastCommitPath
'
,
(
done
)
=>
{
store
.
dispatch
(
'
getLastCommitData
'
,
projectTree
)
it
(
'
calls service with lastCommitPath
'
,
done
=>
{
store
.
dispatch
(
'
getLastCommitData
'
,
projectTree
)
.
then
(()
=>
{
expect
(
service
.
getTreeLastCommit
).
toHaveBeenCalledWith
(
'
lastcommitpath
'
);
expect
(
service
.
getTreeLastCommit
).
toHaveBeenCalledWith
(
'
lastcommitpath
'
,
);
done
();
}).
catch
(
done
.
fail
);
})
.
catch
(
done
.
fail
);
});
it
(
'
updates trees last commit data
'
,
(
done
)
=>
{
store
.
dispatch
(
'
getLastCommitData
'
,
projectTree
)
it
(
'
updates trees last commit data
'
,
done
=>
{
store
.
dispatch
(
'
getLastCommitData
'
,
projectTree
)
.
then
(
Vue
.
nextTick
)
.
then
(()
=>
{
expect
(
projectTree
.
tree
[
0
].
lastCommit
.
message
).
toBe
(
'
commit message
'
);
done
();
}).
catch
(
done
.
fail
);
})
.
catch
(
done
.
fail
);
});
it
(
'
does not update entry if not found
'
,
(
done
)
=>
{
it
(
'
does not update entry if not found
'
,
done
=>
{
projectTree
.
tree
[
0
].
name
=
'
a
'
;
store
.
dispatch
(
'
getLastCommitData
'
,
projectTree
)
store
.
dispatch
(
'
getLastCommitData
'
,
projectTree
)
.
then
(
Vue
.
nextTick
)
.
then
(()
=>
{
expect
(
projectTree
.
tree
[
0
].
lastCommit
.
message
).
not
.
toBe
(
'
commit message
'
);
expect
(
projectTree
.
tree
[
0
].
lastCommit
.
message
).
not
.
toBe
(
'
commit message
'
,
);
done
();
}).
catch
(
done
.
fail
);
})
.
catch
(
done
.
fail
);
});
});
});
spec/javascripts/ide/stores/actions_spec.js
View file @
af22ddaf
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
import
store
from
'
ee
/ide/stores
'
;
import
router
from
'
ee
/ide/ide_router
'
;
import
store
from
'
~
/ide/stores
'
;
import
router
from
'
~
/ide/ide_router
'
;
import
{
resetStore
,
file
}
from
'
../helpers
'
;
describe
(
'
Multi-file store actions
'
,
()
=>
{
...
...
spec/javascripts/ide/stores/getters_spec.js
View file @
af22ddaf
import
*
as
getters
from
'
ee
/ide/stores/getters
'
;
import
state
from
'
ee
/ide/stores/state
'
;
import
*
as
getters
from
'
~
/ide/stores/getters
'
;
import
state
from
'
~
/ide/stores/state
'
;
import
{
file
}
from
'
../helpers
'
;
describe
(
'
Multi-file store getters
'
,
()
=>
{
...
...
spec/javascripts/ide/stores/modules/commit/actions_spec.js
View file @
af22ddaf
This diff is collapsed.
Click to expand it.
spec/javascripts/ide/stores/modules/commit/getters_spec.js
View file @
af22ddaf
import
commitState
from
'
ee
/ide/stores/modules/commit/state
'
;
import
*
as
consts
from
'
ee
/ide/stores/modules/commit/constants
'
;
import
*
as
getters
from
'
ee
/ide/stores/modules/commit/getters
'
;
import
commitState
from
'
~
/ide/stores/modules/commit/state
'
;
import
*
as
consts
from
'
~
/ide/stores/modules/commit/constants
'
;
import
*
as
getters
from
'
~
/ide/stores/modules/commit/getters
'
;
describe
(
'
IDE commit module getters
'
,
()
=>
{
let
state
;
...
...
@@ -38,26 +38,34 @@ describe('IDE commit module getters', () => {
};
it
(
'
returns false when discardDraftButtonDisabled is false & changedFiles is not empty
'
,
()
=>
{
expect
(
getters
.
commitButtonDisabled
(
state
,
localGetters
,
rootState
)).
toBeFalsy
();
expect
(
getters
.
commitButtonDisabled
(
state
,
localGetters
,
rootState
),
).
toBeFalsy
();
});
it
(
'
returns true when discardDraftButtonDisabled is false & changedFiles is empty
'
,
()
=>
{
rootState
.
changedFiles
.
length
=
0
;
expect
(
getters
.
commitButtonDisabled
(
state
,
localGetters
,
rootState
)).
toBeTruthy
();
expect
(
getters
.
commitButtonDisabled
(
state
,
localGetters
,
rootState
),
).
toBeTruthy
();
});
it
(
'
returns true when discardDraftButtonDisabled is true
'
,
()
=>
{
localGetters
.
discardDraftButtonDisabled
=
true
;
expect
(
getters
.
commitButtonDisabled
(
state
,
localGetters
,
rootState
)).
toBeTruthy
();
expect
(
getters
.
commitButtonDisabled
(
state
,
localGetters
,
rootState
),
).
toBeTruthy
();
});
it
(
'
returns true when discardDraftButtonDisabled is false & changedFiles is not empty
'
,
()
=>
{
localGetters
.
discardDraftButtonDisabled
=
false
;
rootState
.
changedFiles
.
length
=
0
;
expect
(
getters
.
commitButtonDisabled
(
state
,
localGetters
,
rootState
)).
toBeTruthy
();
expect
(
getters
.
commitButtonDisabled
(
state
,
localGetters
,
rootState
),
).
toBeTruthy
();
});
});
...
...
@@ -65,7 +73,9 @@ describe('IDE commit module getters', () => {
it
(
'
includes username, currentBranchId, patch & random number
'
,
()
=>
{
gon
.
current_username
=
'
username
'
;
const
branch
=
getters
.
newBranchName
(
state
,
null
,
{
currentBranchId
:
'
testing
'
});
const
branch
=
getters
.
newBranchName
(
state
,
null
,
{
currentBranchId
:
'
testing
'
,
});
expect
(
branch
).
toMatch
(
/username-testing-patch-
\d{5}
$/
);
});
...
...
@@ -89,7 +99,7 @@ describe('IDE commit module getters', () => {
expect
(
getters
.
branchName
(
state
,
null
,
rootState
)).
toBe
(
'
master
'
);
});
[
'
COMMIT_TO_NEW_BRANCH
'
,
'
COMMIT_TO_NEW_BRANCH_MR
'
].
forEach
(
(
type
)
=>
{
[
'
COMMIT_TO_NEW_BRANCH
'
,
'
COMMIT_TO_NEW_BRANCH_MR
'
].
forEach
(
type
=>
{
describe
(
type
,
()
=>
{
beforeEach
(()
=>
{
Object
.
assign
(
state
,
{
...
...
@@ -98,7 +108,9 @@ describe('IDE commit module getters', () => {
});
it
(
'
uses newBranchName when not empty
'
,
()
=>
{
expect
(
getters
.
branchName
(
state
,
localGetters
,
rootState
)).
toBe
(
'
state-newBranchName
'
);
expect
(
getters
.
branchName
(
state
,
localGetters
,
rootState
)).
toBe
(
'
state-newBranchName
'
,
);
});
it
(
'
uses getters newBranchName when state newBranchName is empty
'
,
()
=>
{
...
...
@@ -106,7 +118,9 @@ describe('IDE commit module getters', () => {
newBranchName
:
''
,
});
expect
(
getters
.
branchName
(
state
,
localGetters
,
rootState
)).
toBe
(
'
newBranchName
'
);
expect
(
getters
.
branchName
(
state
,
localGetters
,
rootState
)).
toBe
(
'
newBranchName
'
,
);
});
});
});
...
...
spec/javascripts/ide/stores/modules/commit/mutations_spec.js
View file @
af22ddaf
import
commitState
from
'
ee
/ide/stores/modules/commit/state
'
;
import
mutations
from
'
ee
/ide/stores/modules/commit/mutations
'
;
import
commitState
from
'
~
/ide/stores/modules/commit/state
'
;
import
mutations
from
'
~
/ide/stores/modules/commit/mutations
'
;
describe
(
'
IDE commit module mutations
'
,
()
=>
{
let
state
;
...
...
spec/javascripts/ide/stores/mutations/branch_spec.js
View file @
af22ddaf
import
mutations
from
'
ee
/ide/stores/mutations/branch
'
;
import
state
from
'
ee
/ide/stores/state
'
;
import
mutations
from
'
~
/ide/stores/mutations/branch
'
;
import
state
from
'
~
/ide/stores/state
'
;
describe
(
'
Multi-file store branch mutations
'
,
()
=>
{
let
localState
;
...
...
spec/javascripts/ide/stores/mutations/file_spec.js
View file @
af22ddaf
import
mutations
from
'
ee
/ide/stores/mutations/file
'
;
import
state
from
'
ee
/ide/stores/state
'
;
import
mutations
from
'
~
/ide/stores/mutations/file
'
;
import
state
from
'
~
/ide/stores/state
'
;
import
{
file
}
from
'
../../helpers
'
;
describe
(
'
Multi-file store file mutations
'
,
()
=>
{
...
...
spec/javascripts/ide/stores/mutations/tree_spec.js
View file @
af22ddaf
import
mutations
from
'
ee
/ide/stores/mutations/tree
'
;
import
state
from
'
ee
/ide/stores/state
'
;
import
mutations
from
'
~
/ide/stores/mutations/tree
'
;
import
state
from
'
~
/ide/stores/state
'
;
import
{
file
}
from
'
../../helpers
'
;
describe
(
'
Multi-file store tree mutations
'
,
()
=>
{
...
...
@@ -26,7 +26,8 @@ describe('Multi-file store tree mutations', () => {
});
describe
(
'
SET_DIRECTORY_DATA
'
,
()
=>
{
const
data
=
[{
const
data
=
[
{
name
:
'
tree
'
,
},
{
...
...
@@ -34,7 +35,8 @@ describe('Multi-file store tree mutations', () => {
},
{
name
:
'
blob
'
,
}];
},
];
it
(
'
adds directory data
'
,
()
=>
{
localState
.
trees
[
'
project/master
'
]
=
{
...
...
spec/javascripts/ide/stores/mutations_spec.js
View file @
af22ddaf
import
mutations
from
'
ee
/ide/stores/mutations
'
;
import
state
from
'
ee
/ide/stores/state
'
;
import
mutations
from
'
~
/ide/stores/mutations
'
;
import
state
from
'
~
/ide/stores/state
'
;
import
{
file
}
from
'
../helpers
'
;
describe
(
'
Multi-file store mutations
'
,
()
=>
{
...
...
spec/javascripts/ide/stores/utils_spec.js
View file @
af22ddaf
import
*
as
utils
from
'
ee
/ide/stores/utils
'
;
import
*
as
utils
from
'
~
/ide/stores/utils
'
;
describe
(
'
Multi-file store utils
'
,
()
=>
{
describe
(
'
setPageTitle
'
,
()
=>
{
...
...
@@ -13,11 +13,14 @@ describe('Multi-file store utils', () => {
let
localState
;
beforeEach
(()
=>
{
localState
=
[{
localState
=
[
{
path
:
'
1
'
,
},
{
},
{
path
:
'
2
'
,
}];
},
];
});
it
(
'
finds in the index of an entry by path
'
,
()
=>
{
...
...
@@ -34,13 +37,16 @@ describe('Multi-file store utils', () => {
beforeEach
(()
=>
{
localState
=
{
tree
:
[{
tree
:
[
{
type
:
'
tree
'
,
name
:
'
test
'
,
},
{
},
{
type
:
'
blob
'
,
name
:
'
file
'
,
}],
},
],
};
});
...
...
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