Commit bf9e525e by Valera Rozuvan Committed by polesye

BLD-489: Fix JavaScript tests.

parent 336d648e
...@@ -68,7 +68,7 @@ function($, Backbone, _, Utils, FileUploader, gettext) { ...@@ -68,7 +68,7 @@ function($, Backbone, _, Utils, FileUploader, gettext) {
if (!tplHtml) { if (!tplHtml) {
console.error('Couldn\'t load Transcripts status template'); console.error('Couldn\'t load Transcripts status template');
return; return this;
} }
template = _.template(tplHtml); template = _.template(tplHtml);
......
...@@ -28,7 +28,9 @@ function($, Backbone, _, AbstractEditor, Utils, MessageManager, MetadataView) { ...@@ -28,7 +28,9 @@ function($, Backbone, _, AbstractEditor, Utils, MessageManager, MetadataView) {
// Initialize MessageManager that is responsible for // Initialize MessageManager that is responsible for
// status messages and errors. // status messages and errors.
this.messenger = new MessageManager({
var messenger = this.options.MessageManager || MessageManager;
this.messenger = new messenger({
el: this.$el, el: this.$el,
parent: this parent: this
}); });
......
...@@ -169,11 +169,10 @@ function ($, Backbone, _, Utils, Editor, MetadataView, MetadataModel, MetadataCo ...@@ -169,11 +169,10 @@ function ($, Backbone, _, Utils, Editor, MetadataView, MetadataModel, MetadataCo
}, "Defaults never loaded", 1000); }, "Defaults never loaded", 1000);
runs(function() { runs(function() {
var displayNameValue = collection[0].getValue(),
videoUrlValue = collection[1].getValue();
var displayNameValue = collection[0].getValue(); expect(displayNameValue).toEqual('default');
var videoUrlValue = collection[1].getValue();
expect(displayNameValue).toBe('default');
expect(videoUrlValue).toEqual([ expect(videoUrlValue).toEqual([
'http://youtu.be/OEoXaMPEzfM', 'http://youtu.be/OEoXaMPEzfM',
'default.mp4', 'default.mp4',
...@@ -237,13 +236,13 @@ function ($, Backbone, _, Utils, Editor, MetadataView, MetadataModel, MetadataCo ...@@ -237,13 +236,13 @@ function ($, Backbone, _, Utils, Editor, MetadataView, MetadataModel, MetadataCo
var html5SourcesValue = collection[2].getValue(); var html5SourcesValue = collection[2].getValue();
var youtubeValue = collection[3].getValue(); var youtubeValue = collection[3].getValue();
expect(displayNameValue).toBe('display value'); expect(displayNameValue).toEqual('display value');
expect(subValue).toBe('default'); expect(subValue).toEqual('default');
expect(html5SourcesValue).toEqual([ expect(html5SourcesValue).toEqual([
'video.mp4', 'video.mp4',
'video.webm' 'video.webm'
]); ]);
expect(youtubeValue).toBe('12345678901'); expect(youtubeValue).toEqual('12345678901');
}); });
}); });
...@@ -256,13 +255,13 @@ function ($, Backbone, _, Utils, Editor, MetadataView, MetadataModel, MetadataCo ...@@ -256,13 +255,13 @@ function ($, Backbone, _, Utils, Editor, MetadataView, MetadataModel, MetadataCo
html5SourcesValue = collection[2].getValue(), html5SourcesValue = collection[2].getValue(),
youtubeValue = collection[3].getValue(); youtubeValue = collection[3].getValue();
expect(displayNameValue).toBe('default'); expect(displayNameValue).toEqual('default');
expect(subValue).toBe('default'); expect(subValue).toEqual('default');
expect(html5SourcesValue).toEqual([ expect(html5SourcesValue).toEqual([
'default.mp4', 'default.mp4',
'default.webm' 'default.webm'
]); ]);
expect(youtubeValue).toBe('OEoXaMPEzfM'); expect(youtubeValue).toEqual('OEoXaMPEzfM');
}); });
it('Youtube Id is not adjusted', function () { it('Youtube Id is not adjusted', function () {
...@@ -283,7 +282,7 @@ function ($, Backbone, _, Utils, Editor, MetadataView, MetadataModel, MetadataCo ...@@ -283,7 +282,7 @@ function ($, Backbone, _, Utils, Editor, MetadataView, MetadataModel, MetadataCo
'video.mp4', 'video.mp4',
'video.webm' 'video.webm'
]); ]);
expect(youtubeValue).toBe(''); expect(youtubeValue).toEqual('');
}); });
it('Timed Transcript field is updated', function () { it('Timed Transcript field is updated', function () {
...@@ -294,7 +293,7 @@ function ($, Backbone, _, Utils, Editor, MetadataView, MetadataModel, MetadataCo ...@@ -294,7 +293,7 @@ function ($, Backbone, _, Utils, Editor, MetadataView, MetadataModel, MetadataCo
var collection = metadataCollection.models, var collection = metadataCollection.models,
subValue = collection[1].getValue(); subValue = collection[1].getValue();
expect(subValue).toBe('test_value'); expect(subValue).toEqual('test_value');
}); });
it('Timed Transcript field is updated just once', function () { it('Timed Transcript field is updated just once', function () {
...@@ -309,7 +308,7 @@ function ($, Backbone, _, Utils, Editor, MetadataView, MetadataModel, MetadataCo ...@@ -309,7 +308,7 @@ function ($, Backbone, _, Utils, Editor, MetadataView, MetadataModel, MetadataCo
transcripts.syncAdvancedTab(metadataCollection); transcripts.syncAdvancedTab(metadataCollection);
transcripts.syncAdvancedTab(metadataCollection); transcripts.syncAdvancedTab(metadataCollection);
expect(subModel.setValue.calls.length).toBe(1); expect(subModel.setValue.calls.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