|
| 1 | +import { expect } from '@playwright/test'; |
| 2 | +import { configs, test } from '@utils/test/playwright'; |
| 3 | + |
| 4 | +/** |
| 5 | + * This behavior only applies to the `ionic` theme. |
| 6 | + * This behavior does not vary across directions. |
| 7 | + */ |
| 8 | +configs({ directions: ['ltr'], modes: ['ionic-md'] }).forEach(({ title, screenshot, config }) => { |
| 9 | + test.describe(title('tab-bar: shape'), () => { |
| 10 | + test.describe(title('soft'), () => { |
| 11 | + test('should not have visual regressions', async ({ page }) => { |
| 12 | + await page.setContent( |
| 13 | + ` |
| 14 | + <ion-tab-bar shape="soft"> |
| 15 | + <ion-tab-button tab="1"> |
| 16 | + <ion-icon name="triangle-outline"></ion-icon> |
| 17 | + <ion-label>Label</ion-label> |
| 18 | + </ion-tab-button> |
| 19 | + |
| 20 | + <ion-tab-button tab="2"> |
| 21 | + <ion-icon name="triangle-outline"></ion-icon> |
| 22 | + <ion-label>Label</ion-label> |
| 23 | + </ion-tab-button> |
| 24 | + |
| 25 | + <ion-tab-button tab="3"> |
| 26 | + <ion-icon name="triangle-outline"></ion-icon> |
| 27 | + <ion-label>Label</ion-label> |
| 28 | + </ion-tab-button> |
| 29 | + </ion-tab-bar> |
| 30 | + `, |
| 31 | + config |
| 32 | + ); |
| 33 | + |
| 34 | + const tabBar = page.locator('ion-tab-bar'); |
| 35 | + |
| 36 | + await expect(tabBar).toHaveScreenshot(screenshot(`tab-bar-shape-soft`)); |
| 37 | + }); |
| 38 | + }); |
| 39 | + |
| 40 | + test.describe(title('round'), () => { |
| 41 | + test('should not have visual regressions', async ({ page }) => { |
| 42 | + await page.setContent( |
| 43 | + ` |
| 44 | + <ion-tab-bar shape="round"> |
| 45 | + <ion-tab-button tab="1"> |
| 46 | + <ion-icon name="triangle-outline"></ion-icon> |
| 47 | + <ion-label>Label</ion-label> |
| 48 | + </ion-tab-button> |
| 49 | + |
| 50 | + <ion-tab-button tab="2"> |
| 51 | + <ion-icon name="triangle-outline"></ion-icon> |
| 52 | + <ion-label>Label</ion-label> |
| 53 | + </ion-tab-button> |
| 54 | + |
| 55 | + <ion-tab-button tab="3"> |
| 56 | + <ion-icon name="triangle-outline"></ion-icon> |
| 57 | + <ion-label>Label</ion-label> |
| 58 | + </ion-tab-button> |
| 59 | + </ion-tab-bar> |
| 60 | + `, |
| 61 | + config |
| 62 | + ); |
| 63 | + |
| 64 | + const tabBar = page.locator('ion-tab-bar'); |
| 65 | + |
| 66 | + await expect(tabBar).toHaveScreenshot(screenshot(`tab-bar-shape-round`)); |
| 67 | + }); |
| 68 | + }); |
| 69 | + |
| 70 | + test.describe(title('rectangular'), () => { |
| 71 | + test('should not have visual regressions', async ({ page }) => { |
| 72 | + await page.setContent( |
| 73 | + ` |
| 74 | + <ion-tab-bar shape="rectangular"> |
| 75 | + <ion-tab-button tab="1"> |
| 76 | + <ion-icon name="triangle-outline"></ion-icon> |
| 77 | + <ion-label>Label</ion-label> |
| 78 | + </ion-tab-button> |
| 79 | + |
| 80 | + <ion-tab-button tab="2"> |
| 81 | + <ion-icon name="triangle-outline"></ion-icon> |
| 82 | + <ion-label>Label</ion-label> |
| 83 | + </ion-tab-button> |
| 84 | + |
| 85 | + <ion-tab-button tab="3"> |
| 86 | + <ion-icon name="triangle-outline"></ion-icon> |
| 87 | + <ion-label>Label</ion-label> |
| 88 | + </ion-tab-button> |
| 89 | + </ion-tab-bar> |
| 90 | + `, |
| 91 | + config |
| 92 | + ); |
| 93 | + |
| 94 | + const tabBar = page.locator('ion-tab-bar'); |
| 95 | + |
| 96 | + await expect(tabBar).toHaveScreenshot(screenshot(`tab-bar-shape-rectangular`)); |
| 97 | + }); |
| 98 | + }); |
| 99 | + }); |
| 100 | +}); |
0 commit comments