@ionic/core 7.4.3-dev.11696260184.1e4ad047 → 7.4.3-dev.11696264821.1755dd6a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* (C) Ionic http://ionicframework.com - MIT License
|
|
3
|
+
*/
|
|
4
|
+
import { expect } from "@playwright/test";
|
|
5
|
+
import { configs, test } from "../../../../utils/test/playwright/index";
|
|
6
|
+
/**
|
|
7
|
+
* This behavior does not vary across modes/directions
|
|
8
|
+
*/
|
|
9
|
+
configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) => {
|
|
10
|
+
test.describe(title('menu: disable'), () => {
|
|
11
|
+
test.beforeEach(async ({ page }) => {
|
|
12
|
+
await page.goto(`/src/components/menu/test/disable`, config);
|
|
13
|
+
});
|
|
14
|
+
test('should disable when menu is fully open', async ({ page }) => {
|
|
15
|
+
const logs = [];
|
|
16
|
+
page.on('console', (msg) => {
|
|
17
|
+
if (msg.type() === 'error') {
|
|
18
|
+
logs.push(msg.text());
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
const menu = page.locator('ion-menu');
|
|
22
|
+
// Should be visible on initial presentation
|
|
23
|
+
await menu.evaluate((el) => el.open());
|
|
24
|
+
await expect(menu).toBeVisible();
|
|
25
|
+
// Disabling menu should hide it
|
|
26
|
+
await menu.evaluate((el) => (el.disabled = true));
|
|
27
|
+
await expect(menu).toBeHidden();
|
|
28
|
+
// Re-enabling menu and opening it show make it visible
|
|
29
|
+
await menu.evaluate((el) => (el.disabled = false));
|
|
30
|
+
await menu.evaluate((el) => el.open());
|
|
31
|
+
await expect(menu).toBeVisible();
|
|
32
|
+
expect(logs.length).toBe(0);
|
|
33
|
+
});
|
|
34
|
+
test.only('should disable when menu is animating', async ({ page }) => {
|
|
35
|
+
const logs = [];
|
|
36
|
+
page.on('console', (msg) => {
|
|
37
|
+
if (msg.type() === 'error') {
|
|
38
|
+
logs.push(msg.text());
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
const menu = page.locator('ion-menu');
|
|
42
|
+
// Opening and quickly disabling menu should hide it
|
|
43
|
+
menu.evaluate((el) => {
|
|
44
|
+
el.open();
|
|
45
|
+
setTimeout(() => (el.disabled = true), 0);
|
|
46
|
+
});
|
|
47
|
+
await expect(menu).toBeHidden();
|
|
48
|
+
// Re-enabling menu and opening it show make it visible
|
|
49
|
+
await menu.evaluate((el) => (el.disabled = false));
|
|
50
|
+
await menu.evaluate((el) => el.open());
|
|
51
|
+
await expect(menu).toBeVisible();
|
|
52
|
+
expect(logs.length).toBe(0);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
});
|
package/dist/docs.json
CHANGED