diff options
Diffstat (limited to 'spec/frontend/vue_shared/components/awards_list_spec.js')
-rw-r--r-- | spec/frontend/vue_shared/components/awards_list_spec.js | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/spec/frontend/vue_shared/components/awards_list_spec.js b/spec/frontend/vue_shared/components/awards_list_spec.js index bb3e60ab9e2..0abb72ace2e 100644 --- a/spec/frontend/vue_shared/components/awards_list_spec.js +++ b/spec/frontend/vue_shared/components/awards_list_spec.js @@ -210,4 +210,46 @@ describe('vue_shared/components/awards_list', () => { expect(buttons.wrappers.every(x => x.classes('disabled'))).toBe(true); }); }); + + describe('with default awards', () => { + beforeEach(() => { + createComponent({ + awards: [createAward(EMOJI_SMILE, USERS.marie), createAward(EMOJI_100, USERS.marie)], + canAwardEmoji: true, + currentUserId: USERS.root.id, + // Let's assert that it puts thumbsup and thumbsdown in the right order still + defaultAwards: [EMOJI_THUMBSDOWN, EMOJI_100, EMOJI_THUMBSUP], + }); + }); + + it('shows awards in correct order', () => { + expect(findAwardsData()).toEqual([ + { + classes: ['btn', 'award-control'], + count: 0, + html: matchingEmojiTag(EMOJI_THUMBSUP), + title: '', + }, + { + classes: ['btn', 'award-control'], + count: 0, + html: matchingEmojiTag(EMOJI_THUMBSDOWN), + title: '', + }, + // We expect the EMOJI_100 before the EMOJI_SMILE because it was given as a defaultAward + { + classes: ['btn', 'award-control'], + count: 1, + html: matchingEmojiTag(EMOJI_100), + title: 'Marie', + }, + { + classes: ['btn', 'award-control'], + count: 1, + html: matchingEmojiTag(EMOJI_SMILE), + title: 'Marie', + }, + ]); + }); + }); }); |