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