From 8d49f2ed4e23ead5b36be05c8896b84294906969 Mon Sep 17 00:00:00 2001 From: Braden MacDonald Date: Thu, 19 Sep 2024 12:34:48 -0700 Subject: [PATCH] feat: display library title in browser tab (#1305) --- src/library-authoring/LibraryAuthoringPage.test.tsx | 6 ++++++ src/library-authoring/LibraryAuthoringPage.tsx | 2 ++ 2 files changed, 8 insertions(+) diff --git a/src/library-authoring/LibraryAuthoringPage.test.tsx b/src/library-authoring/LibraryAuthoringPage.test.tsx index 33a89a3efb..4bd1542856 100644 --- a/src/library-authoring/LibraryAuthoringPage.test.tsx +++ b/src/library-authoring/LibraryAuthoringPage.test.tsx @@ -1,4 +1,6 @@ +import { getConfig } from '@edx/frontend-platform'; import fetchMock from 'fetch-mock-jest'; +import { Helmet } from 'react-helmet'; import { fireEvent, initializeMocks, @@ -122,6 +124,10 @@ describe('', () => { 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 diff --git a/src/library-authoring/LibraryAuthoringPage.tsx b/src/library-authoring/LibraryAuthoringPage.tsx index 50b4047a34..3f0a680a3b 100644 --- a/src/library-authoring/LibraryAuthoringPage.tsx +++ b/src/library-authoring/LibraryAuthoringPage.tsx @@ -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'; @@ -156,6 +157,7 @@ const LibraryAuthoringPage = () => { return (
+ {libraryData.title} | {process.env.SITE_NAME}