Add 'Add Component' button to library page.
It looks like the 'New Course'/'New Library' buttons on the studio home page. Clicking the 'Add Component' button scrolls down to the 'Add New Component' buttons.
This commit is contained in:
committed by
E. Kolpakov
parent
0b8471d6b3
commit
fe9ae3123f
@@ -494,6 +494,15 @@ define(["jquery", "underscore", "underscore.string", "js/common_helpers/ajax_hel
|
||||
containerPage.$(".new-component .new-component-type a.single-template")[index].click();
|
||||
};
|
||||
|
||||
it('Attaches a handler to new component button', function() {
|
||||
containerPage = getContainerPage();
|
||||
containerPage.render();
|
||||
// Stub jQuery.scrollTo module.
|
||||
$.scrollTo = jasmine.createSpy('jQuery.scrollTo');
|
||||
containerPage.$('.new-component-button').click();
|
||||
expect($.scrollTo).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('sends the correct JSON to the server', function () {
|
||||
renderContainerPage(this, mockContainerXBlockHtml);
|
||||
clickNewComponent(0);
|
||||
|
||||
@@ -66,6 +66,7 @@ define(["jquery", "js/common_helpers/ajax_helpers", "js/spec_helpers/view_helper
|
||||
expect($('.create-course .wrap-error')).toHaveClass('is-shown');
|
||||
expect($('#course_creation_error')).toContainText('error message');
|
||||
expect($('.new-course-save')).toHaveClass('is-disabled');
|
||||
expect($('.new-course-save')).toHaveAttr('aria-disabled', 'true');
|
||||
});
|
||||
|
||||
it("saves new libraries", function () {
|
||||
@@ -97,6 +98,7 @@ define(["jquery", "js/common_helpers/ajax_helpers", "js/spec_helpers/view_helper
|
||||
fillInLibraryFields.apply(this, values_with_blank);
|
||||
expect($('.create-library li.field.text input[value=]').parent()).toHaveClass('error');
|
||||
expect($('.new-library-save')).toHaveClass('is-disabled');
|
||||
expect($('.new-library-save')).toHaveAttr('aria-disabled', 'true');
|
||||
$('.new-library-save').click();
|
||||
expect(requests.length).toEqual(requests_count); // Expect no new requests
|
||||
}
|
||||
@@ -123,6 +125,7 @@ define(["jquery", "js/common_helpers/ajax_helpers", "js/spec_helpers/view_helper
|
||||
expect($('.create-library .wrap-error')).toHaveClass('is-shown');
|
||||
expect($('#library_creation_error')).toContainText('error message');
|
||||
expect($('.new-library-save')).toHaveClass('is-disabled');
|
||||
expect($('.new-library-save')).toHaveAttr('aria-disabled', 'true');
|
||||
});
|
||||
|
||||
it("can switch tabs", function() {
|
||||
|
||||
Reference in New Issue
Block a user