Commit 33fa1e2c by Valera Rozuvan

Applying code changes as suggested by Anton.

Fixed 2 failing Jasmine tests. Removed unnecessary console.log() call.
Initializing of variables in a single var statement.
parent 2a4f7f61
...@@ -53,7 +53,8 @@ ...@@ -53,7 +53,8 @@
expect($.ajaxWithPrefix).toHaveBeenCalledWith({ expect($.ajaxWithPrefix).toHaveBeenCalledWith({
url: videoCaption.captionURL(), url: videoCaption.captionURL(),
notifyOnError: false, notifyOnError: false,
success: jasmine.any(Function) success: jasmine.any(Function),
error: jasmine.any(Function),
}); });
}); });
}); });
...@@ -462,7 +463,7 @@ ...@@ -462,7 +463,7 @@
}); });
// Temporarily disabled due to intermittent failures // Temporarily disabled due to intermittent failures
// Fails with error: "InvalidStateError: An attempt was made to // Fails with error: "InvalidStateError: An attempt was made to
// use an object that is not, or is no longer, usable // use an object that is not, or is no longer, usable
// Expected 0 to equal 14.91." // Expected 0 to equal 14.91."
// on Firefox // on Firefox
......
...@@ -95,7 +95,10 @@ function () { ...@@ -95,7 +95,10 @@ function () {
this.videoCaption.subtitlesEl = this.el.find('ol.subtitles'); this.videoCaption.subtitlesEl = this.el.find('ol.subtitles');
this.videoCaption.hideSubtitlesEl = this.el.find('a.hide-subtitles'); this.videoCaption.hideSubtitlesEl = this.el.find('a.hide-subtitles');
this.videoCaption.fetchCaption(); if (!this.videoCaption.fetchCaption()) {
this.videoCaption.hideCaptions(true);
this.videoCaption.hideSubtitlesEl.hide();
}
} }
// function bindHandlers() // function bindHandlers()
...@@ -190,7 +193,6 @@ function () { ...@@ -190,7 +193,6 @@ function () {
console.log( console.log(
'STATUS:', textStatus + ', MESSAGE:', '' + errorThrown 'STATUS:', textStatus + ', MESSAGE:', '' + errorThrown
); );
console.log('arguments:', arguments);
_this.videoCaption.hideCaptions(true); _this.videoCaption.hideCaptions(true);
_this.videoCaption.hideSubtitlesEl.hide(); _this.videoCaption.hideSubtitlesEl.hide();
...@@ -281,9 +283,8 @@ function () { ...@@ -281,9 +283,8 @@ function () {
} }
function renderCaption() { function renderCaption() {
var container, var container = $('<ol>'),
_this = this; _this = this;
container = $('<ol>');
this.el.find('.video-wrapper').after(this.videoCaption.subtitlesEl); this.el.find('.video-wrapper').after(this.videoCaption.subtitlesEl);
this.el.find('.video-controls .secondary-controls').append(this.videoCaption.hideSubtitlesEl); this.el.find('.video-controls .secondary-controls').append(this.videoCaption.hideSubtitlesEl);
......
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