✅(frontend) cover presenter divider hint

Exercise hint display, dismissal, and divider detection.

Keep coverage scoped to title-slide guidance.
This commit is contained in:
Nathan Panchout
2026-07-07 16:58:30 +02:00
parent 98ed46467e
commit c37e7bece5
2 changed files with 51 additions and 0 deletions
@@ -15,6 +15,9 @@ import {
writeInEditor,
} from './utils-editor';
const dividerHintText =
'You can use the divider to tell Docs where to split your slides';
const openPresenter = async (page: Page) => {
await page.getByLabel('Open the document options').click();
await page.getByRole('menuitem', { name: 'Present' }).click();
@@ -151,6 +154,36 @@ test.describe('Presenter Mode', () => {
await expect(overlay).toBeHidden();
});
test('shows and dismisses the divider hint on the title slide', async ({
page,
browserName,
}) => {
await createDoc(page, 'presenter-divider-hint', browserName, 1);
await writeInEditor({ page, text: 'Hello presenter' });
const overlay = await openPresenter(page);
await expect(overlay.getByText(dividerHintText)).toBeVisible();
await overlay.getByRole('button', { name: /^Close$/ }).click();
await expect(overlay.getByText(dividerHintText)).toBeHidden();
await overlay.getByRole('button', { name: 'Next slide' }).click();
await overlay.getByRole('button', { name: 'Previous slide' }).click();
await expect(overlay.getByText(dividerHintText)).toBeHidden();
});
test('hides the divider hint when the document already has a divider', async ({
page,
browserName,
}) => {
await createDoc(page, 'presenter-divider-hint-hidden', browserName, 1);
await writeMultiSlideDoc(page);
const overlay = await openPresenter(page);
await expect(overlay.getByText(dividerHintText)).toBeHidden();
});
test('moves focus onto the first available control when opened', async ({
page,
browserName,
@@ -3,6 +3,7 @@ import { describe, expect, test } from 'vitest';
import {
getContentSlideIndexForBlock,
getSlideTitle,
hasDividerBlock,
splitBlocksIntoSlides,
} from '../hooks/useSlides';
@@ -195,6 +196,23 @@ describe('splitBlocksIntoSlides', () => {
});
});
describe('hasDividerBlock', () => {
test('returns false when the document has no divider', () => {
expect(hasDividerBlock([para('a'), para('b')])).toBe(false);
});
test('detects dividers nested in the block tree', () => {
const parent = {
...para('parent'),
children: [para('nested'), divider()],
};
expect(hasDividerBlock([para('a'), quote('intro'), para('b')])).toBe(false);
expect(hasDividerBlock([para('a'), quote('intro'), divider()])).toBe(true);
expect(hasDividerBlock([para('a'), parent])).toBe(true);
});
});
describe('getContentSlideIndexForBlock', () => {
test('returns the slide containing a regular block', () => {
expect(