summaryrefslogtreecommitdiff
path: root/spec/javascripts
diff options
context:
space:
mode:
authorJacob Schatz <jacobschatz@Jacobs-MBP.fios-router.home>2016-01-12 14:55:54 -0500
committerJacob Schatz <jacobschatz@Jacobs-MBP.fios-router.home>2016-01-12 14:55:54 -0500
commit63363e47f4228e15585b0908d91c8749b1067d37 (patch)
treeb4c348cfc4ca83ce58d58794815151ed513ceada /spec/javascripts
parente6f34237bc85f6347a895526179498c56c866970 (diff)
downloadgitlab-ce-63363e47f4228e15585b0908d91c8749b1067d37.tar.gz
reverting more MR ajax files, will appear in different commit
Diffstat (limited to 'spec/javascripts')
-rw-r--r--spec/javascripts/fixtures/merge_requests_show.html.haml12
-rw-r--r--spec/javascripts/merge_request_spec.js.coffee88
2 files changed, 1 insertions, 99 deletions
diff --git a/spec/javascripts/fixtures/merge_requests_show.html.haml b/spec/javascripts/fixtures/merge_requests_show.html.haml
index fdfa8a273e2..8447dfdda32 100644
--- a/spec/javascripts/fixtures/merge_requests_show.html.haml
+++ b/spec/javascripts/fixtures/merge_requests_show.html.haml
@@ -1,14 +1,4 @@
-:css
- .hidden { display: none !important }
-
-.flash-container
- .flash-alert
- .flash-notice
-
-.status-box.status-box-open Open
-.status-box.status-box-closed.hidden Closed
-%a.btn-close{"href" => "http://gitlab.com/merge_requests/6/close"} Close
-%a.btn-reopen.hidden{"href" => "http://gitlab.com/merge_requests/6/reopen"} Reopen
+%a.btn-close
.detail-page-description
.description.js-task-list-container
diff --git a/spec/javascripts/merge_request_spec.js.coffee b/spec/javascripts/merge_request_spec.js.coffee
index e21bfde38ad..22ebc7039d1 100644
--- a/spec/javascripts/merge_request_spec.js.coffee
+++ b/spec/javascripts/merge_request_spec.js.coffee
@@ -21,91 +21,3 @@ describe 'MergeRequest', ->
expect(req.data.merge_request.description).not.toBe(null)
$('.js-task-list-field').trigger('tasklist:changed')
-
- describe 'reopen/close merge request', ->
- fixture.preload('merge_requests_show.html')
- beforeEach ->
- fixture.load('merge_requests_show.html')
- @merge_request = new MergeRequest({})
- it 'closes a merge request', ->
- $.ajax = (obj) ->
- expect(obj.type).toBe('PUT')
- expect(obj.url).toBe('http://gitlab.com/merge_requests/6/close')
- obj.success saved:true
-
- $btnClose = $('a.btn-close')
- $btnReopen = $('a.btn-reopen')
- expect($btnReopen).toBeHidden()
- expect($btnClose.text()).toBe('Close')
- expect(typeof $btnClose.prop('disabled')).toBe('undefined')
-
- $btnClose.trigger('click')
-
- expect($btnReopen).toBeVisible()
-
- expect($btnClose).toBeHidden()
- expect($('div.status-box-closed')).toBeVisible()
- expect($('div.status-box-open')).toBeHidden()
-
- it 'fails to close a merge request with success:false', ->
-
- $.ajax = (obj) ->
- expect(obj.type).toBe('PUT')
- expect(obj.url).toBe('http://goesnowhere.nothing/whereami')
- obj.success saved:false
-
- $btnClose = $('a.btn-close')
- $btnReopen = $('a.btn-reopen')
- $btnClose.attr('href','http://goesnowhere.nothing/whereami')
- expect($btnReopen).toBeHidden()
- expect($btnClose.text()).toBe('Close')
- expect(typeof $btnClose.prop('disabled')).toBe('undefined')
-
- $btnClose.trigger('click')
-
- expect($btnReopen).toBeHidden()
- expect($btnClose).toBeVisible()
- expect($('div.status-box-closed')).toBeHidden()
- expect($('div.status-box-open')).toBeVisible()
- expect($('div.flash-alert')).toBeVisible()
- expect($('div.flash-alert').text()).toBe('Unable to update this merge request at this time.')
-
- it 'fails to closes an issue with HTTP error', ->
-
- $.ajax = (obj) ->
- expect(obj.type).toBe('PUT')
- expect(obj.url).toBe('http://goesnowhere.nothing/whereami')
- obj.error()
-
- $btnClose = $('a.btn-close')
- $btnReopen = $('a.btn-reopen')
- $btnClose.attr('href','http://goesnowhere.nothing/whereami')
- expect($btnReopen).toBeHidden()
- expect($btnClose.text()).toBe('Close')
- expect(typeof $btnClose.prop('disabled')).toBe('undefined')
-
- $btnClose.trigger('click')
-
- expect($btnReopen).toBeHidden()
- expect($btnClose).toBeVisible()
- expect($('div.status-box-closed')).toBeHidden()
- expect($('div.status-box-open')).toBeVisible()
- expect($('div.flash-alert')).toBeVisible()
- expect($('div.flash-alert').text()).toBe('Unable to update this merge request at this time.')
-
- it 'reopens a merge request', ->
- $.ajax = (obj) ->
- expect(obj.type).toBe('PUT')
- expect(obj.url).toBe('http://gitlab.com/merge_requests/6/reopen')
- obj.success saved: true
-
- $btnClose = $('a.btn-close')
- $btnReopen = $('a.btn-reopen')
- expect($btnReopen.text()).toBe('Reopen')
-
- $btnReopen.trigger('click')
-
- expect($btnReopen).toBeHidden()
- expect($btnClose).toBeVisible()
- expect($('div.status-box-open')).toBeVisible()
- expect($('div.status-box-closed')).toBeHidden() \ No newline at end of file