diff --git a/src/course-libraries/CourseLibraries.test.tsx b/src/course-libraries/CourseLibraries.test.tsx index 06cf098e45..a6e719b6fe 100644 --- a/src/course-libraries/CourseLibraries.test.tsx +++ b/src/course-libraries/CourseLibraries.test.tsx @@ -83,7 +83,7 @@ describe('', () => { expect(reviewTab).toHaveAttribute('aria-selected', 'true'); await user.click(allTab); - const alert = await screen.findByRole('alert'); + const alert = (await screen.findAllByRole('alert'))[0]; expect(await within(alert).findByText( '5 library components are out of sync. Review updates to accept or ignore changes', )).toBeInTheDocument(); @@ -107,7 +107,7 @@ describe('', () => { await user.click(allTab); expect(allTab).toHaveAttribute('aria-selected', 'true'); - const alert = await screen.findByRole('alert'); + const alert = (await screen.findAllByRole('alert'))[0]; expect(await within(alert).findByText( '5 library components are out of sync. Review updates to accept or ignore changes', )).toBeInTheDocument(); @@ -136,7 +136,7 @@ describe('', () => { expect(reviewTab).toHaveAttribute('aria-selected', 'true'); await user.click(allTab); - const alert = await screen.findByRole('alert'); + const alert = (await screen.findAllByRole('alert'))[0]; expect(await within(alert).findByText( '5 library components are out of sync. Review updates to accept or ignore changes', )).toBeInTheDocument(); @@ -160,7 +160,7 @@ describe('', () => { screen.logTestingPlaygroundURL(); - expect(screen.queryByRole('alert')).not.toBeInTheDocument(); + expect(screen.queryAllByRole('alert').length).toEqual(1); }); }); diff --git a/src/course-libraries/CourseLibraries.tsx b/src/course-libraries/CourseLibraries.tsx index 2d0cfadf0f..6cdab34d6f 100644 --- a/src/course-libraries/CourseLibraries.tsx +++ b/src/course-libraries/CourseLibraries.tsx @@ -17,9 +17,10 @@ import { Tabs, } from '@openedx/paragon'; import { - Cached, CheckCircle, Launch, Loop, + Cached, CheckCircle, Launch, Loop, Info, } from '@openedx/paragon/icons'; +import AlertMessage from '@src/generic/alert-message'; import sumBy from 'lodash/sumBy'; import { useSearchParams } from 'react-router-dom'; import getPageHeadTitle from '../generic/utils'; @@ -199,6 +200,12 @@ export const CourseLibraries: React.FC = ({ courseId }) => { showAlert={showReviewAlert && tabKey === CourseLibraryTabs.all} setShowAlert={setShowReviewAlert} /> + { /* TODO: Remove this alert after implement container in this page */} + {titleComponent} - {readyToSync && ( - - )} - + {intl.formatMessage( + isDisabledEditField ? messages.cannotEditTooltip : messages.altButtonEdit, + )} + + )} iconAs={EditIcon} onClick={onClickEdit} // @ts-ignore @@ -203,6 +210,15 @@ const CardHeader = ({ )} {extraActionsComponent} + {readyToSync && ( + {intl.formatMessage(messages.readyToSyncButtonAlt)}} + onClick={onClickSync} + /> + )} ', () => { // Should open compare preview modal expect(screen.getByRole('heading', { name: /preview changes: unit name/i })).toBeInTheDocument(); - expect(screen.getByText('Preview not available')).toBeInTheDocument(); + expect(screen.getByText('Preview not available for unit changes at this time')).toBeInTheDocument(); // Click on accept changes const acceptChangesButton = screen.getByText(/accept changes/i); @@ -213,7 +213,7 @@ describe('', () => { // Should open compare preview modal expect(screen.getByRole('heading', { name: /preview changes: unit name/i })).toBeInTheDocument(); - expect(screen.getByText('Preview not available')).toBeInTheDocument(); + expect(screen.getByText('Preview not available for unit changes at this time')).toBeInTheDocument(); // Click on ignore changes const ignoreChangesButton = screen.getByRole('button', { name: /ignore changes/i }); diff --git a/src/library-authoring/component-comparison/messages.ts b/src/library-authoring/component-comparison/messages.ts index 322eaee3a4..5a86fdaad5 100644 --- a/src/library-authoring/component-comparison/messages.ts +++ b/src/library-authoring/component-comparison/messages.ts @@ -19,7 +19,7 @@ const messages = defineMessages({ }, previewNotAvailable: { id: 'course-authoring.library-authoring.component-comparison.preview-not-available', - defaultMessage: 'Preview not available', + defaultMessage: 'Preview not available for unit changes at this time', description: 'Message shown when preview is not available.', }, });