summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2018-06-12 11:46:00 +0100
committerPhil Hughes <me@iamphill.com>2018-06-12 11:46:00 +0100
commit00ced96c53f320240126f6497e75488eca81e973 (patch)
treed91d19dd6f765b2695dbaa488e1c5eb993cb1431 /spec
parente1ec70cf8e4ca7964eb12e6d1a911285c57a3892 (diff)
downloadgitlab-ce-00ced96c53f320240126f6497e75488eca81e973.tar.gz
added specs for is-active class
added spec for openPendingTab in component
Diffstat (limited to 'spec')
-rw-r--r--spec/javascripts/ide/components/commit_sidebar/list_item_spec.js16
-rw-r--r--spec/javascripts/ide/components/repo_commit_section_spec.js9
2 files changed, 25 insertions, 0 deletions
diff --git a/spec/javascripts/ide/components/commit_sidebar/list_item_spec.js b/spec/javascripts/ide/components/commit_sidebar/list_item_spec.js
index a732028158e..8f7cf24c22f 100644
--- a/spec/javascripts/ide/components/commit_sidebar/list_item_spec.js
+++ b/spec/javascripts/ide/components/commit_sidebar/list_item_spec.js
@@ -90,4 +90,20 @@ describe('Multi-file editor commit sidebar list item', () => {
});
});
});
+
+ describe('is active', () => {
+ it('does not add active class when dont keys match', () => {
+ expect(vm.$el.classList).not.toContain('is-active');
+ });
+
+ it('adds active class when keys match', done => {
+ vm.keyPrefix = 'staged';
+
+ vm.$nextTick(() => {
+ expect(vm.$el.classList).toContain('is-active');
+
+ done();
+ });
+ });
+ });
});
diff --git a/spec/javascripts/ide/components/repo_commit_section_spec.js b/spec/javascripts/ide/components/repo_commit_section_spec.js
index 0934c239a8e..de00a372ed4 100644
--- a/spec/javascripts/ide/components/repo_commit_section_spec.js
+++ b/spec/javascripts/ide/components/repo_commit_section_spec.js
@@ -56,6 +56,8 @@ describe('RepoCommitSection', () => {
vm.$store.state.entries[f.path] = f;
});
+ spyOn(vm, 'openPendingTab').and.callThrough();
+
return vm.$mount();
}
@@ -177,5 +179,12 @@ describe('RepoCommitSection', () => {
expect(store.state.openFiles.length).toBe(1);
expect(store.state.openFiles[0].pending).toBe(true);
});
+
+ it('calls openPendingTab', () => {
+ expect(vm.openPendingTab).toHaveBeenCalledWith({
+ file: vm.lastOpenedFile,
+ keyPrefix: 'unstaged',
+ });
+ });
});
});