Commit 1897fb65 by cahrens Committed by Andy Armstrong

Update for paged container not having a visibility editor.

parent 4b00566e
...@@ -15,7 +15,8 @@ define(["jquery", "underscore", "underscore.string", "js/common_helpers/ajax_hel ...@@ -15,7 +15,8 @@ define(["jquery", "underscore", "underscore.string", "js/common_helpers/ajax_hel
mockUpdatedContainerXBlockHtml = readFixtures('mock/mock-updated-container-xblock.underscore'), mockUpdatedContainerXBlockHtml = readFixtures('mock/mock-updated-container-xblock.underscore'),
mockXBlockEditorHtml = readFixtures('mock/mock-xblock-editor.underscore'), mockXBlockEditorHtml = readFixtures('mock/mock-xblock-editor.underscore'),
mockXBlockVisibilityEditorHtml = readFixtures('mock/mock-xblock-visibility-editor.underscore'), mockXBlockVisibilityEditorHtml = readFixtures('mock/mock-xblock-visibility-editor.underscore'),
PageClass = fixtures.page; PageClass = fixtures.page,
hasVisibilityEditor = fixtures.has_visibility_editor;
beforeEach(function () { beforeEach(function () {
var newDisplayName = 'New Display Name'; var newDisplayName = 'New Display Name';
...@@ -221,19 +222,24 @@ define(["jquery", "underscore", "underscore.string", "js/common_helpers/ajax_hel ...@@ -221,19 +222,24 @@ define(["jquery", "underscore", "underscore.string", "js/common_helpers/ajax_hel
expect(EditHelpers.isShowingModal()).toBeTruthy(); expect(EditHelpers.isShowingModal()).toBeTruthy();
}); });
it('can show a visibility modal for a child xblock', function() { it('can show a visibility modal for a child xblock if supported for the page', function() {
var visibilityButtons; var visibilityButtons;
renderContainerPage(this, mockContainerXBlockHtml); renderContainerPage(this, mockContainerXBlockHtml);
visibilityButtons = containerPage.$('.wrapper-xblock .visibility-button'); visibilityButtons = containerPage.$('.wrapper-xblock .visibility-button');
expect(visibilityButtons.length).toBe(6); if (hasVisibilityEditor) {
visibilityButtons[0].click(); expect(visibilityButtons.length).toBe(6);
expect(str.startsWith(lastRequest().url, '/xblock/locator-component-A1/visibility_view')) visibilityButtons[0].click();
.toBeTruthy(); expect(str.startsWith(lastRequest().url, '/xblock/locator-component-A1/visibility_view'))
AjaxHelpers.respondWithJson(requests, { .toBeTruthy();
html: mockXBlockVisibilityEditorHtml, AjaxHelpers.respondWithJson(requests, {
resources: [] html: mockXBlockVisibilityEditorHtml,
}); resources: []
expect(EditHelpers.isShowingModal()).toBeTruthy(); });
expect(EditHelpers.isShowingModal()).toBeTruthy();
}
else {
expect(visibilityButtons.length).toBe(0);
}
}); });
}); });
...@@ -593,7 +599,8 @@ define(["jquery", "underscore", "underscore.string", "js/common_helpers/ajax_hel ...@@ -593,7 +599,8 @@ define(["jquery", "underscore", "underscore.string", "js/common_helpers/ajax_hel
{ {
page: ContainerPage, page: ContainerPage,
initial: 'mock/mock-container-xblock.underscore', initial: 'mock/mock-container-xblock.underscore',
add_response: 'mock/mock-xblock.underscore' add_response: 'mock/mock-xblock.underscore',
has_visibility_editor: true
} }
); );
parameterized_suite("Paged", parameterized_suite("Paged",
...@@ -601,6 +608,7 @@ define(["jquery", "underscore", "underscore.string", "js/common_helpers/ajax_hel ...@@ -601,6 +608,7 @@ define(["jquery", "underscore", "underscore.string", "js/common_helpers/ajax_hel
{ {
page: PagedContainerPage, page: PagedContainerPage,
initial: 'mock/mock-container-paged-xblock.underscore', initial: 'mock/mock-container-paged-xblock.underscore',
add_response: 'mock/mock-xblock-paged.underscore' add_response: 'mock/mock-xblock-paged.underscore',
has_visibility_editor: false
}); });
}); });
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