diff options
| author | Jacob Schatz <jacobschatz@Jacobs-MBP.fios-router.home> | 2015-12-21 13:06:09 -0500 |
|---|---|---|
| committer | Jacob Schatz <jacobschatz@Jacobs-MBP.fios-router.home> | 2015-12-21 13:06:09 -0500 |
| commit | 70dfa3a721700cf0151a7d097933d75684e69fc9 (patch) | |
| tree | f683e0e75e10bda55e7b5596635c471e8379a9f5 /spec/javascripts/issue_spec.js.coffee | |
| parent | 4b4cbf0ce4925e22a635e4432e7ac8602199fa5b (diff) | |
| download | gitlab-ce-70dfa3a721700cf0151a7d097933d75684e69fc9.tar.gz | |
open and close issue via ajax request. With tests
Diffstat (limited to 'spec/javascripts/issue_spec.js.coffee')
| -rw-r--r-- | spec/javascripts/issue_spec.js.coffee | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/javascripts/issue_spec.js.coffee b/spec/javascripts/issue_spec.js.coffee index 268e4c68c31..60df3a8878b 100644 --- a/spec/javascripts/issue_spec.js.coffee +++ b/spec/javascripts/issue_spec.js.coffee @@ -20,3 +20,39 @@ describe 'Issue', -> expect(req.data.issue.description).not.toBe(null) $('.js-task-list-field').trigger('tasklist:changed') +describe 'reopen/close issue', -> + fixture.preload('issues_show.html') + beforeEach -> + fixture.load('issues_show.html') + @issue = new Issue() + it 'closes an issue', -> + $.ajax = (obj) -> + expect(obj.type).toBe('PUT') + expect(obj.url).toBe('http://gitlab/issues/6/close') + obj.success saved: true + $btnClose = $('a.btn-close') + $btnReopen = $('a.btn-reopen') + expect($btnReopen.hasClass('hidden')).toBe(true) + expect($btnClose.text()).toBe('Close') + expect(typeof $btnClose.prop('disabled')).toBe('undefined') + $btnClose.trigger('click') + expect($btnClose.hasClass('hidden')).toBe(true) + expect($btnReopen.hasClass('hidden')).toBe(false) + expect($btnClose.prop('disabled')).toBe(false) + expect($('div.issue-box-open').hasClass('hidden')).toBe(true) + expect($('div.issue-box-closed').hasClass('hidden')).toBe(false) + it 'reopens an issue', -> + $.ajax = (obj) -> + expect(obj.type).toBe('PUT') + expect(obj.url).toBe('http://gitlab/issues/6/reopen') + obj.success saved: true + $btnClose = $('a.btn-close') + $btnReopen = $('a.btn-reopen') + expect(typeof $btnReopen.prop('disabled')).toBe('undefined') + expect($btnReopen.text()).toBe('Reopen') + $btnReopen.trigger('click') + expect($btnReopen.hasClass('hidden')).toBe(true) + expect($btnClose.hasClass('hidden')).toBe(false) + expect($btnReopen.prop('disabled')).toBe(false) + expect($('div.issue-box-open').hasClass('hidden')).toBe(false) + expect($('div.issue-box-closed').hasClass('hidden')).toBe(true)
\ No newline at end of file |
