-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(segment-button): update checked state on render (#27183)
- Loading branch information
1 parent
d619b85
commit ae9689b
Showing
2 changed files
with
29 additions
and
1 deletion.
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
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,24 @@ | ||
import { newSpecPage } from '@stencil/core/testing'; | ||
|
||
import { SegmentButton } from '../../segment-button/segment-button'; | ||
import { Segment } from '../segment'; | ||
|
||
it('should set checked state when value is set asynchronously', async () => { | ||
const page = await newSpecPage({ | ||
components: [Segment, SegmentButton], | ||
html: ` | ||
<ion-segment value="first"> | ||
<ion-segment-button>First</ion-segment-button> | ||
</ion-segment> | ||
`, | ||
}); | ||
|
||
const segmentButton = page.root.querySelector('ion-segment-button'); | ||
|
||
expect(segmentButton.classList.contains('segment-button-checked')).toBe(false); | ||
|
||
segmentButton.value = 'first'; | ||
await page.waitForChanges(); | ||
|
||
expect(segmentButton.classList.contains('segment-button-checked')).toBe(true); | ||
}); |