mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
fix(console): highlight current tab in sidebar (#4524)
This commit is contained in:
parent
d1729d89a9
commit
f9322d02dc
2 changed files with 16 additions and 2 deletions
|
@ -27,7 +27,7 @@ function Sidebar() {
|
|||
key={title}
|
||||
titleKey={title}
|
||||
icon={<Icon />}
|
||||
isActive={match(getPath(title))}
|
||||
isActive={match('/' + getPath(title))}
|
||||
modal={modal}
|
||||
externalLink={externalLink}
|
||||
/>
|
||||
|
|
|
@ -7,7 +7,7 @@ import {
|
|||
consoleUsername,
|
||||
logtoConsoleUrl as logtoConsoleUrlString,
|
||||
} from '#src/constants.js';
|
||||
import { appendPathname, expectNavigation } from '#src/utils.js';
|
||||
import { appendPathname, cls, dcls, expectNavigation } from '#src/utils.js';
|
||||
|
||||
/**
|
||||
* NOTE: This test suite assumes test cases will run sequentially (which is Jest default).
|
||||
|
@ -121,4 +121,18 @@ describe('smoke testing for console admin account creation and sign-in', () => {
|
|||
it('renders SVG correctly with viewbox property', async () => {
|
||||
await page.waitForSelector('div[class$=topbar] > svg[viewbox][class$=logo]', { visible: true });
|
||||
});
|
||||
|
||||
it('can highlight the current tab in the sidebar', async () => {
|
||||
const activeSelector = [dcls('sidebar'), 'a' + cls('row') + cls('active'), dcls('title')].join(
|
||||
' '
|
||||
);
|
||||
|
||||
await expect(page).toMatchElement(activeSelector, { text: 'Applications', visible: true });
|
||||
await expectNavigation(
|
||||
expect(page).toClick([dcls('sidebar'), 'a' + cls('row')].join(' '), {
|
||||
text: 'Dashboard',
|
||||
})
|
||||
);
|
||||
await expect(page).toMatchElement(activeSelector, { text: 'Dashboard', visible: true });
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue