diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-25 15:18:56 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-25 15:18:56 +0300 |
commit | d2d913b606702ecefa01f03362602fde256e3f75 (patch) | |
tree | 07643306ee63f789188a9133823aac3c92c94dfb /spec/frontend/vue_shared | |
parent | af69e63b6655a450849a8fa2640ae6ce5a8db681 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/vue_shared')
10 files changed, 35 insertions, 2 deletions
diff --git a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/base_token_spec.js b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/base_token_spec.js index f115ec2d6ca..d87aa3194d2 100644 --- a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/base_token_spec.js +++ b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/base_token_spec.js @@ -99,6 +99,7 @@ function createComponent({ portalName: 'fake target', alignSuggestions: jest.fn(), suggestionsListClass: () => 'custom-class', + termsAsTokens: () => false, filteredSearchSuggestionListInstance: { register: jest.fn(), unregister: jest.fn(), diff --git a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/branch_token_spec.js b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/branch_token_spec.js index a6bb32736db..6bbbfd838a0 100644 --- a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/branch_token_spec.js +++ b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/branch_token_spec.js @@ -46,6 +46,7 @@ function createComponent(options = {}) { portalName: 'fake target', alignSuggestions: function fakeAlignSuggestions() {}, suggestionsListClass: () => 'custom-class', + termsAsTokens: () => false, }, stubs, }); diff --git a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/crm_contact_token_spec.js b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/crm_contact_token_spec.js index ce134f7d24e..fb8cea09a9b 100644 --- a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/crm_contact_token_spec.js +++ b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/crm_contact_token_spec.js @@ -71,6 +71,7 @@ describe('CrmContactToken', () => { portalName: 'fake target', alignSuggestions: function fakeAlignSuggestions() {}, suggestionsListClass: () => 'custom-class', + termsAsTokens: () => false, }, stubs, listeners, diff --git a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/crm_organization_token_spec.js b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/crm_organization_token_spec.js index f41c5b5d432..20369342220 100644 --- a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/crm_organization_token_spec.js +++ b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/crm_organization_token_spec.js @@ -70,6 +70,7 @@ describe('CrmOrganizationToken', () => { portalName: 'fake target', alignSuggestions: function fakeAlignSuggestions() {}, suggestionsListClass: () => 'custom-class', + termsAsTokens: () => false, }, stubs, listeners, diff --git a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/emoji_token_spec.js b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/emoji_token_spec.js index 0dddae50c4e..5e675c10038 100644 --- a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/emoji_token_spec.js +++ b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/emoji_token_spec.js @@ -52,6 +52,7 @@ function createComponent(options = {}) { portalName: 'fake target', alignSuggestions: function fakeAlignSuggestions() {}, suggestionsListClass: () => 'custom-class', + termsAsTokens: () => false, }, stubs, }); diff --git a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/label_token_spec.js b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/label_token_spec.js index 696483df8ef..c55721fe032 100644 --- a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/label_token_spec.js +++ b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/label_token_spec.js @@ -51,6 +51,7 @@ function createComponent(options = {}) { portalName: 'fake target', alignSuggestions: function fakeAlignSuggestions() {}, suggestionsListClass: () => 'custom-class', + termsAsTokens: () => false, }, stubs, listeners, diff --git a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/milestone_token_spec.js b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/milestone_token_spec.js index c758e550ba2..db51b4a05b1 100644 --- a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/milestone_token_spec.js +++ b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/milestone_token_spec.js @@ -49,6 +49,7 @@ function createComponent(options = {}) { portalName: 'fake target', alignSuggestions: function fakeAlignSuggestions() {}, suggestionsListClass: () => 'custom-class', + termsAsTokens: () => false, }, stubs, }); diff --git a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/release_token_spec.js b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/release_token_spec.js index 5190ab919b1..79fd527cbe3 100644 --- a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/release_token_spec.js +++ b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/release_token_spec.js @@ -24,6 +24,7 @@ describe('ReleaseToken', () => { portalName: 'fake target', alignSuggestions: function fakeAlignSuggestions() {}, suggestionsListClass: () => 'custom-class', + termsAsTokens: () => false, }, }); diff --git a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/user_token_spec.js b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/user_token_spec.js index d0a6519f16d..e4ca7dcb19a 100644 --- a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/user_token_spec.js +++ b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/user_token_spec.js @@ -57,6 +57,7 @@ function createComponent(options = {}) { portalName: 'fake target', alignSuggestions: function fakeAlignSuggestions() {}, suggestionsListClass: () => 'custom-class', + termsAsTokens: () => false, }, data() { return { ...data }; diff --git a/spec/frontend/vue_shared/components/runner_instructions/runner_instructions_modal_spec.js b/spec/frontend/vue_shared/components/runner_instructions/runner_instructions_modal_spec.js index cd4ebe334c0..015e08ed760 100644 --- a/spec/frontend/vue_shared/components/runner_instructions/runner_instructions_modal_spec.js +++ b/spec/frontend/vue_shared/components/runner_instructions/runner_instructions_modal_spec.js @@ -1,6 +1,6 @@ import { GlAlert, GlModal, GlButton, GlSkeletonLoader } from '@gitlab/ui'; import { GlBreakpointInstance as bp } from '@gitlab/ui/dist/utils'; -import { shallowMount } from '@vue/test-utils'; +import { shallowMount, ErrorWrapper } from '@vue/test-utils'; import Vue, { nextTick } from 'vue'; import VueApollo from 'vue-apollo'; import createMockApollo from 'helpers/mock_apollo_helper'; @@ -41,7 +41,12 @@ describe('RunnerInstructionsModal component', () => { let runnerPlatformsHandler; const findSkeletonLoader = () => wrapper.findComponent(GlSkeletonLoader); - const findAlert = () => wrapper.findComponent(GlAlert); + const findAlert = (variant = 'danger') => { + const { wrappers } = wrapper + .findAllComponents(GlAlert) + .filter((w) => w.props('variant') === variant); + return wrappers[0] || new ErrorWrapper(); + }; const findModal = () => wrapper.findComponent(GlModal); const findPlatformButtonGroup = () => wrapper.findByTestId('platform-buttons'); const findPlatformButtons = () => findPlatformButtonGroup().findAllComponents(GlButton); @@ -84,6 +89,10 @@ describe('RunnerInstructionsModal component', () => { expect(findAlert().exists()).toBe(false); }); + it('should not show deprecation alert', () => { + expect(findAlert('warning').exists()).toBe(false); + }); + it('should contain a number of platforms buttons', () => { expect(runnerPlatformsHandler).toHaveBeenCalledWith({}); @@ -100,6 +109,21 @@ describe('RunnerInstructionsModal component', () => { ); }); + describe.each` + glFeatures | deprecationAlertExists + ${{}} | ${false} + ${{ createRunnerWorkflowForAdmin: true }} | ${true} + ${{ createRunnerWorkflowForNamespace: true }} | ${true} + `('with features $glFeatures', ({ glFeatures, deprecationAlertExists }) => { + beforeEach(() => { + createComponent({ provide: { glFeatures } }); + }); + + it(`alert is ${deprecationAlertExists ? 'shown' : 'not shown'}`, () => { + expect(findAlert('warning').exists()).toBe(deprecationAlertExists); + }); + }); + describe('when the modal resizes', () => { it('to an xs viewport', async () => { MockResizeObserver.mockResize('xs'); |