diff options
Diffstat (limited to 'spec/frontend/pipelines/graph_shared/links_layer_spec.js')
-rw-r--r-- | spec/frontend/pipelines/graph_shared/links_layer_spec.js | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/spec/frontend/pipelines/graph_shared/links_layer_spec.js b/spec/frontend/pipelines/graph_shared/links_layer_spec.js index 43d8fe28893..5e5365eef30 100644 --- a/spec/frontend/pipelines/graph_shared/links_layer_spec.js +++ b/spec/frontend/pipelines/graph_shared/links_layer_spec.js @@ -1,4 +1,5 @@ -import { GlAlert, GlButton } from '@gitlab/ui'; +import { GlAlert } from '@gitlab/ui'; +import { fireEvent, within } from '@testing-library/dom'; import { mount, shallowMount } from '@vue/test-utils'; import LinksInner from '~/pipelines/components/graph_shared/links_inner.vue'; import LinksLayer from '~/pipelines/components/graph_shared/links_layer.vue'; @@ -7,8 +8,10 @@ import { generateResponse, mockPipelineResponse } from '../graph/mock_data'; describe('links layer component', () => { let wrapper; + const withinComponent = () => within(wrapper.element); const findAlert = () => wrapper.find(GlAlert); - const findShowAnyways = () => findAlert().find(GlButton); + const findShowAnyways = () => + withinComponent().getByText(wrapper.vm.$options.i18n.showLinksAnyways); const findLinksInner = () => wrapper.find(LinksInner); const pipeline = generateResponse(mockPipelineResponse, 'root/fungi-xoxo'); @@ -103,13 +106,13 @@ describe('links layer component', () => { }); it('renders the disable button', () => { - expect(findShowAnyways().exists()).toBe(true); - expect(findShowAnyways().text()).toBe(wrapper.vm.$options.i18n.showLinksAnyways); + expect(findShowAnyways()).not.toBe(null); }); it('shows links when override is clicked', async () => { expect(findLinksInner().exists()).toBe(false); - await findShowAnyways().trigger('click'); + fireEvent(findShowAnyways(), new MouseEvent('click', { bubbles: true })); + await wrapper.vm.$nextTick(); expect(findLinksInner().exists()).toBe(true); }); }); |