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
Léo-Paul Géneau
gitlab-ce
Commits
f489fa2a
Commit
f489fa2a
authored
Apr 27, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed karma specs
parent
eeb41af7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
54 deletions
+21
-54
spec/javascripts/ide/components/repo_commit_section_spec.js
spec/javascripts/ide/components/repo_commit_section_spec.js
+12
-27
spec/javascripts/ide/stores/mutations/file_spec.js
spec/javascripts/ide/stores/mutations/file_spec.js
+9
-27
No files found.
spec/javascripts/ide/components/repo_commit_section_spec.js
View file @
f489fa2a
...
@@ -3,7 +3,6 @@ import store from '~/ide/stores';
...
@@ -3,7 +3,6 @@ import store from '~/ide/stores';
import
service
from
'
~/ide/services
'
;
import
service
from
'
~/ide/services
'
;
import
repoCommitSection
from
'
~/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
{
file
,
resetStore
}
from
'
../helpers
'
;
import
{
file
,
resetStore
}
from
'
../helpers
'
;
describe
(
'
RepoCommitSection
'
,
()
=>
{
describe
(
'
RepoCommitSection
'
,
()
=>
{
...
@@ -105,30 +104,28 @@ describe('RepoCommitSection', () => {
...
@@ -105,30 +104,28 @@ describe('RepoCommitSection', () => {
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
allFiles
=
vm
.
$store
.
state
.
changedFiles
.
concat
(
vm
.
$store
.
state
.
stagedFiles
);
const
allFiles
=
vm
.
$store
.
state
.
changedFiles
.
concat
(
vm
.
$store
.
state
.
stagedFiles
);
expect
(
vm
.
$el
.
querySelector
(
'
.multi-file-commit-form
'
)).
not
.
toBeNull
();
expect
(
changedFileElements
.
length
).
toEqual
(
4
);
expect
(
changedFileElements
.
length
).
toEqual
(
4
);
changedFileElements
.
forEach
((
changedFile
,
i
)
=>
{
changedFileElements
.
forEach
((
changedFile
,
i
)
=>
{
expect
(
changedFile
.
textContent
.
trim
()).
toContain
(
allFiles
[
i
].
path
);
expect
(
changedFile
.
textContent
.
trim
()).
toContain
(
allFiles
[
i
].
path
);
});
});
expect
(
submitCommit
.
disabled
).
toBeTruthy
();
expect
(
submitCommit
.
querySelector
(
'
.fa-spinner.fa-spin
'
)).
toBeNull
();
});
});
it
(
'
adds changed files into staged files
'
,
done
=>
{
it
(
'
adds changed files into staged files
'
,
done
=>
{
vm
.
$el
.
querySelector
(
'
.ide-staged-action-btn
'
).
click
();
vm
.
$el
.
querySelector
(
'
.multi-file-discard-btn .btn
'
).
click
();
vm
Vue
.
nextTick
(()
=>
{
.
$nextTick
()
expect
(
vm
.
$el
.
querySelector
(
'
.ide-commit-list-container
'
).
textContent
).
toContain
(
.
then
(()
=>
vm
.
$el
.
querySelector
(
'
.multi-file-discard-btn .btn
'
).
click
())
'
No changes
'
,
.
then
(
vm
.
$nextTick
)
);
.
then
(()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.ide-commit-list-container
'
).
textContent
).
toContain
(
done
();
'
No changes
'
,
});
);
})
.
then
(
done
)
.
catch
(
done
.
fail
);
});
});
it
(
'
stages a single file
'
,
done
=>
{
it
(
'
stages a single file
'
,
done
=>
{
...
@@ -156,18 +153,6 @@ describe('RepoCommitSection', () => {
...
@@ -156,18 +153,6 @@ describe('RepoCommitSection', () => {
});
});
});
});
it
(
'
removes all staged files
'
,
done
=>
{
vm
.
$el
.
querySelectorAll
(
'
.ide-staged-action-btn
'
)[
1
].
click
();
Vue
.
nextTick
(()
=>
{
expect
(
vm
.
$el
.
querySelectorAll
(
'
.ide-commit-list-container
'
)[
1
].
textContent
).
toContain
(
'
No changes
'
,
);
done
();
});
});
it
(
'
unstages a single file
'
,
done
=>
{
it
(
'
unstages a single file
'
,
done
=>
{
vm
.
$el
vm
.
$el
.
querySelectorAll
(
'
.multi-file-discard-btn
'
)[
2
]
.
querySelectorAll
(
'
.multi-file-discard-btn
'
)[
2
]
...
...
spec/javascripts/ide/stores/mutations/file_spec.js
View file @
f489fa2a
...
@@ -267,41 +267,23 @@ describe('IDE store file mutations', () => {
...
@@ -267,41 +267,23 @@ describe('IDE store file mutations', () => {
it
(
'
adds file into openFiles as pending
'
,
()
=>
{
it
(
'
adds file into openFiles as pending
'
,
()
=>
{
mutations
.
ADD_PENDING_TAB
(
localState
,
{
file
:
localFile
});
mutations
.
ADD_PENDING_TAB
(
localState
,
{
file
:
localFile
});
expect
(
localState
.
openFiles
.
length
).
toBe
(
2
);
expect
(
localState
.
openFiles
[
1
].
pending
).
toBe
(
true
);
expect
(
localState
.
openFiles
[
1
].
key
).
toBe
(
`pending-
${
localFile
.
key
}
`
);
});
it
(
'
updates open file to pending
'
,
()
=>
{
mutations
.
ADD_PENDING_TAB
(
localState
,
{
file
:
localState
.
openFiles
[
0
]
});
expect
(
localState
.
openFiles
.
length
).
toBe
(
1
);
expect
(
localState
.
openFiles
.
length
).
toBe
(
1
);
expect
(
localState
.
openFiles
[
0
].
pending
).
toBe
(
true
);
expect
(
localState
.
openFiles
[
0
].
key
).
toBe
(
`pending-
${
localFile
.
key
}
`
);
});
});
it
(
'
updates pending open file to active
'
,
()
=>
{
it
(
'
only allows 1 open pending file
'
,
()
=>
{
localState
.
openFiles
.
push
({
const
newFile
=
file
(
'
test
'
);
...
localFile
,
localState
.
entries
[
newFile
.
path
]
=
newFile
;
pending
:
true
,
});
mutations
.
ADD_PENDING_TAB
(
localState
,
{
file
:
localFile
});
mutations
.
ADD_PENDING_TAB
(
localState
,
{
file
:
localFile
});
expect
(
localState
.
openFiles
[
1
].
pending
).
toBe
(
true
);
expect
(
localState
.
openFiles
.
length
).
toBe
(
1
);
expect
(
localState
.
openFiles
[
1
].
active
).
toBe
(
true
);
});
it
(
'
sets all openFiles to not active
'
,
()
=>
{
mutations
.
ADD_PENDING_TAB
(
localState
,
{
file
:
localFile
});
expect
(
localState
.
openFiles
.
length
).
toBe
(
2
);
mutations
.
ADD_PENDING_TAB
(
localState
,
{
file
:
file
(
'
test
'
)
}
);
localState
.
openFiles
.
forEach
(
f
=>
{
expect
(
localState
.
openFiles
.
length
).
toBe
(
1
);
if
(
f
.
pending
)
{
expect
(
localState
.
openFiles
[
0
].
name
).
toBe
(
'
test
'
);
expect
(
f
.
active
).
toBe
(
true
);
}
else
{
expect
(
f
.
active
).
toBe
(
false
);
}
});
});
});
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment