diff options
Diffstat (limited to 'spec/frontend')
-rw-r--r-- | spec/frontend/diffs/components/diff_file_spec.js | 21 | ||||
-rw-r--r-- | spec/frontend/emoji/components/emoji_group_spec.js | 15 |
2 files changed, 28 insertions, 8 deletions
diff --git a/spec/frontend/diffs/components/diff_file_spec.js b/spec/frontend/diffs/components/diff_file_spec.js index 90c42e6e5db..a9fbf4632ac 100644 --- a/spec/frontend/diffs/components/diff_file_spec.js +++ b/spec/frontend/diffs/components/diff_file_spec.js @@ -399,6 +399,27 @@ describe('DiffFile', () => { }); }); + describe('automatically collapsed generated file', () => { + beforeEach(() => { + makeFileAutomaticallyCollapsed(store); + const file = store.state.diffs.diffFiles[0]; + Object.assign(store.state.diffs.diffFiles[0], { + ...file, + viewer: { + ...file.viewer, + generated: true, + }, + }); + }); + + it('should show the generated file warning with expansion button', () => { + expect(findDiffContentArea(wrapper).html()).toContain( + 'Generated files are collapsed by default. This behavior can be overriden via .gitattributes file if required.', + ); + expect(findToggleButton(wrapper).exists()).toBe(true); + }); + }); + describe('not collapsed', () => { beforeEach(() => { makeFileOpenByDefault(store); diff --git a/spec/frontend/emoji/components/emoji_group_spec.js b/spec/frontend/emoji/components/emoji_group_spec.js index 75397ce25ff..a2a46bedd7b 100644 --- a/spec/frontend/emoji/components/emoji_group_spec.js +++ b/spec/frontend/emoji/components/emoji_group_spec.js @@ -1,5 +1,6 @@ import { shallowMount } from '@vue/test-utils'; import Vue from 'vue'; +import { GlButton } from '@gitlab/ui'; import { extendedWrapper } from 'helpers/vue_test_utils_helper'; import EmojiGroup from '~/emoji/components/emoji_group.vue'; @@ -10,6 +11,9 @@ function factory(propsData = {}) { wrapper = extendedWrapper( shallowMount(EmojiGroup, { propsData, + stubs: { + GlButton, + }, }), ); } @@ -19,7 +23,6 @@ describe('Emoji group component', () => { factory({ emojis: [], renderGroup: false, - clickEmoji: jest.fn(), }); expect(wrapper.findByTestId('emoji-button').exists()).toBe(false); @@ -29,24 +32,20 @@ describe('Emoji group component', () => { factory({ emojis: ['thumbsup', 'thumbsdown'], renderGroup: true, - clickEmoji: jest.fn(), }); expect(wrapper.findAllByTestId('emoji-button').exists()).toBe(true); expect(wrapper.findAllByTestId('emoji-button').length).toBe(2); }); - it('calls clickEmoji', () => { - const clickEmoji = jest.fn(); - + it('emits emoji-click', () => { factory({ emojis: ['thumbsup', 'thumbsdown'], renderGroup: true, - clickEmoji, }); - wrapper.findByTestId('emoji-button').trigger('click'); + wrapper.findComponent(GlButton).vm.$emit('click'); - expect(clickEmoji).toHaveBeenCalledWith('thumbsup'); + expect(wrapper.emitted('emoji-click')).toStrictEqual([['thumbsup']]); }); }); |