-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: calling open() method multiple times should keep drop (re)open (#33
) * fix: calling open() method multiple times should keep drop (re)open - in the original ms-select, the body click was being triggered prior to the open() method but that is inversed in our new lib with vanilla JS, so in order to have the same lifecycle as the original, we can simply add a single CPU cycle delay. This delay arg could also be used by the users for other reasons
- Loading branch information
1 parent
ee8127d
commit c36cf45
Showing
2 changed files
with
44 additions
and
7 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
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,23 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
test.describe('Methods 05 - open/close', () => { | ||
test('open & close drop dynamically', async ({ page }) => { | ||
await page.goto('#/methods05'); | ||
await page.locator('.ms-parent').click(); | ||
await expect(await page.locator('.ms-drop')).toBeVisible(); | ||
|
||
await page.getByRole('button', { name: 'Close' }).click(); | ||
await expect(await page.locator('.ms-drop')).not.toBeVisible(); | ||
|
||
// clicking on Close multiple times should keep the drop closed regardless | ||
await page.getByRole('button', { name: 'Close' }).click(); | ||
await expect(await page.locator('.ms-drop')).not.toBeVisible(); | ||
|
||
await page.getByRole('button', { name: 'Open' }).click(); | ||
await expect(await page.locator('.ms-drop')).toBeVisible(); | ||
|
||
// clicking on Open multiple times should keep the drop open regardless | ||
await page.getByRole('button', { name: 'Open' }).click(); | ||
await expect(await page.locator('.ms-drop')).toBeVisible(); | ||
}); | ||
}); |