diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-17 00:08:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-17 00:08:24 +0300 |
commit | 727b1a890c8e44440414c59611e9ead34d6edc93 (patch) | |
tree | de5f272452d2ee4d3e2edb90936fe7ecca127431 /spec/frontend | |
parent | aa0f0e992153e84e1cdec8a1c7310d5eb93a9f8f (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend')
-rw-r--r-- | spec/frontend/vue_shared/components/split_button_spec.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/frontend/vue_shared/components/split_button_spec.js b/spec/frontend/vue_shared/components/split_button_spec.js index 91facb7afa4..e09bc073042 100644 --- a/spec/frontend/vue_shared/components/split_button_spec.js +++ b/spec/frontend/vue_shared/components/split_button_spec.js @@ -74,6 +74,7 @@ describe('SplitButton', () => { describe('emitted event', () => { let eventHandler; + let changeEventHandler; beforeEach(() => { createComponent({ actionItems: mockActionItems }); @@ -84,6 +85,11 @@ describe('SplitButton', () => { wrapper.vm.$once(eventName, () => eventHandler()); }; + const addChangeEventHandler = () => { + changeEventHandler = jest.fn(); + wrapper.vm.$once('change', item => changeEventHandler(item)); + }; + it('defaults to first actionItems event', () => { addEventHandler(mockActionItems[0]); @@ -99,5 +105,13 @@ describe('SplitButton', () => { .then(() => { expect(eventHandler).toHaveBeenCalled(); })); + + it('change to selected actionItem emits change event', () => { + addChangeEventHandler(); + + return selectItem(1).then(() => { + expect(changeEventHandler).toHaveBeenCalledWith(mockActionItems[1]); + }); + }); }); }); |