Commit 14a9796c by Andy Armstrong

Re-enable the video translation Jasmine tests

TNL-2689
parent 9e5290c1
...@@ -28,7 +28,7 @@ require ["jquery", "backbone", "coffee/src/main", "common/js/spec_helpers/ajax_h ...@@ -28,7 +28,7 @@ require ["jquery", "backbone", "coffee/src/main", "common/js/spec_helpers/ajax_h
appendSetFixtures(sandbox({id: "page-notification"})) appendSetFixtures(sandbox({id: "page-notification"}))
it "successful AJAX request does not pop an error notification", -> it "successful AJAX request does not pop an error notification", ->
server = AjaxHelpers['server'](200, this) server = AjaxHelpers.server(this, [200, {}, ''])
expect($("#page-notification")).toBeEmpty() expect($("#page-notification")).toBeEmpty()
$.ajax("/test") $.ajax("/test")
...@@ -37,7 +37,7 @@ require ["jquery", "backbone", "coffee/src/main", "common/js/spec_helpers/ajax_h ...@@ -37,7 +37,7 @@ require ["jquery", "backbone", "coffee/src/main", "common/js/spec_helpers/ajax_h
expect($("#page-notification")).toBeEmpty() expect($("#page-notification")).toBeEmpty()
it "AJAX request with error should pop an error notification", -> it "AJAX request with error should pop an error notification", ->
server = AjaxHelpers['server'](500, this) server = AjaxHelpers.server(this, [500, {}, ''])
$.ajax("/test") $.ajax("/test")
server.respond() server.respond()
...@@ -45,7 +45,7 @@ require ["jquery", "backbone", "coffee/src/main", "common/js/spec_helpers/ajax_h ...@@ -45,7 +45,7 @@ require ["jquery", "backbone", "coffee/src/main", "common/js/spec_helpers/ajax_h
expect($("#page-notification")).toContain('div.wrapper-notification-error') expect($("#page-notification")).toContain('div.wrapper-notification-error')
it "can override AJAX request with error so it does not pop an error notification", -> it "can override AJAX request with error so it does not pop an error notification", ->
server = AjaxHelpers['server'](500, this) server = AjaxHelpers.server(this, [500, {}, ''])
$.ajax $.ajax
url: "/test" url: "/test"
......
...@@ -34,7 +34,7 @@ define ["js/models/section", "common/js/spec_helpers/ajax_helpers", "js/utils/mo ...@@ -34,7 +34,7 @@ define ["js/models/section", "common/js/spec_helpers/ajax_helpers", "js/utils/mo
}) })
it "show/hide a notification when it saves to the server", -> it "show/hide a notification when it saves to the server", ->
server = AjaxHelpers['server'](200, this) server = AjaxHelpers.server(this, [200, {}, ''])
@model.save() @model.save()
expect(Section.prototype.showNotification).toHaveBeenCalled() expect(Section.prototype.showNotification).toHaveBeenCalled()
...@@ -43,7 +43,7 @@ define ["js/models/section", "common/js/spec_helpers/ajax_helpers", "js/utils/mo ...@@ -43,7 +43,7 @@ define ["js/models/section", "common/js/spec_helpers/ajax_helpers", "js/utils/mo
it "don't hide notification when saving fails", -> it "don't hide notification when saving fails", ->
# this is handled by the global AJAX error handler # this is handled by the global AJAX error handler
server = AjaxHelpers['server'](500, this) server = AjaxHelpers.server(this, [500, {}, ''])
@model.save() @model.save()
server.respond() server.respond()
......
...@@ -18,12 +18,12 @@ define(['sinon', 'underscore'], function(sinon, _) { ...@@ -18,12 +18,12 @@ define(['sinon', 'underscore'], function(sinon, _) {
* Get a reference to the mocked server, and respond * Get a reference to the mocked server, and respond
* to all requests with the specified statusCode. * to all requests with the specified statusCode.
*/ */
fakeServer = function (statusCode, that) { fakeServer = function (that, response) {
var server = sinon.fakeServer.create(); var server = sinon.fakeServer.create();
that.after(function() { that.after(function() {
server.restore(); server.restore();
}); });
server.respondWith([statusCode, {}, '']); server.respondWith(response);
return server; return server;
}; };
......
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