-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core/menu-about): set index if selected is set on tab-item (#1469)
Co-authored-by: Daniel Leroux <[email protected]>
- Loading branch information
1 parent
80c0504
commit cc6091f
Showing
3 changed files
with
94 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@siemens/ix': patch | ||
--- | ||
|
||
fix(core/menu-about): set index if selected is set on tab-item |
51 changes: 51 additions & 0 deletions
51
packages/core/src/components/menu-about/test/menu-about.ct.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2024 Siemens AG | ||
* | ||
* SPDX-License-Identifier: MIT | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
import { expect } from '@playwright/test'; | ||
import { test } from '@utils/test'; | ||
|
||
test('renders', async ({ mount, page }) => { | ||
await mount(` | ||
<ix-menu> | ||
<ix-menu-about> | ||
<ix-menu-about-item label="Tab 1">Content 1</ix-menu-about-item> | ||
<ix-menu-about-item label="Tab 2">Content 2</ix-menu-about-item> | ||
</ix-menu-about> | ||
</ix-menu> | ||
`); | ||
|
||
const element = page.locator('#aboutAndLegal'); | ||
await element.click(); | ||
|
||
await page.getByText('Content 1').click(); | ||
|
||
const aboutAndLegal = page.locator('ix-menu-about'); | ||
await expect(aboutAndLegal).toHaveClass(/hydrated/); | ||
}); | ||
|
||
test('active-tab-label', async ({ mount, page }) => { | ||
await mount(` | ||
<ix-application> | ||
<ix-menu> | ||
<ix-menu-about active-tab-label="Tab 2"> | ||
<ix-menu-about-item label="Tab 1">Content 1</ix-menu-about-item> | ||
<ix-menu-about-item label="Tab 2">Content 2</ix-menu-about-item> | ||
</ix-menu-about> | ||
</ix-menu> | ||
</ix-application> | ||
`); | ||
|
||
const element = page.locator('#aboutAndLegal'); | ||
await element.click(); | ||
|
||
const tabItems = page.locator('ix-tab-item'); | ||
await expect(tabItems.first()).toHaveClass(/hydrated/); | ||
|
||
await expect(tabItems.first()).not.toHaveAttribute('selected', 'true'); | ||
await expect(tabItems.last()).toHaveAttribute('selected', 'true'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters