TNL-2384 Refactored Studio's PagingView to use RequireJS Text and moved it to common so that it can also be used by LMS.
34 lines
1.3 KiB
JavaScript
34 lines
1.3 KiB
JavaScript
/**
|
|
* Provides helper methods for invoking Validation modal in Jasmine tests.
|
|
*/
|
|
define(['jquery', 'js/spec_helpers/modal_helpers', 'common/js/spec_helpers/template_helpers'],
|
|
function($, ModalHelpers, TemplateHelpers) {
|
|
var installValidationTemplates, checkErrorContents, undoChanges;
|
|
|
|
installValidationTemplates = function () {
|
|
ModalHelpers.installModalTemplates();
|
|
TemplateHelpers.installTemplate('validation-error-modal');
|
|
};
|
|
|
|
checkErrorContents = function(validationModal, errorObjects) {
|
|
var errorItems = validationModal.$('.error-item-message');
|
|
var i, item;
|
|
var num_items = errorItems.length;
|
|
expect(num_items).toBe(errorObjects.length);
|
|
|
|
for (i = 0; i < num_items; i++) {
|
|
item = errorItems[i];
|
|
expect(item.value).toBe(errorObjects[i].message);
|
|
}
|
|
};
|
|
|
|
undoChanges = function(validationModal) {
|
|
ModalHelpers.pressModalButton('.action-undo', validationModal);
|
|
};
|
|
|
|
return $.extend(ModalHelpers, {
|
|
'installValidationTemplates': installValidationTemplates,
|
|
'checkErrorContents': checkErrorContents,
|
|
'undoChanges': undoChanges,
|
|
});
|
|
}); |