diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
commit | b76ae638462ab0f673e5915986070518dd3f9ad3 (patch) | |
tree | bdab0533383b52873be0ec0eb4d3c66598ff8b91 /spec/frontend/vue_shared/components/filtered_search_bar/tokens/emoji_token_spec.js | |
parent | 434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff) |
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'spec/frontend/vue_shared/components/filtered_search_bar/tokens/emoji_token_spec.js')
-rw-r--r-- | spec/frontend/vue_shared/components/filtered_search_bar/tokens/emoji_token_spec.js | 34 |
1 files changed, 5 insertions, 29 deletions
diff --git a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/emoji_token_spec.js b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/emoji_token_spec.js index 778a214f97e..c2d61fd9f05 100644 --- a/spec/frontend/vue_shared/components/filtered_search_bar/tokens/emoji_token_spec.js +++ b/spec/frontend/vue_shared/components/filtered_search_bar/tokens/emoji_token_spec.js @@ -67,40 +67,16 @@ describe('EmojiToken', () => { wrapper.destroy(); }); - describe('computed', () => { - beforeEach(async () => { - wrapper = createComponent({ value: { data: mockEmojis[0].name } }); - - wrapper.setData({ - emojis: mockEmojis, - }); - - await wrapper.vm.$nextTick(); - }); - - describe('currentValue', () => { - it('returns lowercase string for `value.data`', () => { - expect(wrapper.vm.currentValue).toBe(mockEmojis[0].name); - }); - }); - - describe('activeEmoji', () => { - it('returns object for currently present `value.data`', () => { - expect(wrapper.vm.activeEmoji).toEqual(mockEmojis[0]); - }); - }); - }); - describe('methods', () => { beforeEach(() => { wrapper = createComponent(); }); - describe('fetchEmojiBySearchTerm', () => { + describe('fetchEmojis', () => { it('calls `config.fetchEmojis` with provided searchTerm param', () => { jest.spyOn(wrapper.vm.config, 'fetchEmojis'); - wrapper.vm.fetchEmojiBySearchTerm('foo'); + wrapper.vm.fetchEmojis('foo'); expect(wrapper.vm.config.fetchEmojis).toHaveBeenCalledWith('foo'); }); @@ -108,7 +84,7 @@ describe('EmojiToken', () => { it('sets response to `emojis` when request is successful', () => { jest.spyOn(wrapper.vm.config, 'fetchEmojis').mockResolvedValue(mockEmojis); - wrapper.vm.fetchEmojiBySearchTerm('foo'); + wrapper.vm.fetchEmojis('foo'); return waitForPromises().then(() => { expect(wrapper.vm.emojis).toEqual(mockEmojis); @@ -118,7 +94,7 @@ describe('EmojiToken', () => { it('calls `createFlash` with flash error message when request fails', () => { jest.spyOn(wrapper.vm.config, 'fetchEmojis').mockRejectedValue({}); - wrapper.vm.fetchEmojiBySearchTerm('foo'); + wrapper.vm.fetchEmojis('foo'); return waitForPromises().then(() => { expect(createFlash).toHaveBeenCalledWith({ @@ -130,7 +106,7 @@ describe('EmojiToken', () => { it('sets `loading` to false when request completes', () => { jest.spyOn(wrapper.vm.config, 'fetchEmojis').mockRejectedValue({}); - wrapper.vm.fetchEmojiBySearchTerm('foo'); + wrapper.vm.fetchEmojis('foo'); return waitForPromises().then(() => { expect(wrapper.vm.loading).toBe(false); |