Commit 68c6a7c7 by Valera Rozuvan

Merge pull request #1623 from edx/valera/fix_js_error_transcripts_editor_spec

Fix JavaScript typo in transcripts editor spec.
parents 2261d4c4 bf9e525e
...@@ -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);
}); });
}); });
......
...@@ -2,17 +2,14 @@ define( ...@@ -2,17 +2,14 @@ define(
[ [
"jquery", "underscore", "jquery", "underscore",
"js/views/transcripts/utils", "js/views/transcripts/metadata_videolist", "js/views/transcripts/utils", "js/views/transcripts/metadata_videolist",
"js/views/transcripts/message_manager",
"js/views/metadata", "js/models/metadata", "js/views/abstract_editor", "js/views/metadata", "js/models/metadata", "js/views/abstract_editor",
"sinon", "xmodule", "jasmine-jquery" "sinon", "xmodule", "jasmine-jquery"
], ],
function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, AbstractEditor, sinon) { function ($, _, Utils, VideoList, MetadataView, MetadataModel, AbstractEditor, sinon) {
describe('CMS.Views.Metadata.VideoList', function () { describe('CMS.Views.Metadata.VideoList', function () {
var videoListEntryTemplate = readFixtures( var videoListEntryTemplate = readFixtures(
'transcripts/metadata-videolist-entry.underscore' 'transcripts/metadata-videolist-entry.underscore'
), ),
correctMessanger = MessageManager,
messenger = correctMessanger.prototype,
abstractEditor = AbstractEditor.prototype, abstractEditor = AbstractEditor.prototype,
component_id = 'component_id', component_id = 'component_id',
videoList = [ videoList = [
...@@ -51,7 +48,7 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A ...@@ -51,7 +48,7 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A
status: 'Success', status: 'Success',
subs: 'video_id' subs: 'video_id'
}), }),
view, sinonXhr; view, sinonXhr, MessageManager, messenger;
beforeEach(function () { beforeEach(function () {
sinonXhr = sinon.fakeServer.create(); sinonXhr = sinon.fakeServer.create();
...@@ -60,6 +57,7 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A ...@@ -60,6 +57,7 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A
{ "Content-Type": "application/json"}, { "Content-Type": "application/json"},
response response
]); ]);
sinonXhr.autoRespond = true; sinonXhr.autoRespond = true;
var tpl = sandbox({ var tpl = sandbox({
...@@ -80,13 +78,18 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A ...@@ -80,13 +78,18 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A
).text(videoListEntryTemplate) ).text(videoListEntryTemplate)
); );
spyOn(messenger, 'initialize');
spyOn(messenger, 'render').andReturn(messenger);
spyOn(messenger, 'showError');
spyOn(messenger, 'hideError');
spyOn(Utils, 'command').andCallThrough(); spyOn(Utils, 'command').andCallThrough();
spyOn(abstractEditor, 'initialize').andCallThrough(); spyOn(abstractEditor, 'initialize').andCallThrough();
spyOn(abstractEditor, 'render').andCallThrough(); spyOn(abstractEditor, 'render').andCallThrough();
spyOn(console, 'error');
messenger = jasmine.createSpyObj('MessageManager',[
'initialize', 'render', 'showError', 'hideError'
]);
$.each(messenger, function(index, method) {
method.andReturn(messenger);
});
MessageManager = function () { MessageManager = function () {
messenger.initialize(); messenger.initialize();
...@@ -96,11 +99,10 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A ...@@ -96,11 +99,10 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A
$el = $('.component'); $el = $('.component');
spyOn(console, 'error');
view = new VideoList({ view = new VideoList({
el: $el, el: $el,
model: model model: model,
MessageManager: MessageManager
}); });
this.addMatchers({ this.addMatchers({
...@@ -126,11 +128,9 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A ...@@ -126,11 +128,9 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A
}); });
afterEach(function () { afterEach(function () {
MessageManager = correctMessanger;
sinonXhr.restore(); sinonXhr.restore();
}); });
var waitsForResponse = function (expectFunc, prep) { var waitsForResponse = function (expectFunc, prep) {
var flag = false; var flag = false;
...@@ -145,6 +145,7 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A ...@@ -145,6 +145,7 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A
if (len && req[0].readyState === 4) { if (len && req[0].readyState === 4) {
flag = true; flag = true;
} }
return flag; return flag;
}, "Ajax Timeout", 750); }, "Ajax Timeout", 750);
...@@ -153,11 +154,13 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A ...@@ -153,11 +154,13 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A
it('Initialize', function () { it('Initialize', function () {
waitsForResponse(function () {
expect(abstractEditor.initialize).toHaveBeenCalled(); expect(abstractEditor.initialize).toHaveBeenCalled();
expect(messenger.initialize).toHaveBeenCalled(); expect(messenger.initialize).toHaveBeenCalled();
expect(view.component_id).toBe(component_id); expect(view.component_id).toBe(component_id);
expect(view.$el).toHandle('input'); expect(view.$el).toHandle('input');
}); });
});
describe('Render', function () { describe('Render', function () {
var assertToHaveBeenRendered = function (videoList) { var assertToHaveBeenRendered = function (videoList) {
...@@ -263,12 +266,16 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A ...@@ -263,12 +266,16 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A
describe('isUniqVideoTypes', function () { describe('isUniqVideoTypes', function () {
it('Unique data - return true', function () { it('Unique data - return true', function () {
var data = videoList, var data = videoList;
result = view.isUniqVideoTypes(data);
waitsForResponse(function () {
var result = view.isUniqVideoTypes(data);
expect(result).toBe(true); expect(result).toBe(true);
}); });
});
it('Not Unique data - return false', function () { it('Not Unique data - return false', function () {
var data = [ var data = [
{ {
...@@ -286,12 +293,15 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A ...@@ -286,12 +293,15 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A
type: "youtube", type: "youtube",
video: "12345678901" video: "12345678901"
} }
], ];
result = view.isUniqVideoTypes(data);
waitsForResponse(function () {
var result = view.isUniqVideoTypes(data);
expect(result).toBe(false); expect(result).toBe(false);
}); });
}); });
});
describe('checkIsUniqVideoTypes', function () { describe('checkIsUniqVideoTypes', function () {
...@@ -312,15 +322,20 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A ...@@ -312,15 +322,20 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A
type: "youtube", type: "youtube",
video: "12345678901" video: "12345678901"
} }
], ];
result = view.checkIsUniqVideoTypes(data);
waitsForResponse(function () {
var result = view.checkIsUniqVideoTypes(data);
expect(messenger.showError).toHaveBeenCalled(); expect(messenger.showError).toHaveBeenCalled();
expect(result).toBe(false); expect(result).toBe(false);
}); });
});
it('All works okay if arguments are not passed', function () { it('All works okay if arguments are not passed', function () {
spyOn(view, 'getVideoObjectsList').andReturn(videoList); spyOn(view, 'getVideoObjectsList').andReturn(videoList);
waitsForResponse(function () {
var result = view.checkIsUniqVideoTypes(); var result = view.checkIsUniqVideoTypes();
expect(view.getVideoObjectsList).toHaveBeenCalled(); expect(view.getVideoObjectsList).toHaveBeenCalled();
...@@ -328,6 +343,7 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A ...@@ -328,6 +343,7 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A
expect(result).toBe(true); expect(result).toBe(true);
}); });
}); });
});
describe('checkValidity', function () { describe('checkValidity', function () {
beforeEach(function () { beforeEach(function () {
...@@ -335,6 +351,7 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A ...@@ -335,6 +351,7 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A
}); });
it('Error message are shown', function () { it('Error message are shown', function () {
waitsForResponse(function () {
var data = { mode: 'incorrect' }, var data = { mode: 'incorrect' },
result = view.checkValidity(data, true); result = view.checkValidity(data, true);
...@@ -342,8 +359,10 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A ...@@ -342,8 +359,10 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A
expect(view.checkIsUniqVideoTypes).toHaveBeenCalled(); expect(view.checkIsUniqVideoTypes).toHaveBeenCalled();
expect(result).toBe(false); expect(result).toBe(false);
}); });
});
it('Error message are shown when flag is not passed', function () { it('Error message are shown when flag is not passed', function () {
waitsForResponse(function () {
var data = { mode: 'incorrect' }, var data = { mode: 'incorrect' },
result = view.checkValidity(data); result = view.checkValidity(data);
...@@ -351,8 +370,10 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A ...@@ -351,8 +370,10 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A
expect(view.checkIsUniqVideoTypes).toHaveBeenCalled(); expect(view.checkIsUniqVideoTypes).toHaveBeenCalled();
expect(result).toBe(true); expect(result).toBe(true);
}); });
});
it('All works okay if correct data is passed', function () { it('All works okay if correct data is passed', function () {
waitsForResponse(function () {
var data = videoList, var data = videoList,
result = view.checkValidity(data); result = view.checkValidity(data);
...@@ -361,36 +382,47 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A ...@@ -361,36 +382,47 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A
expect(result).toBe(true); expect(result).toBe(true);
}); });
}); });
});
it('openExtraVideosBar', function () { it('openExtraVideosBar', function () {
waitsForResponse(function () {
view.$extraVideosBar.removeClass('is-visible'); view.$extraVideosBar.removeClass('is-visible');
view.openExtraVideosBar(); view.openExtraVideosBar();
expect(view.$extraVideosBar).toHaveClass('is-visible'); expect(view.$extraVideosBar).toHaveClass('is-visible');
}); });
});
it('closeExtraVideosBar', function () { it('closeExtraVideosBar', function () {
waitsForResponse(function () {
view.$extraVideosBar.addClass('is-visible'); view.$extraVideosBar.addClass('is-visible');
view.closeExtraVideosBar(); view.closeExtraVideosBar();
expect(view.$extraVideosBar).not.toHaveClass('is-visible'); expect(view.$extraVideosBar).not.toHaveClass('is-visible');
}); });
});
it('toggleExtraVideosBar', function () { it('toggleExtraVideosBar', function () {
waitsForResponse(function () {
view.$extraVideosBar.addClass('is-visible'); view.$extraVideosBar.addClass('is-visible');
view.toggleExtraVideosBar(); view.toggleExtraVideosBar();
expect(view.$extraVideosBar).not.toHaveClass('is-visible'); expect(view.$extraVideosBar).not.toHaveClass('is-visible');
view.toggleExtraVideosBar(); view.toggleExtraVideosBar();
expect(view.$extraVideosBar).toHaveClass('is-visible'); expect(view.$extraVideosBar).toHaveClass('is-visible');
}); });
});
it('getValueFromEditor', function () { it('getValueFromEditor', function () {
waitsForResponse(function () {
expect(view).assertValueInView(modelStub.value); expect(view).assertValueInView(modelStub.value);
}); });
});
it('setValueInEditor', function () { it('setValueInEditor', function () {
waitsForResponse(function () {
expect(view).assertCanUpdateView(['abc.mp4']); expect(view).assertCanUpdateView(['abc.mp4']);
}); });
});
it('getVideoObjectsList', function () { it('getVideoObjectsList', function () {
var value = [ var value = [
...@@ -406,6 +438,7 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A ...@@ -406,6 +438,7 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A
} }
]; ];
waitsForResponse(function () {
view.setValueInEditor([ view.setValueInEditor([
'http://youtu.be/12345678901', 'http://youtu.be/12345678901',
'video.mp4', 'video.mp4',
...@@ -413,6 +446,7 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A ...@@ -413,6 +446,7 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A
]); ]);
expect(view).assertIsCorrectVideoList(value); expect(view).assertIsCorrectVideoList(value);
}); });
});
describe('getPlaceholders', function () { describe('getPlaceholders', function () {
var defaultPlaceholders; var defaultPlaceholders;
...@@ -422,11 +456,13 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A ...@@ -422,11 +456,13 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A
}); });
it('All works okay if empty values are passed', function () { it('All works okay if empty values are passed', function () {
waitsForResponse(function () {
var result = view.getPlaceholders([]), var result = view.getPlaceholders([]),
expectedResult = _.values(defaultPlaceholders).reverse(); expectedResult = _.values(defaultPlaceholders).reverse();
expect(result).toEqual(expectedResult); expect(result).toEqual(expectedResult);
}); });
});
it('On filling less than 3 fields, remaining fields should have ' + it('On filling less than 3 fields, remaining fields should have ' +
...@@ -459,11 +495,13 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A ...@@ -459,11 +495,13 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A
} }
}; };
waitsForResponse(function () {
$.each(dataDict, function(index, val) { $.each(dataDict, function(index, val) {
var result = view.getPlaceholders(val.value); var result = view.getPlaceholders(val.value);
expect(result).toEqual(val.expectedResult); expect(result).toEqual(val.expectedResult);
}); });
});
} }
); );
}); });
...@@ -496,13 +534,15 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A ...@@ -496,13 +534,15 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A
function () { function () {
$.fn.hasClass.andReturn(false); $.fn.hasClass.andReturn(false);
view.checkValidity.andReturn(false); view.checkValidity.andReturn(false);
view.inputHandler(eventObject);
waitsForResponse(function () {
view.inputHandler(eventObject);
expect(messenger.hideError).not.toHaveBeenCalled(); expect(messenger.hideError).not.toHaveBeenCalled();
expect(view.updateModel).not.toHaveBeenCalled(); expect(view.updateModel).not.toHaveBeenCalled();
expect(view.closeExtraVideosBar).not.toHaveBeenCalled(); expect(view.closeExtraVideosBar).not.toHaveBeenCalled();
expect($.fn.prop).toHaveBeenCalledWith('disabled', true); expect($.fn.prop).toHaveBeenCalledWith('disabled', true);
expect($.fn.addClass).toHaveBeenCalledWith('is-disabled'); expect($.fn.addClass).toHaveBeenCalledWith('is-disabled');
});
} }
); );
...@@ -510,13 +550,15 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A ...@@ -510,13 +550,15 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A
function () { function () {
$.fn.hasClass.andReturn(true); $.fn.hasClass.andReturn(true);
view.checkValidity.andReturn(false); view.checkValidity.andReturn(false);
view.inputHandler(eventObject);
waitsForResponse(function () {
view.inputHandler(eventObject);
expect(messenger.hideError).not.toHaveBeenCalled(); expect(messenger.hideError).not.toHaveBeenCalled();
expect(view.updateModel).not.toHaveBeenCalled(); expect(view.updateModel).not.toHaveBeenCalled();
expect(view.closeExtraVideosBar).toHaveBeenCalled(); expect(view.closeExtraVideosBar).toHaveBeenCalled();
expect($.fn.prop).toHaveBeenCalledWith('disabled', true); expect($.fn.prop).toHaveBeenCalledWith('disabled', true);
expect($.fn.addClass).toHaveBeenCalledWith('is-disabled'); expect($.fn.addClass).toHaveBeenCalledWith('is-disabled');
});
} }
); );
...@@ -524,13 +566,15 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A ...@@ -524,13 +566,15 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A
function () { function () {
view.checkValidity.andReturn(true); view.checkValidity.andReturn(true);
_.isEqual.andReturn(false); _.isEqual.andReturn(false);
view.inputHandler(eventObject);
waitsForResponse(function () {
view.inputHandler(eventObject);
expect(messenger.hideError).not.toHaveBeenCalled(); expect(messenger.hideError).not.toHaveBeenCalled();
expect(view.updateModel).toHaveBeenCalled(); expect(view.updateModel).toHaveBeenCalled();
expect(view.closeExtraVideosBar).not.toHaveBeenCalled(); expect(view.closeExtraVideosBar).not.toHaveBeenCalled();
expect($.fn.prop).toHaveBeenCalledWith('disabled', false); expect($.fn.prop).toHaveBeenCalledWith('disabled', false);
expect($.fn.removeClass).toHaveBeenCalledWith('is-disabled'); expect($.fn.removeClass).toHaveBeenCalledWith('is-disabled');
});
} }
); );
...@@ -538,13 +582,15 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A ...@@ -538,13 +582,15 @@ function ($, _, Utils, VideoList, MessageManager, MetadataView, MetadataModel, A
function () { function () {
view.checkValidity.andReturn(true); view.checkValidity.andReturn(true);
_.isEqual.andReturn(true); _.isEqual.andReturn(true);
view.inputHandler(eventObject);
waitsForResponse(function () {
view.inputHandler(eventObject);
expect(messenger.hideError).toHaveBeenCalled(); expect(messenger.hideError).toHaveBeenCalled();
expect(view.updateModel).not.toHaveBeenCalled(); expect(view.updateModel).not.toHaveBeenCalled();
expect(view.closeExtraVideosBar).not.toHaveBeenCalled(); expect(view.closeExtraVideosBar).not.toHaveBeenCalled();
expect($.fn.prop).toHaveBeenCalledWith('disabled', false); expect($.fn.prop).toHaveBeenCalledWith('disabled', false);
expect($.fn.removeClass).toHaveBeenCalledWith('is-disabled'); expect($.fn.removeClass).toHaveBeenCalledWith('is-disabled');
});
} }
); );
......
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