Commit dc373f22 by Valera Rozuvan

Merge pull request #3350 from edx/valera/l63a

Fixing start-time and end-time related Jasmine tests.
parents 27256bbb 68dd78e9
...@@ -108,5 +108,30 @@ ...@@ -108,5 +108,30 @@
// //
// The parameter "predef" should remain empty for this configuration file // The parameter "predef" should remain empty for this configuration file
// to remain as general as possible. // to remain as general as possible.
"predef": [] "predef": [
// jQuery library.
"jQuery", "$",
// Underscore.js library.
"_",
// Jasmine library.
"jasmine",
"describe", "xdescribe",
"it", "xit",
"spyOn",
"beforeEach",
"afterEach",
"expect",
"waitsFor",
"runs",
// jQuery-Jasmine library.
"loadFixtures",
"appendLoadFixtures",
"readFixtures",
"setFixtures",
"appendSetFixtures",
"spyOnEvent"
]
} }
(function ($, undefined) { (function () {
'use strict';
var stubbedYT = { var stubbedYT = {
Player: function () { Player: function () {
var Player = jasmine.createSpyObj( var Player = jasmine.createSpyObj(
...@@ -150,11 +152,11 @@ ...@@ -150,11 +152,11 @@
} }
} else if (settings.url.match(/transcript\/translation\/.+$/)) { } else if (settings.url.match(/transcript\/translation\/.+$/)) {
return settings.success(jasmine.stubbedCaption); return settings.success(jasmine.stubbedCaption);
} else if (settings.url == '/transcript/available_translations') { } else if (settings.url === '/transcript/available_translations') {
return settings.success(['uk', 'de']); return settings.success(['uk', 'de']);
} else if (settings.url.match(/.+\/problem_get$/)) { } else if (settings.url.match(/.+\/problem_get$/)) {
return settings.success({ return settings.success({
html: readFixtures('problem_content.html') html: window.readFixtures('problem_content.html')
}); });
} else if ( } else if (
settings.url === '/calculate' || settings.url === '/calculate' ||
...@@ -163,13 +165,15 @@ ...@@ -163,13 +165,15 @@
settings.url.match(/.+\/problem_(check|reset|show|save)$/) settings.url.match(/.+\/problem_(check|reset|show|save)$/)
) { ) {
// Do nothing. // Do nothing.
} else if (settings.url == '/save_user_state') { return;
} else if (settings.url === '/save_user_state') {
return {success: true}; return {success: true};
} else if (settings.url === 'http://www.youtube.com/iframe_api') { } else if (settings.url === 'http://www.youtube.com/iframe_api') {
// Stub YouTube API. // Stub YouTube API.
window.YT = stubbedYT; window.YT = stubbedYT;
// Call the callback that must be called when YouTube API is loaded. By specification. // Call the callback that must be called when YouTube API is
// loaded. By specification.
window.onYouTubeIframeAPIReady(); window.onYouTubeIframeAPIReady();
return {success: true}; return {success: true};
...@@ -205,7 +209,7 @@ ...@@ -205,7 +209,7 @@
} }
}); });
return this.addMatchers(imagediff.jasmine); return this.addMatchers(window.imagediff.jasmine);
}); });
// Stub jQuery.cookie module. // Stub jQuery.cookie module.
...@@ -244,7 +248,7 @@ ...@@ -244,7 +248,7 @@
} }
jasmine.stubRequests(); jasmine.stubRequests();
state = new Video('#example'); state = new window.Video('#example');
state.resizer = (function () { state.resizer = (function () {
var methods = [ var methods = [
...@@ -279,4 +283,4 @@ ...@@ -279,4 +283,4 @@
// "video.html" contains HTML template for a YouTube video. // "video.html" contains HTML template for a YouTube video.
return jasmine.initializePlayer('video.html', params); return jasmine.initializePlayer('video.html', params);
}; };
}).call(this, window.jQuery); }).call(this);
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