diff options
Diffstat (limited to 'spec/javascripts/pages')
9 files changed, 0 insertions, 806 deletions
diff --git a/spec/javascripts/pages/admin/application_settings/account_and_limits_spec.js b/spec/javascripts/pages/admin/application_settings/account_and_limits_spec.js deleted file mode 100644 index 6a239e307e9..00000000000 --- a/spec/javascripts/pages/admin/application_settings/account_and_limits_spec.js +++ /dev/null @@ -1,36 +0,0 @@ -import $ from 'jquery'; -import initUserInternalRegexPlaceholder, { - PLACEHOLDER_USER_EXTERNAL_DEFAULT_FALSE, - PLACEHOLDER_USER_EXTERNAL_DEFAULT_TRUE, -} from '~/pages/admin/application_settings/account_and_limits'; - -describe('AccountAndLimits', () => { - const FIXTURE = 'application_settings/accounts_and_limit.html'; - let $userDefaultExternal; - let $userInternalRegex; - preloadFixtures(FIXTURE); - - beforeEach(() => { - loadFixtures(FIXTURE); - initUserInternalRegexPlaceholder(); - $userDefaultExternal = $('#application_setting_user_default_external'); - $userInternalRegex = document.querySelector('#application_setting_user_default_internal_regex'); - }); - - describe('Changing of userInternalRegex when userDefaultExternal', () => { - it('is unchecked', () => { - expect($userDefaultExternal.prop('checked')).toBeFalsy(); - expect($userInternalRegex.placeholder).toEqual(PLACEHOLDER_USER_EXTERNAL_DEFAULT_FALSE); - expect($userInternalRegex.readOnly).toBeTruthy(); - }); - - it('is checked', done => { - if (!$userDefaultExternal.prop('checked')) $userDefaultExternal.click(); - - expect($userDefaultExternal.prop('checked')).toBeTruthy(); - expect($userInternalRegex.placeholder).toEqual(PLACEHOLDER_USER_EXTERNAL_DEFAULT_TRUE); - expect($userInternalRegex.readOnly).toBeFalsy(); - done(); - }); - }); -}); diff --git a/spec/javascripts/pages/admin/jobs/index/components/stop_jobs_modal_spec.js b/spec/javascripts/pages/admin/jobs/index/components/stop_jobs_modal_spec.js deleted file mode 100644 index 9ad72e0b043..00000000000 --- a/spec/javascripts/pages/admin/jobs/index/components/stop_jobs_modal_spec.js +++ /dev/null @@ -1,61 +0,0 @@ -import Vue from 'vue'; - -import mountComponent from 'spec/helpers/vue_mount_component_helper'; -import axios from '~/lib/utils/axios_utils'; -import stopJobsModal from '~/pages/admin/jobs/index/components/stop_jobs_modal.vue'; - -describe('stop_jobs_modal.vue', () => { - const props = { - url: `${gl.TEST_HOST}/stop_jobs_modal.vue/stopAll`, - }; - let vm; - - afterEach(() => { - vm.$destroy(); - }); - - beforeEach(() => { - const Component = Vue.extend(stopJobsModal); - vm = mountComponent(Component, props); - }); - - describe('onSubmit', () => { - it('stops jobs and redirects to overview page', done => { - const responseURL = `${gl.TEST_HOST}/stop_jobs_modal.vue/jobs`; - const redirectSpy = spyOnDependency(stopJobsModal, 'redirectTo'); - spyOn(axios, 'post').and.callFake(url => { - expect(url).toBe(props.url); - return Promise.resolve({ - request: { - responseURL, - }, - }); - }); - - vm.onSubmit() - .then(() => { - expect(redirectSpy).toHaveBeenCalledWith(responseURL); - }) - .then(done) - .catch(done.fail); - }); - - it('displays error if stopping jobs failed', done => { - const dummyError = new Error('stopping jobs failed'); - const redirectSpy = spyOnDependency(stopJobsModal, 'redirectTo'); - spyOn(axios, 'post').and.callFake(url => { - expect(url).toBe(props.url); - return Promise.reject(dummyError); - }); - - vm.onSubmit() - .then(done.fail) - .catch(error => { - expect(error).toBe(dummyError); - expect(redirectSpy).not.toHaveBeenCalled(); - }) - .then(done) - .catch(done.fail); - }); - }); -}); diff --git a/spec/javascripts/pages/admin/users/new/index_spec.js b/spec/javascripts/pages/admin/users/new/index_spec.js deleted file mode 100644 index 3896323eef7..00000000000 --- a/spec/javascripts/pages/admin/users/new/index_spec.js +++ /dev/null @@ -1,43 +0,0 @@ -import $ from 'jquery'; -import UserInternalRegexHandler from '~/pages/admin/users/new/index'; - -describe('UserInternalRegexHandler', () => { - const FIXTURE = 'admin/users/new_with_internal_user_regex.html'; - let $userExternal; - let $userEmail; - let $warningMessage; - - preloadFixtures(FIXTURE); - - beforeEach(() => { - loadFixtures(FIXTURE); - // eslint-disable-next-line no-new - new UserInternalRegexHandler(); - $userExternal = $('#user_external'); - $userEmail = $('#user_email'); - $warningMessage = $('#warning_external_automatically_set'); - if (!$userExternal.prop('checked')) $userExternal.prop('checked', 'checked'); - }); - - describe('Behaviour of userExternal checkbox when', () => { - it('matches email as internal', done => { - expect($warningMessage.hasClass('hidden')).toBeTruthy(); - - $userEmail.val('test@').trigger('input'); - - expect($userExternal.prop('checked')).toBeFalsy(); - expect($warningMessage.hasClass('hidden')).toBeFalsy(); - done(); - }); - - it('matches email as external', done => { - expect($warningMessage.hasClass('hidden')).toBeTruthy(); - - $userEmail.val('test.ext@').trigger('input'); - - expect($userExternal.prop('checked')).toBeTruthy(); - expect($warningMessage.hasClass('hidden')).toBeTruthy(); - done(); - }); - }); -}); diff --git a/spec/javascripts/pages/labels/components/promote_label_modal_spec.js b/spec/javascripts/pages/labels/components/promote_label_modal_spec.js deleted file mode 100644 index 5bad13c1ef2..00000000000 --- a/spec/javascripts/pages/labels/components/promote_label_modal_spec.js +++ /dev/null @@ -1,103 +0,0 @@ -import Vue from 'vue'; -import mountComponent from 'spec/helpers/vue_mount_component_helper'; -import promoteLabelModal from '~/pages/projects/labels/components/promote_label_modal.vue'; -import eventHub from '~/pages/projects/labels/event_hub'; -import axios from '~/lib/utils/axios_utils'; - -describe('Promote label modal', () => { - let vm; - const Component = Vue.extend(promoteLabelModal); - const labelMockData = { - labelTitle: 'Documentation', - labelColor: '#5cb85c', - labelTextColor: '#ffffff', - url: `${gl.TEST_HOST}/dummy/promote/labels`, - groupName: 'group', - }; - - describe('Modal title and description', () => { - beforeEach(() => { - vm = mountComponent(Component, labelMockData); - }); - - afterEach(() => { - vm.$destroy(); - }); - - it('contains the proper description', () => { - expect(vm.text).toContain( - `Promoting ${labelMockData.labelTitle} will make it available for all projects inside ${labelMockData.groupName}`, - ); - }); - - it('contains a label span with the color', () => { - const labelFromTitle = vm.$el.querySelector('.modal-header .label.color-label'); - - expect(labelFromTitle.style.backgroundColor).not.toBe(null); - expect(labelFromTitle.textContent).toContain(vm.labelTitle); - }); - }); - - describe('When requesting a label promotion', () => { - beforeEach(() => { - vm = mountComponent(Component, { - ...labelMockData, - }); - spyOn(eventHub, '$emit'); - }); - - afterEach(() => { - vm.$destroy(); - }); - - it('redirects when a label is promoted', done => { - const responseURL = `${gl.TEST_HOST}/dummy/endpoint`; - spyOn(axios, 'post').and.callFake(url => { - expect(url).toBe(labelMockData.url); - expect(eventHub.$emit).toHaveBeenCalledWith( - 'promoteLabelModal.requestStarted', - labelMockData.url, - ); - return Promise.resolve({ - request: { - responseURL, - }, - }); - }); - - vm.onSubmit() - .then(() => { - expect(eventHub.$emit).toHaveBeenCalledWith('promoteLabelModal.requestFinished', { - labelUrl: labelMockData.url, - successful: true, - }); - }) - .then(done) - .catch(done.fail); - }); - - it('displays an error if promoting a label failed', done => { - const dummyError = new Error('promoting label failed'); - dummyError.response = { status: 500 }; - spyOn(axios, 'post').and.callFake(url => { - expect(url).toBe(labelMockData.url); - expect(eventHub.$emit).toHaveBeenCalledWith( - 'promoteLabelModal.requestStarted', - labelMockData.url, - ); - return Promise.reject(dummyError); - }); - - vm.onSubmit() - .catch(error => { - expect(error).toBe(dummyError); - expect(eventHub.$emit).toHaveBeenCalledWith('promoteLabelModal.requestFinished', { - labelUrl: labelMockData.url, - successful: false, - }); - }) - .then(done) - .catch(done.fail); - }); - }); -}); diff --git a/spec/javascripts/pages/milestones/shared/components/delete_milestone_modal_spec.js b/spec/javascripts/pages/milestones/shared/components/delete_milestone_modal_spec.js deleted file mode 100644 index 9075c8aa97a..00000000000 --- a/spec/javascripts/pages/milestones/shared/components/delete_milestone_modal_spec.js +++ /dev/null @@ -1,106 +0,0 @@ -import Vue from 'vue'; - -import mountComponent from 'spec/helpers/vue_mount_component_helper'; -import axios from '~/lib/utils/axios_utils'; -import deleteMilestoneModal from '~/pages/milestones/shared/components/delete_milestone_modal.vue'; -import eventHub from '~/pages/milestones/shared/event_hub'; - -describe('delete_milestone_modal.vue', () => { - const Component = Vue.extend(deleteMilestoneModal); - const props = { - issueCount: 1, - mergeRequestCount: 2, - milestoneId: 3, - milestoneTitle: 'my milestone title', - milestoneUrl: `${gl.TEST_HOST}/delete_milestone_modal.vue/milestone`, - }; - let vm; - - afterEach(() => { - vm.$destroy(); - }); - - describe('onSubmit', () => { - beforeEach(() => { - vm = mountComponent(Component, props); - spyOn(eventHub, '$emit'); - }); - - it('deletes milestone and redirects to overview page', done => { - const responseURL = `${gl.TEST_HOST}/delete_milestone_modal.vue/milestoneOverview`; - spyOn(axios, 'delete').and.callFake(url => { - expect(url).toBe(props.milestoneUrl); - expect(eventHub.$emit).toHaveBeenCalledWith( - 'deleteMilestoneModal.requestStarted', - props.milestoneUrl, - ); - eventHub.$emit.calls.reset(); - return Promise.resolve({ - request: { - responseURL, - }, - }); - }); - const redirectSpy = spyOnDependency(deleteMilestoneModal, 'redirectTo'); - - vm.onSubmit() - .then(() => { - expect(redirectSpy).toHaveBeenCalledWith(responseURL); - expect(eventHub.$emit).toHaveBeenCalledWith('deleteMilestoneModal.requestFinished', { - milestoneUrl: props.milestoneUrl, - successful: true, - }); - }) - .then(done) - .catch(done.fail); - }); - - it('displays error if deleting milestone failed', done => { - const dummyError = new Error('deleting milestone failed'); - dummyError.response = { status: 418 }; - spyOn(axios, 'delete').and.callFake(url => { - expect(url).toBe(props.milestoneUrl); - expect(eventHub.$emit).toHaveBeenCalledWith( - 'deleteMilestoneModal.requestStarted', - props.milestoneUrl, - ); - eventHub.$emit.calls.reset(); - return Promise.reject(dummyError); - }); - const redirectSpy = spyOnDependency(deleteMilestoneModal, 'redirectTo'); - - vm.onSubmit() - .catch(error => { - expect(error).toBe(dummyError); - expect(redirectSpy).not.toHaveBeenCalled(); - expect(eventHub.$emit).toHaveBeenCalledWith('deleteMilestoneModal.requestFinished', { - milestoneUrl: props.milestoneUrl, - successful: false, - }); - }) - .then(done) - .catch(done.fail); - }); - }); - - describe('text', () => { - it('contains the issue and milestone count', () => { - vm = mountComponent(Component, props); - const value = vm.text; - - expect(value).toContain('remove it from 1 issue and 2 merge requests'); - }); - - it('contains neither issue nor milestone count', () => { - vm = mountComponent(Component, { - ...props, - issueCount: 0, - mergeRequestCount: 0, - }); - - const value = vm.text; - - expect(value).toContain('is not currently used'); - }); - }); -}); diff --git a/spec/javascripts/pages/milestones/shared/components/promote_milestone_modal_spec.js b/spec/javascripts/pages/milestones/shared/components/promote_milestone_modal_spec.js deleted file mode 100644 index 78c0070187c..00000000000 --- a/spec/javascripts/pages/milestones/shared/components/promote_milestone_modal_spec.js +++ /dev/null @@ -1,98 +0,0 @@ -import Vue from 'vue'; -import mountComponent from 'spec/helpers/vue_mount_component_helper'; -import promoteMilestoneModal from '~/pages/milestones/shared/components/promote_milestone_modal.vue'; -import eventHub from '~/pages/milestones/shared/event_hub'; -import axios from '~/lib/utils/axios_utils'; - -describe('Promote milestone modal', () => { - let vm; - const Component = Vue.extend(promoteMilestoneModal); - const milestoneMockData = { - milestoneTitle: 'v1.0', - url: `${gl.TEST_HOST}/dummy/promote/milestones`, - groupName: 'group', - }; - - describe('Modal title and description', () => { - beforeEach(() => { - vm = mountComponent(Component, milestoneMockData); - }); - - afterEach(() => { - vm.$destroy(); - }); - - it('contains the proper description', () => { - expect(vm.text).toContain( - `Promoting ${milestoneMockData.milestoneTitle} will make it available for all projects inside ${milestoneMockData.groupName}.`, - ); - }); - - it('contains the correct title', () => { - expect(vm.title).toEqual('Promote v1.0 to group milestone?'); - }); - }); - - describe('When requesting a milestone promotion', () => { - beforeEach(() => { - vm = mountComponent(Component, { - ...milestoneMockData, - }); - spyOn(eventHub, '$emit'); - }); - - afterEach(() => { - vm.$destroy(); - }); - - it('redirects when a milestone is promoted', done => { - const responseURL = `${gl.TEST_HOST}/dummy/endpoint`; - spyOn(axios, 'post').and.callFake(url => { - expect(url).toBe(milestoneMockData.url); - expect(eventHub.$emit).toHaveBeenCalledWith( - 'promoteMilestoneModal.requestStarted', - milestoneMockData.url, - ); - return Promise.resolve({ - request: { - responseURL, - }, - }); - }); - - vm.onSubmit() - .then(() => { - expect(eventHub.$emit).toHaveBeenCalledWith('promoteMilestoneModal.requestFinished', { - milestoneUrl: milestoneMockData.url, - successful: true, - }); - }) - .then(done) - .catch(done.fail); - }); - - it('displays an error if promoting a milestone failed', done => { - const dummyError = new Error('promoting milestone failed'); - dummyError.response = { status: 500 }; - spyOn(axios, 'post').and.callFake(url => { - expect(url).toBe(milestoneMockData.url); - expect(eventHub.$emit).toHaveBeenCalledWith( - 'promoteMilestoneModal.requestStarted', - milestoneMockData.url, - ); - return Promise.reject(dummyError); - }); - - vm.onSubmit() - .catch(error => { - expect(error).toBe(dummyError); - expect(eventHub.$emit).toHaveBeenCalledWith('promoteMilestoneModal.requestFinished', { - milestoneUrl: milestoneMockData.url, - successful: false, - }); - }) - .then(done) - .catch(done.fail); - }); - }); -}); diff --git a/spec/javascripts/pages/projects/pipeline_schedules/shared/components/interval_pattern_input_spec.js b/spec/javascripts/pages/projects/pipeline_schedules/shared/components/interval_pattern_input_spec.js deleted file mode 100644 index b20bc96f9be..00000000000 --- a/spec/javascripts/pages/projects/pipeline_schedules/shared/components/interval_pattern_input_spec.js +++ /dev/null @@ -1,192 +0,0 @@ -import Vue from 'vue'; -import Translate from '~/vue_shared/translate'; -import IntervalPatternInput from '~/pages/projects/pipeline_schedules/shared/components/interval_pattern_input.vue'; - -Vue.use(Translate); - -const IntervalPatternInputComponent = Vue.extend(IntervalPatternInput); -const inputNameAttribute = 'schedule[cron]'; - -const cronIntervalPresets = { - everyDay: '0 4 * * *', - everyWeek: '0 4 * * 0', - everyMonth: '0 4 1 * *', -}; - -window.gl = window.gl || {}; - -window.gl.pipelineScheduleFieldErrors = { - updateFormValidityState: () => {}, -}; - -describe('Interval Pattern Input Component', function() { - describe('when prop initialCronInterval is passed (edit)', function() { - describe('when prop initialCronInterval is custom', function() { - beforeEach(function() { - this.initialCronInterval = '1 2 3 4 5'; - this.intervalPatternComponent = new IntervalPatternInputComponent({ - propsData: { - initialCronInterval: this.initialCronInterval, - }, - }).$mount(); - }); - - it('is initialized as a Vue component', function() { - expect(this.intervalPatternComponent).toBeDefined(); - }); - - it('prop initialCronInterval is set', function() { - expect(this.intervalPatternComponent.initialCronInterval).toBe(this.initialCronInterval); - }); - - it('sets isEditable to true', function(done) { - Vue.nextTick(() => { - expect(this.intervalPatternComponent.isEditable).toBe(true); - done(); - }); - }); - }); - - describe('when prop initialCronInterval is preset', function() { - beforeEach(function() { - this.intervalPatternComponent = new IntervalPatternInputComponent({ - propsData: { - inputNameAttribute, - initialCronInterval: '0 4 * * *', - }, - }).$mount(); - }); - - it('is initialized as a Vue component', function() { - expect(this.intervalPatternComponent).toBeDefined(); - }); - - it('sets isEditable to false', function(done) { - Vue.nextTick(() => { - expect(this.intervalPatternComponent.isEditable).toBe(false); - done(); - }); - }); - }); - }); - - describe('when prop initialCronInterval is not passed (new)', function() { - beforeEach(function() { - this.intervalPatternComponent = new IntervalPatternInputComponent({ - propsData: { - inputNameAttribute, - }, - }).$mount(); - }); - - it('is initialized as a Vue component', function() { - expect(this.intervalPatternComponent).toBeDefined(); - }); - - it('prop initialCronInterval is set', function() { - const defaultInitialCronInterval = ''; - - expect(this.intervalPatternComponent.initialCronInterval).toBe(defaultInitialCronInterval); - }); - - it('sets isEditable to true', function(done) { - Vue.nextTick(() => { - expect(this.intervalPatternComponent.isEditable).toBe(true); - done(); - }); - }); - }); - - describe('User Actions', function() { - beforeEach(function() { - // For an unknown reason, some browsers do not propagate click events - // on radio buttons in a way Vue can register. So, we have to mount - // to a fixture. - setFixtures('<div id="my-mount"></div>'); - - this.initialCronInterval = '1 2 3 4 5'; - this.intervalPatternComponent = new IntervalPatternInputComponent({ - propsData: { - initialCronInterval: this.initialCronInterval, - }, - }).$mount('#my-mount'); - }); - - it('cronInterval is updated when everyday preset interval is selected', function(done) { - this.intervalPatternComponent.$el.querySelector('#every-day').click(); - - Vue.nextTick(() => { - expect(this.intervalPatternComponent.cronInterval).toBe(cronIntervalPresets.everyDay); - expect(this.intervalPatternComponent.$el.querySelector('.cron-interval-input').value).toBe( - cronIntervalPresets.everyDay, - ); - done(); - }); - }); - - it('cronInterval is updated when everyweek preset interval is selected', function(done) { - this.intervalPatternComponent.$el.querySelector('#every-week').click(); - - Vue.nextTick(() => { - expect(this.intervalPatternComponent.cronInterval).toBe(cronIntervalPresets.everyWeek); - expect(this.intervalPatternComponent.$el.querySelector('.cron-interval-input').value).toBe( - cronIntervalPresets.everyWeek, - ); - - done(); - }); - }); - - it('cronInterval is updated when everymonth preset interval is selected', function(done) { - this.intervalPatternComponent.$el.querySelector('#every-month').click(); - - Vue.nextTick(() => { - expect(this.intervalPatternComponent.cronInterval).toBe(cronIntervalPresets.everyMonth); - expect(this.intervalPatternComponent.$el.querySelector('.cron-interval-input').value).toBe( - cronIntervalPresets.everyMonth, - ); - done(); - }); - }); - - it('only a space is added to cronInterval (trimmed later) when custom radio is selected', function(done) { - this.intervalPatternComponent.$el.querySelector('#every-month').click(); - this.intervalPatternComponent.$el.querySelector('#custom').click(); - - Vue.nextTick(() => { - const intervalWithSpaceAppended = `${cronIntervalPresets.everyMonth} `; - - expect(this.intervalPatternComponent.cronInterval).toBe(intervalWithSpaceAppended); - expect(this.intervalPatternComponent.$el.querySelector('.cron-interval-input').value).toBe( - intervalWithSpaceAppended, - ); - done(); - }); - }); - - it('text input is disabled when preset interval is selected', function(done) { - this.intervalPatternComponent.$el.querySelector('#every-month').click(); - - Vue.nextTick(() => { - expect(this.intervalPatternComponent.isEditable).toBe(false); - expect( - this.intervalPatternComponent.$el.querySelector('.cron-interval-input').disabled, - ).toBe(true); - done(); - }); - }); - - it('text input is enabled when custom is selected', function(done) { - this.intervalPatternComponent.$el.querySelector('#every-month').click(); - this.intervalPatternComponent.$el.querySelector('#custom').click(); - - Vue.nextTick(() => { - expect(this.intervalPatternComponent.isEditable).toBe(true); - expect( - this.intervalPatternComponent.$el.querySelector('.cron-interval-input').disabled, - ).toBe(false); - done(); - }); - }); - }); -}); diff --git a/spec/javascripts/pages/projects/pipeline_schedules/shared/components/pipeline_schedule_callout_spec.js b/spec/javascripts/pages/projects/pipeline_schedules/shared/components/pipeline_schedule_callout_spec.js deleted file mode 100644 index ea809e1f170..00000000000 --- a/spec/javascripts/pages/projects/pipeline_schedules/shared/components/pipeline_schedule_callout_spec.js +++ /dev/null @@ -1,106 +0,0 @@ -import Vue from 'vue'; -import Cookies from 'js-cookie'; -import PipelineSchedulesCallout from '~/pages/projects/pipeline_schedules/shared/components/pipeline_schedules_callout.vue'; - -const PipelineSchedulesCalloutComponent = Vue.extend(PipelineSchedulesCallout); -const cookieKey = 'pipeline_schedules_callout_dismissed'; -const docsUrl = 'help/ci/scheduled_pipelines'; - -describe('Pipeline Schedule Callout', function() { - beforeEach(() => { - setFixtures(` - <div id='pipeline-schedules-callout' data-docs-url=${docsUrl}></div> - `); - }); - - describe('independent of cookies', () => { - beforeEach(() => { - this.calloutComponent = new PipelineSchedulesCalloutComponent().$mount(); - }); - - it('the component can be initialized', () => { - expect(this.calloutComponent).toBeDefined(); - }); - - it('correctly sets illustrationSvg', () => { - expect(this.calloutComponent.illustrationSvg).toContain('<svg'); - }); - - it('correctly sets docsUrl', () => { - expect(this.calloutComponent.docsUrl).toContain(docsUrl); - }); - }); - - describe(`when ${cookieKey} cookie is set`, () => { - beforeEach(() => { - Cookies.set(cookieKey, true); - this.calloutComponent = new PipelineSchedulesCalloutComponent().$mount(); - }); - - it('correctly sets calloutDismissed to true', () => { - expect(this.calloutComponent.calloutDismissed).toBe(true); - }); - - it('does not render the callout', () => { - expect(this.calloutComponent.$el.childNodes.length).toBe(0); - }); - }); - - describe('when cookie is not set', () => { - beforeEach(() => { - Cookies.remove(cookieKey); - this.calloutComponent = new PipelineSchedulesCalloutComponent().$mount(); - }); - - it('correctly sets calloutDismissed to false', () => { - expect(this.calloutComponent.calloutDismissed).toBe(false); - }); - - it('renders the callout container', () => { - expect(this.calloutComponent.$el.querySelector('.bordered-box')).not.toBeNull(); - }); - - it('renders the callout svg', () => { - expect(this.calloutComponent.$el.outerHTML).toContain('<svg'); - }); - - it('renders the callout title', () => { - expect(this.calloutComponent.$el.outerHTML).toContain('Scheduling Pipelines'); - }); - - it('renders the callout text', () => { - expect(this.calloutComponent.$el.outerHTML).toContain('runs pipelines in the future'); - }); - - it('renders the documentation url', () => { - expect(this.calloutComponent.$el.outerHTML).toContain(docsUrl); - }); - - it('updates calloutDismissed when close button is clicked', done => { - this.calloutComponent.$el.querySelector('#dismiss-callout-btn').click(); - - Vue.nextTick(() => { - expect(this.calloutComponent.calloutDismissed).toBe(true); - done(); - }); - }); - - it('#dismissCallout updates calloutDismissed', done => { - this.calloutComponent.dismissCallout(); - - Vue.nextTick(() => { - expect(this.calloutComponent.calloutDismissed).toBe(true); - done(); - }); - }); - - it('is hidden when close button is clicked', done => { - this.calloutComponent.$el.querySelector('#dismiss-callout-btn').click(); - - Vue.nextTick(() => { - expect(this.calloutComponent.$el.childNodes.length).toBe(0); - done(); - }); - }); - }); -}); diff --git a/spec/javascripts/pages/sessions/new/preserve_url_fragment_spec.js b/spec/javascripts/pages/sessions/new/preserve_url_fragment_spec.js deleted file mode 100644 index 1809e92e1d9..00000000000 --- a/spec/javascripts/pages/sessions/new/preserve_url_fragment_spec.js +++ /dev/null @@ -1,61 +0,0 @@ -import $ from 'jquery'; -import preserveUrlFragment from '~/pages/sessions/new/preserve_url_fragment'; - -describe('preserve_url_fragment', () => { - preloadFixtures('sessions/new.html'); - - beforeEach(() => { - loadFixtures('sessions/new.html'); - }); - - it('adds the url fragment to all login and sign up form actions', () => { - preserveUrlFragment('#L65'); - - expect($('#new_user').attr('action')).toBe('http://test.host/users/sign_in#L65'); - expect($('#new_new_user').attr('action')).toBe('http://test.host/users#L65'); - }); - - it('does not add an empty url fragment to login and sign up form actions', () => { - preserveUrlFragment(); - - expect($('#new_user').attr('action')).toBe('http://test.host/users/sign_in'); - expect($('#new_new_user').attr('action')).toBe('http://test.host/users'); - }); - - it('does not add an empty query parameter to OmniAuth login buttons', () => { - preserveUrlFragment(); - - expect($('#oauth-login-cas3').attr('href')).toBe('http://test.host/users/auth/cas3'); - - expect($('.omniauth-container #oauth-login-auth0').attr('href')).toBe( - 'http://test.host/users/auth/auth0', - ); - }); - - describe('adds "redirect_fragment" query parameter to OmniAuth login buttons', () => { - it('when "remember_me" is not present', () => { - preserveUrlFragment('#L65'); - - expect($('#oauth-login-cas3').attr('href')).toBe( - 'http://test.host/users/auth/cas3?redirect_fragment=L65', - ); - - expect($('.omniauth-container #oauth-login-auth0').attr('href')).toBe( - 'http://test.host/users/auth/auth0?redirect_fragment=L65', - ); - }); - - it('when "remember-me" is present', () => { - $('a.omniauth-btn').attr('href', (i, href) => `${href}?remember_me=1`); - preserveUrlFragment('#L65'); - - expect($('#oauth-login-cas3').attr('href')).toBe( - 'http://test.host/users/auth/cas3?remember_me=1&redirect_fragment=L65', - ); - - expect($('#oauth-login-auth0').attr('href')).toBe( - 'http://test.host/users/auth/auth0?remember_me=1&redirect_fragment=L65', - ); - }); - }); -}); |