diff --git a/packages/core/src/components/modal/modal.tsx b/packages/core/src/components/modal/modal.tsx index e33e34ea417..6fb3d99347c 100644 --- a/packages/core/src/components/modal/modal.tsx +++ b/packages/core/src/components/modal/modal.tsx @@ -93,7 +93,7 @@ export class Modal { private slideInModal() { const duration = this.animation ? Animation.mediumTime : 0; - let transformY = this.centered ? '-50' : 40; + let transformY = this.centered ? '-50%' : 40; anime({ targets: this.dialog, @@ -108,7 +108,7 @@ export class Modal { private slideOutModal(completeCallback: Function) { const duration = this.animation ? Animation.mediumTime : 0; - let transformY = this.centered ? '-50' : 40; + let transformY = this.centered ? '-50%' : 40; anime({ targets: this.dialog, @@ -217,7 +217,10 @@ export class Modal { aria-modal={a11yBoolean(true)} aria-describedby={this.ariaAttributes['aria-describedby']} aria-labelledby={this.ariaAttributes['aria-labelledby']} - class={`modal modal-size-${this.size}`} + class={{ + modal: true, + [`modal-size-${this.size}`]: true, + }} onKeyDown={(e) => { if (e.key === 'Escape' && this.keyboard === false) { e.preventDefault(); diff --git a/packages/core/src/tests/basic-navigation/basic-navigation.e2e.ts b/packages/core/src/tests/basic-navigation/basic-navigation.e2e.ts index 99fa442771b..04d8e1e7e40 100644 --- a/packages/core/src/tests/basic-navigation/basic-navigation.e2e.ts +++ b/packages/core/src/tests/basic-navigation/basic-navigation.e2e.ts @@ -99,6 +99,11 @@ regressionTest.describe('basic navigation mobile', () => { }); regressionTest('mobile expanded', async ({ page }) => { + regressionTest.skip( + !!process.env['CI'], + 'TODO: Fix flaky behavior on github runner' + ); + await page.goto('basic-navigation/mobile'); await page.setViewportSize(viewPorts.sm); diff --git a/packages/core/src/tests/modal/modal.e2e.ts b/packages/core/src/tests/modal/modal.e2e.ts index 24b4b624172..9447fcc914d 100644 --- a/packages/core/src/tests/modal/modal.e2e.ts +++ b/packages/core/src/tests/modal/modal.e2e.ts @@ -102,3 +102,19 @@ test('modal with dropdown', async ({ mount, page }) => { }); } ); + +test('modal should show centered', async ({ mount, page }) => { + await mount(` + +
Some content
+
+ `); + const modal = page.locator('ix-modal'); + await expect(modal).toHaveClass(/hydrated/); + + await modal.evaluate((modal: HTMLIxModalElement) => modal.showModal()); + + // Wait until anime.js perform the slideIn animation + await page.waitForTimeout(2000); + expect(await page.screenshot({ fullPage: true })).toMatchSnapshot(); +}); diff --git a/packages/core/src/tests/modal/modal.e2e.ts-snapshots/modal-should-show-centered-1-chromium---theme-classic-dark-linux.png b/packages/core/src/tests/modal/modal.e2e.ts-snapshots/modal-should-show-centered-1-chromium---theme-classic-dark-linux.png new file mode 100644 index 00000000000..cba1d228826 Binary files /dev/null and b/packages/core/src/tests/modal/modal.e2e.ts-snapshots/modal-should-show-centered-1-chromium---theme-classic-dark-linux.png differ diff --git a/packages/core/src/tests/modal/modal.e2e.ts-snapshots/modal-should-show-centered-1-chromium---theme-classic-light-linux.png b/packages/core/src/tests/modal/modal.e2e.ts-snapshots/modal-should-show-centered-1-chromium---theme-classic-light-linux.png new file mode 100644 index 00000000000..0975433f36a Binary files /dev/null and b/packages/core/src/tests/modal/modal.e2e.ts-snapshots/modal-should-show-centered-1-chromium---theme-classic-light-linux.png differ