Skip to content

Commit

Permalink
feat: display library title in browser tab (openedx#1305)
Browse files Browse the repository at this point in the history
  • Loading branch information
bradenmacdonald authored Sep 19, 2024
1 parent f3274e7 commit 8d49f2e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/library-authoring/LibraryAuthoringPage.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { getConfig } from '@edx/frontend-platform';
import fetchMock from 'fetch-mock-jest';
import { Helmet } from 'react-helmet';
import {
fireEvent,
initializeMocks,
Expand Down Expand Up @@ -122,6 +124,10 @@ describe('<LibraryAuthoringPage />', () => {
expect(await screen.findByText('Content library')).toBeInTheDocument();
expect((await screen.findAllByText(libraryTitle))[0]).toBeInTheDocument();

const browserTabTitle = Helmet.peek().title.join('');
const siteName = getConfig().SITE_NAME;
expect(browserTabTitle).toEqual(`${libraryTitle} | ${siteName}`);

expect(screen.queryByText('You have not added any content to this library yet.')).not.toBeInTheDocument();

// "Recently Modified" header + sort shown
Expand Down
2 changes: 2 additions & 0 deletions src/library-authoring/LibraryAuthoringPage.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useContext, useEffect } from 'react';
import { Helmet } from 'react-helmet';
import classNames from 'classnames';
import { StudioFooter } from '@edx/frontend-component-footer';
import { useIntl } from '@edx/frontend-platform/i18n';
Expand Down Expand Up @@ -156,6 +157,7 @@ const LibraryAuthoringPage = () => {
return (
<div className="d-flex">
<div className="flex-grow-1">
<Helmet><title>{libraryData.title} | {process.env.SITE_NAME}</title></Helmet>
<Header
number={libraryData.slug}
title={libraryData.title}
Expand Down

0 comments on commit 8d49f2e

Please sign in to comment.