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.
This commit is contained in:
Valera Rozuvan
2013-08-28 17:15:52 +03:00
parent 2a4f7f61c5
commit 33fa1e2c7f
2 changed files with 8 additions and 6 deletions

View File

@@ -53,7 +53,8 @@
expect($.ajaxWithPrefix).toHaveBeenCalledWith({
url: videoCaption.captionURL(),
notifyOnError: false,
success: jasmine.any(Function)
success: jasmine.any(Function),
error: jasmine.any(Function),
});
});
});
@@ -462,7 +463,7 @@
});
// 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
// Expected 0 to equal 14.91."
// on Firefox

View File

@@ -95,7 +95,10 @@ function () {
this.videoCaption.subtitlesEl = this.el.find('ol.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()
@@ -190,7 +193,6 @@ function () {
console.log(
'STATUS:', textStatus + ', MESSAGE:', '' + errorThrown
);
console.log('arguments:', arguments);
_this.videoCaption.hideCaptions(true);
_this.videoCaption.hideSubtitlesEl.hide();
@@ -281,9 +283,8 @@ function () {
}
function renderCaption() {
var container,
var container = $('<ol>'),
_this = this;
container = $('<ol>');
this.el.find('.video-wrapper').after(this.videoCaption.subtitlesEl);
this.el.find('.video-controls .secondary-controls').append(this.videoCaption.hideSubtitlesEl);