Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: some refactor and fixes
  • Loading branch information
filippovskii09 committed Dec 2, 2025
commit 6214e8fcd3458a19510aea5464de1df4ccf5e8b6
2 changes: 1 addition & 1 deletion src/course-home/dates-tab/DatesTab.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { sendTrackEvent } from '@edx/frontend-platform/analytics';
import { useIntl } from '@edx/frontend-platform/i18n';

import { MAIN_CONTENT_ID } from '@src/constants';
import { useScrollToContent } from '@src/generic/hooks';
import messages from './messages';
import Timeline from './timeline/Timeline';

Expand All @@ -14,7 +15,6 @@ import SuggestedScheduleHeader from '../suggested-schedule-messaging/SuggestedSc
import ShiftDatesAlert from '../suggested-schedule-messaging/ShiftDatesAlert';
import UpgradeToCompleteAlert from '../suggested-schedule-messaging/UpgradeToCompleteAlert';
import UpgradeToShiftDatesAlert from '../suggested-schedule-messaging/UpgradeToShiftDatesAlert';
import { useScrollToContent } from '../../generic/hooks';

const DatesTab = () => {
const intl = useIntl();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
waitFor,
} from '../../../../setupTest';
import UnitButton from './UnitButton';
import messages from './messages';

describe('Unit Button', () => {
let mockData;
Expand Down Expand Up @@ -112,7 +113,7 @@ describe('Unit Button', () => {
const { container } = render(
<>
<UnitButton {...mockData} />
<button id="bookmark-button" type="button">Bookmark</button>
<button id="bookmark-button" type="button">{messages.bookmark.defaultMessage}</button>
</>,
{ wrapWithRouter: true },
);
Expand All @@ -136,7 +137,7 @@ describe('Unit Button', () => {
const { container } = render(
<>
<UnitButton {...mockData} onClick={onClick} />
<button id="bookmark-button" type="button">Bookmark</button>
<button id="bookmark-button" type="button">{messages.bookmark.defaultMessage}</button>
</>,
{ wrapWithRouter: true },
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ const messages = defineMessages({
defaultMessage: 'Previous',
description: 'Button to return to the previous section',
},
bookmark: {
id: 'learning.generic.bookmark',
defaultMessage: 'Bookmark',
description: 'Button text for bookmarking',
},
});

export default messages;
4 changes: 2 additions & 2 deletions src/generic/hooks.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe('Hooks', () => {
test('should scroll to target element and focus', async () => {
render(<TestComponent />);

const skipLink = screen.getByRole('link', { name: /skip to content/i });
const skipLink = screen.getByRole('link', { name: new RegExp(messages.skipToContent.defaultMessage, 'i') });
const targetContent = screen.getByTestId('target-content');

targetContent.focus = jest.fn();
Expand Down Expand Up @@ -114,7 +114,7 @@ describe('Hooks', () => {

render(<ComponentWithoutTarget />);

const skipLink = screen.getByRole('link', { name: /skip to content/i });
const skipLink = screen.getByRole('link', { name: new RegExp(messages.skipToContent.defaultMessage, 'i') });

await userEvent.click(skipLink);

Expand Down