diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-20 13:37:47 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-20 13:37:47 +0000 |
commit | aee0a117a889461ce8ced6fcf73207fe017f1d99 (patch) | |
tree | 891d9ef189227a8445d83f35c1b0fc99573f4380 /spec/frontend/google_cloud/components/home_spec.js | |
parent | 8d46af3258650d305f53b819eabf7ab18d22f59e (diff) | |
download | gitlab-ce-aee0a117a889461ce8ced6fcf73207fe017f1d99.tar.gz |
Add latest changes from gitlab-org/gitlab@14-6-stable-eev14.6.0-rc42
Diffstat (limited to 'spec/frontend/google_cloud/components/home_spec.js')
-rw-r--r-- | spec/frontend/google_cloud/components/home_spec.js | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/spec/frontend/google_cloud/components/home_spec.js b/spec/frontend/google_cloud/components/home_spec.js new file mode 100644 index 00000000000..9b4c3a79f11 --- /dev/null +++ b/spec/frontend/google_cloud/components/home_spec.js @@ -0,0 +1,61 @@ +import { shallowMount } from '@vue/test-utils'; +import { GlTab, GlTabs } from '@gitlab/ui'; +import Home from '~/google_cloud/components/home.vue'; +import ServiceAccountsList from '~/google_cloud/components/service_accounts_list.vue'; + +describe('google_cloud Home component', () => { + let wrapper; + + const findTabs = () => wrapper.findComponent(GlTabs); + const findTabItems = () => findTabs().findAllComponents(GlTab); + const findTabItemsModel = () => + findTabs() + .findAllComponents(GlTab) + .wrappers.map((x) => ({ + title: x.attributes('title'), + disabled: x.attributes('disabled'), + })); + + const TEST_HOME_PROPS = { + serviceAccounts: [{}, {}], + createServiceAccountUrl: '#url-create-service-account', + emptyIllustrationUrl: '#url-empty-illustration', + }; + + beforeEach(() => { + const propsData = { + screen: 'home', + ...TEST_HOME_PROPS, + }; + wrapper = shallowMount(Home, { propsData }); + }); + + afterEach(() => { + wrapper.destroy(); + }); + + describe('google_cloud App tabs', () => { + it('should contain tabs', () => { + expect(findTabs().exists()).toBe(true); + }); + + it('should contain three tab items', () => { + expect(findTabItemsModel()).toEqual([ + { title: 'Configuration', disabled: undefined }, + { title: 'Deployments', disabled: '' }, + { title: 'Services', disabled: '' }, + ]); + }); + + describe('configuration tab', () => { + it('should contain service accounts component', () => { + const serviceAccounts = findTabItems().at(0).findComponent(ServiceAccountsList); + expect(serviceAccounts.props()).toEqual({ + list: TEST_HOME_PROPS.serviceAccounts, + createUrl: TEST_HOME_PROPS.createServiceAccountUrl, + emptyIllustrationUrl: TEST_HOME_PROPS.emptyIllustrationUrl, + }); + }); + }); + }); +}); |