diff options
Diffstat (limited to 'spec/frontend/blob/components/blob_header_default_actions_spec.js')
-rw-r--r-- | spec/frontend/blob/components/blob_header_default_actions_spec.js | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/spec/frontend/blob/components/blob_header_default_actions_spec.js b/spec/frontend/blob/components/blob_header_default_actions_spec.js index fe0edffd12d..5da0d40ab14 100644 --- a/spec/frontend/blob/components/blob_header_default_actions_spec.js +++ b/spec/frontend/blob/components/blob_header_default_actions_spec.js @@ -8,7 +8,6 @@ import { } from '~/blob/components/constants'; import { GlButtonGroup, GlButton } from '@gitlab/ui'; import { Blob } from './mock_data'; -import eventHub from '~/blob/event_hub'; describe('Blob Header Default Actions', () => { let wrapper; @@ -16,10 +15,10 @@ describe('Blob Header Default Actions', () => { let buttons; const hrefPrefix = 'http://localhost'; - function createComponent(blobProps = {}, propsData = {}) { + function createComponent(propsData = {}) { wrapper = mount(BlobHeaderActions, { propsData: { - blob: Object.assign({}, Blob, blobProps), + rawPath: Blob.rawPath, ...propsData, }, }); @@ -60,12 +59,9 @@ describe('Blob Header Default Actions', () => { }); it('renders "Copy file contents" button as disables if the viewer is Rich', () => { - createComponent( - {}, - { - activeViewer: RICH_BLOB_VIEWER, - }, - ); + createComponent({ + activeViewer: RICH_BLOB_VIEWER, + }); buttons = wrapper.findAll(GlButton); expect(buttons.at(0).attributes('disabled')).toBeTruthy(); @@ -74,10 +70,10 @@ describe('Blob Header Default Actions', () => { describe('functionally', () => { it('emits an event when a Copy Contents button is clicked', () => { - jest.spyOn(eventHub, '$emit'); + jest.spyOn(wrapper.vm, '$emit'); buttons.at(0).vm.$emit('click'); - expect(eventHub.$emit).toHaveBeenCalledWith('copy'); + expect(wrapper.vm.$emit).toHaveBeenCalledWith('copy'); }); }); }); |