diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-19 04:45:44 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-19 04:45:44 +0300 |
commit | 85dc423f7090da0a52c73eb66faf22ddb20efff9 (patch) | |
tree | 9160f299afd8c80c038f08e1545be119f5e3f1e1 /spec/frontend/notes/components/comment_form_spec.js | |
parent | 15c2c8c66dbe422588e5411eee7e68f1fa440bb8 (diff) |
Add latest changes from gitlab-org/gitlab@13-4-stable-ee
Diffstat (limited to 'spec/frontend/notes/components/comment_form_spec.js')
-rw-r--r-- | spec/frontend/notes/components/comment_form_spec.js | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/spec/frontend/notes/components/comment_form_spec.js b/spec/frontend/notes/components/comment_form_spec.js index dc68c4371aa..59fa7b372ed 100644 --- a/spec/frontend/notes/components/comment_form_spec.js +++ b/spec/frontend/notes/components/comment_form_spec.js @@ -267,15 +267,14 @@ describe('issue_comment_form component', () => { }); describe('when clicking close/reopen button', () => { - it('should disable button and show a loading spinner', done => { + it('should disable button and show a loading spinner', () => { const toggleStateButton = wrapper.find('.js-action-button'); toggleStateButton.trigger('click'); - wrapper.vm.$nextTick(() => { - expect(toggleStateButton.element.disabled).toEqual(true); - expect(toggleStateButton.find('.js-loading-button-icon').exists()).toBe(true); - done(); + return wrapper.vm.$nextTick().then(() => { + expect(toggleStateButton.element.disabled).toEqual(true); + expect(toggleStateButton.props('loading')).toBe(true); }); }); }); @@ -321,4 +320,33 @@ describe('issue_comment_form component', () => { expect(wrapper.find('textarea').exists()).toBe(false); }); }); + + describe('when issuable is open', () => { + beforeEach(() => { + setupStore(userDataMock, noteableDataMock); + }); + + it.each([['opened', 'warning'], ['reopened', 'warning']])( + 'when %i, it changes the variant of the btn to %i', + (a, expected) => { + store.state.noteableData.state = a; + + mountComponent(); + + expect(wrapper.find('.js-action-button').props('variant')).toBe(expected); + }, + ); + }); + + describe('when issuable is not open', () => { + beforeEach(() => { + setupStore(userDataMock, noteableDataMock); + + mountComponent(); + }); + + it('should render the "default" variant of the button', () => { + expect(wrapper.find('.js-action-button').props('variant')).toBe('warning'); + }); + }); }); |