2015-05-05 03:06:57 +00:00
|
|
|
#= require merge_request
|
|
|
|
|
2015-05-06 20:54:34 +00:00
|
|
|
window.disableButtonIfEmptyField = -> null
|
|
|
|
|
2015-05-05 03:06:57 +00:00
|
|
|
describe 'MergeRequest', ->
|
|
|
|
describe 'task lists', ->
|
2015-05-06 20:54:34 +00:00
|
|
|
fixture.preload('merge_requests_show.html')
|
2015-05-05 03:06:57 +00:00
|
|
|
|
|
|
|
beforeEach ->
|
2015-05-06 20:54:34 +00:00
|
|
|
fixture.load('merge_requests_show.html')
|
2015-05-05 03:06:57 +00:00
|
|
|
@merge = new MergeRequest({})
|
|
|
|
|
2015-05-06 20:54:34 +00:00
|
|
|
it 'modifies the Markdown field', ->
|
2015-05-06 21:02:14 +00:00
|
|
|
spyOn(jQuery, 'ajax').and.stub()
|
|
|
|
|
2015-05-06 20:54:34 +00:00
|
|
|
$('input[type=checkbox]').attr('checked', true).trigger('change')
|
|
|
|
expect($('.js-task-list-field').val()).toBe('- [x] Task List Item')
|
|
|
|
|
2015-05-05 03:06:57 +00:00
|
|
|
it 'submits an ajax request on tasklist:changed', ->
|
2015-05-06 21:02:14 +00:00
|
|
|
spyOn(jQuery, 'ajax').and.callFake (req) ->
|
2015-05-05 03:06:57 +00:00
|
|
|
expect(req.type).toBe('PATCH')
|
|
|
|
expect(req.url).toBe('/foo')
|
|
|
|
expect(req.data.merge_request.description).not.toBe(null)
|
|
|
|
|
|
|
|
$('.js-task-list-field').trigger('tasklist:changed')
|