Skip to content

Commit c37e7be

Browse files
✅(frontend) cover presenter divider hint
Exercise hint display, dismissal, and divider detection. Keep coverage scoped to title-slide guidance.
1 parent 98ed464 commit c37e7be

2 files changed

Lines changed: 51 additions & 0 deletions

File tree

src/frontend/apps/e2e/__tests__/app-impress/presenter-mode.spec.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ import {
1515
writeInEditor,
1616
} from './utils-editor';
1717

18+
const dividerHintText =
19+
'You can use the divider to tell Docs where to split your slides';
20+
1821
const openPresenter = async (page: Page) => {
1922
await page.getByLabel('Open the document options').click();
2023
await page.getByRole('menuitem', { name: 'Present' }).click();
@@ -151,6 +154,36 @@ test.describe('Presenter Mode', () => {
151154
await expect(overlay).toBeHidden();
152155
});
153156

157+
test('shows and dismisses the divider hint on the title slide', async ({
158+
page,
159+
browserName,
160+
}) => {
161+
await createDoc(page, 'presenter-divider-hint', browserName, 1);
162+
await writeInEditor({ page, text: 'Hello presenter' });
163+
164+
const overlay = await openPresenter(page);
165+
166+
await expect(overlay.getByText(dividerHintText)).toBeVisible();
167+
await overlay.getByRole('button', { name: /^Close$/ }).click();
168+
await expect(overlay.getByText(dividerHintText)).toBeHidden();
169+
170+
await overlay.getByRole('button', { name: 'Next slide' }).click();
171+
await overlay.getByRole('button', { name: 'Previous slide' }).click();
172+
await expect(overlay.getByText(dividerHintText)).toBeHidden();
173+
});
174+
175+
test('hides the divider hint when the document already has a divider', async ({
176+
page,
177+
browserName,
178+
}) => {
179+
await createDoc(page, 'presenter-divider-hint-hidden', browserName, 1);
180+
await writeMultiSlideDoc(page);
181+
182+
const overlay = await openPresenter(page);
183+
184+
await expect(overlay.getByText(dividerHintText)).toBeHidden();
185+
});
186+
154187
test('moves focus onto the first available control when opened', async ({
155188
page,
156189
browserName,

src/frontend/apps/impress/src/features/docs/doc-presenter/__tests__/useSlides.spec.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { describe, expect, test } from 'vitest';
33
import {
44
getContentSlideIndexForBlock,
55
getSlideTitle,
6+
hasDividerBlock,
67
splitBlocksIntoSlides,
78
} from '../hooks/useSlides';
89

@@ -195,6 +196,23 @@ describe('splitBlocksIntoSlides', () => {
195196
});
196197
});
197198

199+
describe('hasDividerBlock', () => {
200+
test('returns false when the document has no divider', () => {
201+
expect(hasDividerBlock([para('a'), para('b')])).toBe(false);
202+
});
203+
204+
test('detects dividers nested in the block tree', () => {
205+
const parent = {
206+
...para('parent'),
207+
children: [para('nested'), divider()],
208+
};
209+
210+
expect(hasDividerBlock([para('a'), quote('intro'), para('b')])).toBe(false);
211+
expect(hasDividerBlock([para('a'), quote('intro'), divider()])).toBe(true);
212+
expect(hasDividerBlock([para('a'), parent])).toBe(true);
213+
});
214+
});
215+
198216
describe('getContentSlideIndexForBlock', () => {
199217
test('returns the slide containing a regular block', () => {
200218
expect(

0 commit comments

Comments
 (0)