mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-09 04:36:11 +10:00
Avoid a TypeError when initializing MergeRequest JS class with no arg
Without this sane default you would get the following error when you tried to instantiate a new MergeRequest object with no argument (i.e. `new MergeRequest();`): TypeError: undefined is not an object (evaluating 'this.opts.action') Signed-off-by: Rémy Coutable <remy@rymai.me>
This commit is contained in:
@@ -9,7 +9,7 @@ class @MergeRequest
|
||||
# Options:
|
||||
# action - String, current controller action
|
||||
#
|
||||
constructor: (@opts) ->
|
||||
constructor: (@opts = {}) ->
|
||||
this.$el = $('.merge-request')
|
||||
|
||||
this.$('.show-all-commits').on 'click', =>
|
||||
|
||||
@@ -6,7 +6,7 @@ describe 'MergeRequest', ->
|
||||
|
||||
beforeEach ->
|
||||
fixture.load('merge_requests_show.html')
|
||||
@merge = new MergeRequest({})
|
||||
@merge = new MergeRequest()
|
||||
|
||||
it 'modifies the Markdown field', ->
|
||||
spyOn(jQuery, 'ajax').and.stub()
|
||||
|
||||
Reference in New Issue
Block a user