Merge pull request #12312 from edx/usman/tnl4398-fix-tests
Re-enable spec files that were disabled during the Jasmine upgrade.
This commit is contained in:
@@ -5,8 +5,9 @@ define(
|
||||
"xmodule", "jquery.form"
|
||||
],
|
||||
function ($, _, Utils, FileUploader) {
|
||||
// TODO: fix TNL-559 Intermittent failures of Transcript FileUploader JS tests
|
||||
xdescribe('Transcripts.FileUploader', function () {
|
||||
'use strict';
|
||||
|
||||
describe('Transcripts.FileUploader', function () {
|
||||
var videoListEntryTemplate = readFixtures(
|
||||
'video/transcripts/metadata-videolist-entry.underscore'
|
||||
),
|
||||
@@ -67,10 +68,9 @@ function ($, _, Utils, FileUploader) {
|
||||
it('Template doesn\'t exist', function () {
|
||||
spyOn(console, 'error');
|
||||
view.uploadTpl = '';
|
||||
view.render();
|
||||
|
||||
expect(console.error).toHaveBeenCalled();
|
||||
expect(view.render).not.toThrow();
|
||||
expect(console.error).toHaveBeenCalled();
|
||||
expect(_.template).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
@@ -78,8 +78,6 @@ function ($, _, Utils, FileUploader) {
|
||||
function () {
|
||||
$('.transcripts-file-uploader').remove();
|
||||
|
||||
view.render();
|
||||
|
||||
expect(view.render).not.toThrow();
|
||||
expect(_.template).not.toHaveBeenCalled();
|
||||
}
|
||||
@@ -93,8 +91,6 @@ function ($, _, Utils, FileUploader) {
|
||||
}).join(', ');
|
||||
|
||||
view.validFileExtensions = validFileExtensions;
|
||||
view.render();
|
||||
|
||||
expect(view.render).not.toThrow();
|
||||
expect(_.template).toHaveBeenCalled();
|
||||
$.each(elList, function(index, el) {
|
||||
|
||||
@@ -6,9 +6,9 @@ define(
|
||||
"xmodule"
|
||||
],
|
||||
function ($, _, Utils, MessageManager, FileUploader, sinon) {
|
||||
'use strict';
|
||||
|
||||
// TODO: fix TNL-559 Intermittent failures of Transcript FileUploader JS tests
|
||||
xdescribe('Transcripts.MessageManager', function () {
|
||||
describe('Transcripts.MessageManager', function () {
|
||||
var videoListEntryTemplate = readFixtures(
|
||||
'video/transcripts/metadata-videolist-entry.underscore'
|
||||
),
|
||||
@@ -46,7 +46,7 @@ function ($, _, Utils, MessageManager, FileUploader, sinon) {
|
||||
);
|
||||
$container = $('#metadata-videolist-entry');
|
||||
|
||||
spyOn(fileUploader, 'initialize');
|
||||
spyOn(fileUploader, 'initialize').and.callThrough();
|
||||
spyOn(console, 'error');
|
||||
spyOn(Utils.Storage, 'set');
|
||||
|
||||
@@ -66,12 +66,11 @@ function ($, _, Utils, MessageManager, FileUploader, sinon) {
|
||||
});
|
||||
});
|
||||
|
||||
// Disabled 2/6/14 after intermittent failure in master
|
||||
describe('Render', function () {
|
||||
|
||||
beforeEach(function () {
|
||||
spyOn(_,'template').and.callThrough();
|
||||
spyOn(fileUploader, 'render');
|
||||
spyOn(view.fileUploader, 'render');
|
||||
});
|
||||
|
||||
it('Template doesn\'t exist', function () {
|
||||
@@ -81,7 +80,7 @@ function ($, _, Utils, MessageManager, FileUploader, sinon) {
|
||||
expect(_.template).not.toHaveBeenCalled();
|
||||
expect(view.$el.find('.transcripts-status'))
|
||||
.toHaveClass('is-invisible');
|
||||
expect(fileUploader.render).not.toHaveBeenCalled();
|
||||
expect(view.fileUploader.render).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('All works okay if correct data is passed', function () {
|
||||
@@ -90,7 +89,7 @@ function ($, _, Utils, MessageManager, FileUploader, sinon) {
|
||||
expect(console.error).not.toHaveBeenCalled();
|
||||
expect(_.template).toHaveBeenCalled();
|
||||
expect(view.$el).not.toHaveClass('is-invisible');
|
||||
expect(fileUploader.render).toHaveBeenCalled();
|
||||
expect(view.fileUploader.render).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -15,21 +15,13 @@ function($, date, TriggerChangeEventOnEnter) {
|
||||
var timefield = $(div).find("input.time");
|
||||
var cacheview = view;
|
||||
var setfield = function (event) {
|
||||
var newVal = getDate(datefield, timefield),
|
||||
oldTime = new Date(cacheModel.get(fieldName)).getTime();
|
||||
if (newVal) {
|
||||
if (!cacheModel.has(fieldName) || oldTime !== newVal.getTime()) {
|
||||
cacheview.clearValidationErrors();
|
||||
cacheview.setAndValidate(fieldName, newVal, event);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Clear date (note that this clears the time as well, as date and time are linked).
|
||||
// Note also that the validation logic prevents us from clearing the start date
|
||||
// (start date is required by the back end).
|
||||
cacheview.clearValidationErrors();
|
||||
cacheview.setAndValidate(fieldName, null, event);
|
||||
}
|
||||
var newVal = getDate(datefield, timefield);
|
||||
|
||||
// Setting to null clears the time as well, as date and time are linked.
|
||||
// Note also that the validation logic prevents us from clearing the start date
|
||||
// (start date is required by the back end).
|
||||
cacheview.clearValidationErrors();
|
||||
cacheview.setAndValidate(fieldName, (newVal || null), event);
|
||||
};
|
||||
|
||||
// instrument as date and time pickers
|
||||
|
||||
@@ -71,7 +71,7 @@ define(["js/views/validation", "codemirror", "js/models/course_update",
|
||||
},
|
||||
|
||||
handleValidationError : function(model, error) {
|
||||
var ele = this.$el.find('#course-update-list li[name=\"'+model.cid+'\"');
|
||||
var ele = this.$el.find('#course-update-list li[name=\"'+model.cid+'\"]');
|
||||
$(ele).find('.message-error').remove();
|
||||
for (var field in error) {
|
||||
if (error.hasOwnProperty(field)) {
|
||||
@@ -86,7 +86,7 @@ define(["js/views/validation", "codemirror", "js/models/course_update",
|
||||
|
||||
validateModel: function(model) {
|
||||
if (model.isValid()) {
|
||||
var ele = this.$el.find('#course-update-list li[name=\"' + model.cid + '\"');
|
||||
var ele = this.$el.find('#course-update-list li[name=\"' + model.cid + '\"]');
|
||||
$(ele).find('.message-error').remove();
|
||||
$(ele).find('.save-button').removeClass('is-disabled');
|
||||
}
|
||||
|
||||
@@ -19,7 +19,8 @@ function($, Backbone, _, Utils) {
|
||||
|
||||
initialize: function (options) {
|
||||
_.bindAll(this,
|
||||
'changeHandler', 'clickHandler', 'xhrResetProgressBar', 'xhrProgressHandler', 'xhrCompleteHandler'
|
||||
'changeHandler', 'clickHandler', 'xhrResetProgressBar', 'xhrProgressHandler', 'xhrCompleteHandler',
|
||||
'render'
|
||||
);
|
||||
this.options = _.extend({}, options);
|
||||
this.file = false;
|
||||
|
||||
Reference in New Issue
Block a user