diff options
Diffstat (limited to 'spec/frontend/issue_show/components/incident_tabs_spec.js')
-rw-r--r-- | spec/frontend/issue_show/components/incident_tabs_spec.js | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/spec/frontend/issue_show/components/incident_tabs_spec.js b/spec/frontend/issue_show/components/incident_tabs_spec.js new file mode 100644 index 00000000000..19f75345450 --- /dev/null +++ b/spec/frontend/issue_show/components/incident_tabs_spec.js @@ -0,0 +1,44 @@ +import { shallowMount } from '@vue/test-utils'; +import { GlTab } from '@gitlab/ui'; +import IncidentTabs from '~/issue_show/components/incident_tabs.vue'; +import { descriptionProps } from '../mock_data'; +import DescriptionComponent from '~/issue_show/components/description.vue'; + +describe('Incident Tabs component', () => { + let wrapper; + + const mountComponent = () => { + wrapper = shallowMount(IncidentTabs, { + propsData: { + ...descriptionProps, + }, + stubs: { + DescriptionComponent: true, + }, + }); + }; + + beforeEach(() => { + mountComponent(); + }); + + const findTabs = () => wrapper.findAll(GlTab); + const findSummaryTab = () => findTabs().at(0); + const findDescriptionComponent = () => wrapper.find(DescriptionComponent); + + describe('default state', () => { + it('renders the summary tab', async () => { + expect(findTabs()).toHaveLength(1); + expect(findSummaryTab().exists()).toBe(true); + expect(findSummaryTab().attributes('title')).toBe('Summary'); + }); + + it('renders the description component', () => { + expect(findDescriptionComponent().exists()).toBe(true); + }); + + it('passes all props to the description component', () => { + expect(findDescriptionComponent().props()).toMatchObject(descriptionProps); + }); + }); +}); |