fix: Display "details" tab as default in collections (#2027)
This commit is contained in:
committed by
GitHub
parent
260582b6f0
commit
b0e194e512
@@ -102,4 +102,20 @@ describe('Course authoring page', () => {
|
||||
expect(await wrapper.findByTestId(contentTestId)).toBeInTheDocument();
|
||||
expect(wrapper.queryByTestId('notFoundAlert')).not.toBeInTheDocument();
|
||||
});
|
||||
const mockStoreDenied = async () => {
|
||||
const studioApiBaseUrl = getConfig().STUDIO_BASE_URL;
|
||||
const courseAppsApiUrl = `${studioApiBaseUrl}/api/course_apps/v1/apps`;
|
||||
|
||||
axiosMock.onGet(
|
||||
`${courseAppsApiUrl}/${courseId}`,
|
||||
).reply(403);
|
||||
await executeThunk(fetchCourseApps(courseId), store.dispatch);
|
||||
};
|
||||
test('renders PermissionDeniedAlert when courseAppsApiStatus is DENIED', async () => {
|
||||
mockPathname = '/editor/';
|
||||
await mockStoreDenied();
|
||||
|
||||
const wrapper = render(<CourseAuthoringPage courseId={courseId} />);
|
||||
expect(await wrapper.findByTestId('permissionDeniedAlert')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -509,8 +509,8 @@ describe('<LibraryAuthoringPage />', () => {
|
||||
// Switch back to the collection
|
||||
fireEvent.click((await screen.findByText('Collection 1')));
|
||||
|
||||
// The Manage (default) tab should be selected because the collection does not have a Preview tab
|
||||
expect(screen.getByRole('tab', { name: 'Manage' })).toHaveAttribute('aria-selected', 'true');
|
||||
// The Details (default) tab should be selected because the collection does not have a Preview tab
|
||||
expect(screen.getByRole('tab', { name: 'Details' })).toHaveAttribute('aria-selected', 'true');
|
||||
});
|
||||
|
||||
const problemTypes = {
|
||||
|
||||
@@ -31,7 +31,7 @@ const CollectionInfo = () => {
|
||||
|
||||
const tab: CollectionInfoTab = (
|
||||
sidebarTab && isCollectionInfoTab(sidebarTab)
|
||||
) ? sidebarTab : COLLECTION_INFO_TABS.Manage;
|
||||
) ? sidebarTab : COLLECTION_INFO_TABS.Details;
|
||||
|
||||
const collectionId = sidebarComponentInfo?.id;
|
||||
// istanbul ignore if: this should never happen
|
||||
|
||||
@@ -444,7 +444,7 @@ describe('<LibraryCollectionPage />', () => {
|
||||
);
|
||||
axiosMock.onPatch(collectionUrl).reply(200);
|
||||
|
||||
expect(await screen.findByRole('heading')).toBeInTheDocument();
|
||||
expect(await screen.findByRole('heading', { name: /Test Collection/i })).toBeInTheDocument();
|
||||
expect(screen.queryByText(/add content/i)).not.toBeInTheDocument();
|
||||
|
||||
// Open Add content sidebar
|
||||
|
||||
Reference in New Issue
Block a user