summaryrefslogtreecommitdiff
path: root/spec/javascripts/notes
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2017-08-09 14:38:21 +0100
committerFilipa Lacerda <filipa@gitlab.com>2017-08-09 14:38:21 +0100
commit02c66dadaec447d9e031d4370f95a14b51186c42 (patch)
treedb6bd1a5494de13c6a9c7f121f01889d4caaa395 /spec/javascripts/notes
parent18091353f4055fb8e7e9fb0839bcb941e7ba79fa (diff)
downloadgitlab-ce-02c66dadaec447d9e031d4370f95a14b51186c42.tar.gz
[ci skip] Adds unit tests for issue_note_signed_out_widget component
Diffstat (limited to 'spec/javascripts/notes')
-rw-r--r--spec/javascripts/notes/components/issue_note_signed_out_widget_spec.js30
1 files changed, 29 insertions, 1 deletions
diff --git a/spec/javascripts/notes/components/issue_note_signed_out_widget_spec.js b/spec/javascripts/notes/components/issue_note_signed_out_widget_spec.js
index f7fe500c853..f20d9ce9268 100644
--- a/spec/javascripts/notes/components/issue_note_signed_out_widget_spec.js
+++ b/spec/javascripts/notes/components/issue_note_signed_out_widget_spec.js
@@ -1,9 +1,37 @@
+import Vue from 'vue';
+import issueNoteSignedOut from '~/notes/components/issue_note_signed_out_widget.vue';
+import store from '~/notes/stores';
+import { notesDataMock } from '../mock_data';
+
describe('issue_note_signed_out_widget component', () => {
- it('should render sign in link provided in the store', () => {
+ let vm;
+
+ beforeEach(() => {
+ const Component = Vue.extend(issueNoteSignedOut);
+ store.dispatch('setNotesData', notesDataMock);
+
+ vm = new Component({
+ store,
+ }).$mount();
+ });
+ afterEach(() => {
+ vm.$destroy();
+ });
+
+ it('should render sign in link provided in the store', () => {
+ expect(
+ vm.$el.querySelector(`a[href="${notesDataMock.newSessionPath}"]`).textContent,
+ ).toEqual('sign in');
});
it('should render register link provided in the store', () => {
+ expect(
+ vm.$el.querySelector(`a[href="${notesDataMock.registerPath}"]`).textContent,
+ ).toEqual('register');
+ });
+ it('should render information text', () => {
+ expect(vm.$el.textContent.replace(/\s+/g, ' ').trim()).toEqual('Please register or sign in to reply');
});
});