Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/wise-cats-relax.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@drivenets/design-system': patch
---

Update dependencies
4 changes: 2 additions & 2 deletions packages/design-system/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
"@types/serve-handler": "^6.1.4",
"@typescript/native": "catalog:",
"@vitejs/plugin-react": "^6.0.4",
"@vitest/browser-playwright": "^4.1.10",
"@vitest/browser-playwright": "^5.0.0",
"@vitest/coverage-v8": "catalog:",
"babel-plugin-react-compiler": "^1.0.0",
"eslint": "catalog:",
Expand All @@ -127,7 +127,7 @@
"typescript-plugin-css-modules": "^5.2.0",
"vite": "8.1.5",
"vitest": "catalog:",
"vitest-browser-react": "^2.1.0",
"vitest-browser-react": "^2.3.0",
"zod": "^4.4.3"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ describe('DsAvatarGroup', () => {
await page.getByText('+3').hover();

const tooltip = page.getByRole('tooltip');
await expect.element(tooltip).toHaveTextContent('Fiona Gallagher');
await expect.element(tooltip).toHaveTextContent('George Miller');
await expect.element(tooltip).toHaveTextContent('Hannah Abbott');
await expect.element(tooltip).toMatchTextContent('Fiona Gallagher');
await expect.element(tooltip).toMatchTextContent('George Miller');
await expect.element(tooltip).toMatchTextContent('Hannah Abbott');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -140,16 +140,16 @@ describe('DsBreadcrumb', () => {
it('marks the last link segment as current page', async () => {
await renderWithRouter({ items: defaultItems }, '/inventory/catalog');

const catalogLink = page.getByText('Catalog');
const catalogLink = page.getByText('Catalog', { exact: false });
await expect.element(catalogLink).toHaveAttribute('aria-current', 'page');
});

it('truncates trail when navigating to a parent link', async () => {
await renderWithRouter({ items: defaultItems }, '/inventory/catalog');

await page.getByText('Inventory').click();
await page.getByText('Inventory', { exact: false }).click();

const inventoryLink = page.getByText('Inventory');
const inventoryLink = page.getByText('Inventory', { exact: false });
await expect.element(inventoryLink).toHaveAttribute('aria-current', 'page');
await expect.element(page.getByText('Catalog')).not.toBeInTheDocument();
});
Expand Down Expand Up @@ -194,7 +194,7 @@ describe('DsBreadcrumb', () => {
const onSelect = vi.fn();
await renderWithRouter({ items: defaultItems, onSelect }, '/inventory/catalog');

await page.getByText('Inventory').click();
await page.getByText('Inventory', { exact: false }).click();
expect(onSelect).toHaveBeenCalledWith('/inventory');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ describe('DsCommentsDrawer', () => {
const toggleButton = page.getByRole('button', { name: /show resolved/i });

await expect.element(toggleButton).toBeInTheDocument();
await expect.element(toggleButton).toHaveTextContent(/\(2\)/);
await expect.element(toggleButton).toMatchTextContent(/\(2\)/);

await toggleButton.click();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ describe('DsDropdownMenu', () => {

await page.getByRole('button', { name: /Multi Select/i }).click();

const groupLabel = page.getByRole('button', { name: 'Group Name' });
const groupLabel = page.getByRole('button', { name: 'Group Name', exact: false });

// Collapse.
await groupLabel.click();
Expand Down Expand Up @@ -257,8 +257,8 @@ describe('DsDropdownMenu', () => {

await page.getByRole('button', { name: /Controlled Group/i }).click();

await expect.element(page.getByRole('button', { name: 'Settings' })).toBeVisible();
await expect.element(page.getByRole('menuitem', { name: 'Profile' })).toBeVisible();
await expect.element(page.getByRole('button', { name: 'Settings', exact: false })).toBeVisible();
await expect.element(page.getByRole('menuitem', { name: 'Profile', exact: false })).toBeVisible();
});

it('should call onCollapsedChange when toggling group', async () => {
Expand All @@ -268,7 +268,7 @@ describe('DsDropdownMenu', () => {

await page.getByRole('button', { name: /Controlled Group/i }).click();

const groupLabel = page.getByRole('button', { name: 'Settings' });
const groupLabel = page.getByRole('button', { name: 'Settings', exact: false });

// Collapse.
await groupLabel.click();
Expand All @@ -280,7 +280,7 @@ describe('DsDropdownMenu', () => {
await groupLabel.click();
expect(onCollapsedChange).toHaveBeenCalledWith(false);
expect(onCollapsedChange).toHaveBeenCalledTimes(2);
await expect.element(page.getByRole('menuitem', { name: 'Profile' })).toBeVisible();
await expect.element(page.getByRole('menuitem', { name: 'Profile', exact: false })).toBeVisible();
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('DsFileUpload', () => {
await uploadTestFile();

await expect.element(page.getByText('test-document.pdf')).toBeInTheDocument();
await expect.element(page.getByText('Upload complete')).toBeInTheDocument();
await expect.element(page.getByText('Upload complete', { exact: false })).toBeInTheDocument();
expect(onFileUploadComplete).toHaveBeenCalled();
});

Expand All @@ -52,7 +52,7 @@ describe('DsFileUpload', () => {

await uploadTestFile();

await expect.element(page.getByText('Upload complete')).toBeInTheDocument();
await expect.element(page.getByText('Upload complete', { exact: false })).toBeInTheDocument();

await page.getByRole('button', { name: /delete/i }).click();

Expand Down Expand Up @@ -81,7 +81,7 @@ describe('DsFileUpload', () => {

await page.getByRole('button', { name: /cancel/i }).click();

await expect.element(page.getByText('Upload cancelled')).toBeInTheDocument();
await expect.element(page.getByText('Upload cancelled', { exact: false })).toBeInTheDocument();
expect(onFileUploadCanceled).toHaveBeenCalled();
});

Expand All @@ -97,7 +97,7 @@ describe('DsFileUpload', () => {

await uploadTestFile();

await expect.element(page.getByText('Upload interrupted')).toBeInTheDocument();
await expect.element(page.getByText('Upload interrupted', { exact: false })).toBeInTheDocument();
await expect.element(page.getByRole('button', { name: /retry/i })).toBeInTheDocument();
});

Expand All @@ -114,11 +114,11 @@ describe('DsFileUpload', () => {

await uploadTestFile();

await expect.element(page.getByText('Upload interrupted')).toBeInTheDocument();
await expect.element(page.getByText('Upload interrupted', { exact: false })).toBeInTheDocument();

await page.getByRole('button', { name: /retry/i }).click();

await expect.element(page.getByText('Upload complete')).toBeInTheDocument();
await expect.element(page.getByText('Upload complete', { exact: false })).toBeInTheDocument();
expect(onFileUploadComplete).toHaveBeenCalled();
});

Expand All @@ -131,7 +131,7 @@ describe('DsFileUpload', () => {
await uploadTestFile();

await expect.element(page.getByText('test-document.pdf')).toBeInTheDocument();
await expect.element(page.getByText('Server error')).toBeInTheDocument();
await expect.element(page.getByText('Server error', { exact: false })).toBeInTheDocument();
expect(onFileUploadError).toHaveBeenCalled();
});
});
Expand All @@ -142,23 +142,23 @@ describe('DsFileUpload', () => {

await uploadTestFile('first');

await expect.element(page.getByText('Upload complete')).toBeInTheDocument();
await expect.element(page.getByText('Upload complete', { exact: false })).toBeInTheDocument();

await uploadTestFile('second');

await expect.element(page.getByText('Too many files selected')).toBeInTheDocument();
await expect.element(page.getByText('Too many files selected', { exact: false })).toBeInTheDocument();
});

it('should reject duplicate files with FILE_EXISTS error', async () => {
await page.render(<DsFileUpload adapter={fastAdapter()} />);

await uploadTestFile();

await expect.element(page.getByText('Upload complete')).toBeInTheDocument();
await expect.element(page.getByText('Upload complete', { exact: false })).toBeInTheDocument();

await uploadTestFile();

await expect.element(page.getByText('File already exists')).toBeInTheDocument();
await expect.element(page.getByText('File already exists', { exact: false })).toBeInTheDocument();
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ const MANUFACTURER_OPTIONS: DsSelectOption[] = [
// vitest browser iframe. Focus the editable container directly to trigger the `:focus-within`
// reveal deterministically.
const focusEditableContainerOf = (text: string) => {
const container = page.getByText(text).element().closest<HTMLElement>('[data-editable="true"]');
const container = page
.getByText(text, { exact: false })
.element()
.closest<HTMLElement>('[data-editable="true"]');

if (!container) {
throw new Error(`No editable value-container ancestor for text "${text}"`);
Expand Down Expand Up @@ -88,7 +91,7 @@ describe('DsKeyValuePair', () => {
/>,
);

await expect.element(page.getByText('Serial Number')).toBeInTheDocument();
await expect.element(page.getByText('Serial Number', { exact: false })).toBeInTheDocument();
await expect.element(page.getByText('99887766')).toBeVisible();
});

Expand Down Expand Up @@ -199,7 +202,7 @@ describe('DsKeyValuePair', () => {
/>,
);

await expect.element(page.getByText('Editable value')).toBeVisible();
await expect.element(page.getByText('Editable value', { exact: false })).toBeVisible();
await expect.element(page.getByText('info').first()).toBeVisible();

focusEditableContainerOf('Editable value');
Expand Down Expand Up @@ -363,7 +366,7 @@ describe('DsKeyValuePair', () => {
await renderWithParkedMouse(<ValueTypes />);

await expect.element(page.getByText('Read only value')).toBeVisible();
await expect.element(page.getByText('Active')).toBeVisible();
await expect.element(page.getByText('Active', { exact: false })).toBeVisible();
await expect.element(page.getByText('Tag-name').first()).toBeVisible();
await expect.element(page.getByText('Cisco Systems').first()).toBeVisible();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ describe('DsMainMenu — trigger and open/close', () => {
await openMenu();
await expect.element(page.getByRole('navigation', { name: 'Main menu' })).toBeVisible();

await userEvent.click(page.getByRole('button', { name: 'My dashboard' }));
await userEvent.click(page.getByRole('button', { name: 'My dashboard', exact: false }));

await assertClosed();
});
Expand All @@ -110,7 +110,7 @@ describe('DsMainMenu — trigger and open/close', () => {
await page.render(<DsMainMenu trigger={TRIGGER} items={ITEMS} utilityLinks={UTILITY_LINKS} />);

await openMenu();
await userEvent.click(page.getByRole('button', { name: 'Help & Support' }));
await userEvent.click(page.getByRole('button', { name: 'Help & Support', exact: false }));

await expect.element(triggerLocator()).toHaveAttribute('aria-expanded', 'false');
});
Expand All @@ -119,7 +119,7 @@ describe('DsMainMenu — trigger and open/close', () => {
await page.render(<DsMainMenu trigger={TRIGGER} items={ITEMS} utilityLinks={[]} />);

await openMenu();
(page.getByRole('button', { name: 'Disabled app' }).element() as HTMLButtonElement).click();
(page.getByRole('button', { name: 'Disabled app', exact: false }).element() as HTMLButtonElement).click();

await expect.element(page.getByRole('navigation', { name: 'Main menu' })).toBeVisible();
});
Expand All @@ -128,7 +128,9 @@ describe('DsMainMenu — trigger and open/close', () => {
await page.render(<DsMainMenu trigger={TRIGGER} items={ITEMS} utilityLinks={[]} />);

await openMenu();
(page.getByRole('button', { name: 'Coming soon app' }).element() as HTMLButtonElement).click();
(
page.getByRole('button', { name: 'Coming soon app', exact: false }).element() as HTMLButtonElement
).click();

await expect.element(page.getByRole('navigation', { name: 'Main menu' })).toBeVisible();
});
Expand Down Expand Up @@ -172,7 +174,7 @@ describe('DsMainMenu — controlled open', () => {

await expect.element(page.getByRole('navigation', { name: 'Main menu' })).toBeVisible();

await userEvent.click(page.getByRole('button', { name: 'My dashboard' }));
await userEvent.click(page.getByRole('button', { name: 'My dashboard', exact: false }));

expect(onOpenChange).toHaveBeenCalledWith(false);
});
Expand All @@ -186,10 +188,10 @@ describe('DsMainMenu — tile and utility link behavior', () => {

const nav = page.getByRole('navigation', { name: 'Main menu' });
await expect.element(nav).toBeVisible();
await expect.element(page.getByRole('link', { name: 'Inventory' })).toBeVisible();
await expect.element(page.getByRole('button', { name: 'My dashboard' })).toBeVisible();
await expect.element(page.getByRole('button', { name: 'Help & Support' })).toBeVisible();
await expect.element(page.getByRole('link', { name: 'Knowledge Center' })).toBeVisible();
await expect.element(page.getByRole('link', { name: 'Inventory', exact: false })).toBeVisible();
await expect.element(page.getByRole('button', { name: 'My dashboard', exact: false })).toBeVisible();
await expect.element(page.getByRole('button', { name: 'Help & Support', exact: false })).toBeVisible();
await expect.element(page.getByRole('link', { name: 'Knowledge Center', exact: false })).toBeVisible();
});

it('marks the selected tile with aria-current="page"', async () => {
Expand All @@ -199,7 +201,7 @@ describe('DsMainMenu — tile and utility link behavior', () => {

await openMenu();

const selectedTile = page.getByRole('button', { name: 'My dashboard' });
const selectedTile = page.getByRole('button', { name: 'My dashboard', exact: false });
expect(selectedTile.element().getAttribute('aria-current')).toBe('page');
});

Expand All @@ -211,11 +213,11 @@ describe('DsMainMenu — tile and utility link behavior', () => {
);

await openMenu();
await userEvent.click(page.getByRole('button', { name: 'My dashboard' }));
await userEvent.click(page.getByRole('button', { name: 'My dashboard', exact: false }));

// Reopen after auto-close
await openMenu();
await userEvent.click(page.getByRole('button', { name: 'Help & Support' }));
await userEvent.click(page.getByRole('button', { name: 'Help & Support', exact: false }));

expect(onItemSelect).toHaveBeenCalledTimes(2);
expect(onItemSelect).toHaveBeenNthCalledWith(1, 'dashboard');
Expand All @@ -238,7 +240,7 @@ describe('DsMainMenu — tile and utility link behavior', () => {

await openMenu();

const inventoryLink = page.getByRole('link', { name: 'Inventory' });
const inventoryLink = page.getByRole('link', { name: 'Inventory', exact: false });
inventoryLink.element().addEventListener('click', (event) => event.preventDefault());
await userEvent.click(inventoryLink);

Expand All @@ -254,8 +256,10 @@ describe('DsMainMenu — tile and utility link behavior', () => {

await openMenu();

(page.getByRole('button', { name: 'Disabled app' }).element() as HTMLButtonElement).click();
(page.getByRole('button', { name: 'Coming soon app' }).element() as HTMLButtonElement).click();
(page.getByRole('button', { name: 'Disabled app', exact: false }).element() as HTMLButtonElement).click();
(
page.getByRole('button', { name: 'Coming soon app', exact: false }).element() as HTMLButtonElement
).click();

expect(onItemSelect).not.toHaveBeenCalled();
});
Expand All @@ -265,7 +269,7 @@ describe('DsMainMenu — tile and utility link behavior', () => {

await openMenu();

const disabledTile = page.getByRole('button', { name: 'Disabled app' });
const disabledTile = page.getByRole('button', { name: 'Disabled app', exact: false });
expect(disabledTile.element().tabIndex).toBe(-1);
expect(disabledTile.element().getAttribute('aria-disabled')).toBe('true');
});
Expand All @@ -275,11 +279,11 @@ describe('DsMainMenu — tile and utility link behavior', () => {

await openMenu();

const comingSoonTile = page.getByRole('button', { name: 'Coming soon app' });
const comingSoonTile = page.getByRole('button', { name: 'Coming soon app', exact: false });
const badge = comingSoonTile.element().querySelector('[class*="badge"]') as HTMLElement;

await comingSoonTile.hover();
await page.elementLocator(badge).hover();
await page.elementLocator(badge).hover({ force: true });

await expect
.element(page.getByRole('tooltip', { name: COMING_SOON_TOOLTIP }), { timeout: 3000 })
Expand All @@ -297,7 +301,7 @@ describe('DsMainMenu — tile and utility link behavior', () => {

await openMenu();

const tile = page.getByRole('button', { name: 'My dashboard' });
const tile = page.getByRole('button', { name: 'My dashboard', exact: false });
await expect.element(tile).toBeVisible();
expect(tile.element().querySelector('svg')).not.toBeNull();
});
Expand Down Expand Up @@ -326,7 +330,7 @@ describe('DsMainMenu — expanded variant', () => {

await openMenu();

await expect.element(page.getByRole('button', { name: 'My dashboard' })).toBeVisible();
await expect.element(page.getByRole('button', { name: 'My dashboard', exact: false })).toBeVisible();
await expect.element(page.getByText('Hidden in compact.')).not.toBeInTheDocument();
});

Expand Down
Loading
Loading