Skip to content

Commit ec58704

Browse files
Robberthilhorstt
andauthored
fix: toolbar wrap (#137)
Create PR for one of the fixes from this mega PR: #130 Wrap the toolbar on small screens and add unit tests --------- Co-authored-by: timhilhorst <[email protected]>
1 parent 08547b6 commit ec58704

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

packages/editor-website/playwright.config.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,17 @@ export default defineConfig({
1515
projects: [
1616
{
1717
name: 'chromium',
18-
use: { ...devices['Desktop Chrome'] },
18+
use: {
19+
...devices['Desktop Chrome'],
20+
viewport: { height: 1024, width: 1280 },
21+
},
22+
},
23+
{
24+
name: 'chromium-400-zoom',
25+
use: {
26+
...devices['Desktop Chrome'],
27+
viewport: { height: 1024, width: 320 },
28+
},
1929
},
2030
],
2131
reporter: [['html', { outputFolder: 'tmp/playwright-report' }]],

packages/editor/src/components/toolbar/styles.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ import { css } from 'lit';
22

33
export default css`
44
.clippy-toolbar__wrapper {
5+
/* Wrap the toolbar to make a toolbar with many items fit on small screens. */
56
display: flex;
7+
flex-wrap: wrap;
68
gap: var(--basis-space-inline-sm);
79
background-color: var(--ma-color-paars-1);
810
border: 1px solid var(--ma-color-paars-8);

packages/editor/src/index.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,23 @@ describe('<clippy-editor>', () => {
5555

5656
expect(a11yDialog).toHaveTextContent('Geen toegankelijkheidsfouten gevonden.');
5757
});
58+
59+
it('all toolbar buttons are visible, regardless of viewport size', async () => {
60+
expect(page.getByRole('button', { name: 'Bold' })).toBeVisible();
61+
expect(page.getByRole('button', { name: 'Italic' })).toBeVisible();
62+
expect(page.getByRole('button', { name: 'Underline' })).toBeVisible();
63+
expect(page.getByRole('button', { name: 'Undo' })).toBeVisible();
64+
expect(page.getByRole('button', { name: 'Redo' })).toBeVisible();
65+
expect(page.getByRole('button', { name: 'Ordered list' })).toBeVisible();
66+
expect(page.getByRole('button', { name: 'Bullet list' })).toBeVisible();
67+
expect(page.getByRole('button', { name: 'Definition list' })).toBeVisible();
68+
expect(page.getByRole('button', { name: 'Tabel invoegen' })).toBeVisible();
69+
const toolbar = await page.getByLabelText('Werkbalk tekstbewerker').element();
70+
await toolbar.querySelector('clippy-toolbar-link').updateComplete;
71+
await toolbar.querySelector('clippy-toolbar-image-upload').updateComplete;
72+
await expect(page.getByRole('button', { name: 'Link' })).toBeVisible();
73+
expect(page.getByRole('button', { name: 'Afbeelding' })).toBeVisible();
74+
expect(page.getByRole('button', { name: 'Keyboard shortcuts' })).toBeVisible();
75+
expect(page.getByRole('button', { name: 'Toon toegankelijkheidsfouten' })).toBeVisible();
76+
});
5877
});

0 commit comments

Comments
 (0)