Commit f7683833 by Jim Abramson

Merge pull request #3526 from edx/jsa/jasmine-fix

crude fix for intermittent jasmine test failures
parents d78dd92c 03977a46
...@@ -141,8 +141,6 @@ describe 'ResponseCommentView', -> ...@@ -141,8 +141,6 @@ describe 'ResponseCommentView', ->
spyOn(@view, 'cancelEdit') spyOn(@view, 'cancelEdit')
spyOn($, "ajax").andCallFake( spyOn($, "ajax").andCallFake(
(params) => (params) =>
expect(params.url._parts.path).toEqual("/courses/edX/999/test/discussion/comments/01234567/update")
expect(params.data.body).toEqual(@updatedBody)
if @ajaxSucceed if @ajaxSucceed
params.success() params.success()
else else
...@@ -154,6 +152,8 @@ describe 'ResponseCommentView', -> ...@@ -154,6 +152,8 @@ describe 'ResponseCommentView', ->
@ajaxSucceed = true @ajaxSucceed = true
@view.update(makeEventSpy()) @view.update(makeEventSpy())
expect($.ajax).toHaveBeenCalled() expect($.ajax).toHaveBeenCalled()
expect($.ajax.mostRecentCall.args[0].url._parts.path).toEqual('/courses/edX/999/test/discussion/comments/01234567/update')
expect($.ajax.mostRecentCall.args[0].data.body).toEqual(@updatedBody)
expect(@view.model.get("body")).toEqual(@updatedBody) expect(@view.model.get("body")).toEqual(@updatedBody)
expect(@view.cancelEdit).toHaveBeenCalled() expect(@view.cancelEdit).toHaveBeenCalled()
...@@ -162,6 +162,8 @@ describe 'ResponseCommentView', -> ...@@ -162,6 +162,8 @@ describe 'ResponseCommentView', ->
@ajaxSucceed = false @ajaxSucceed = false
@view.update(makeEventSpy()) @view.update(makeEventSpy())
expect($.ajax).toHaveBeenCalled() expect($.ajax).toHaveBeenCalled()
expect($.ajax.mostRecentCall.args[0].url._parts.path).toEqual('/courses/edX/999/test/discussion/comments/01234567/update')
expect($.ajax.mostRecentCall.args[0].data.body).toEqual(@updatedBody)
expect(@view.model.get("body")).toEqual(originalBody) expect(@view.model.get("body")).toEqual(originalBody)
expect(@view.cancelEdit).not.toHaveBeenCalled() expect(@view.cancelEdit).not.toHaveBeenCalled()
expect(@view.$(".edit-comment-form-errors *").length).toEqual(1) expect(@view.$(".edit-comment-form-errors *").length).toEqual(1)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment