chore(): sync with main
@ -1,5 +1,6 @@
|
||||
@import "./button";
|
||||
@import "./button.ios.vars";
|
||||
@import "../toolbar/toolbar.ios.vars";
|
||||
|
||||
|
||||
// iOS Button
|
||||
@ -23,6 +24,20 @@
|
||||
letter-spacing: #{$button-ios-letter-spacing};
|
||||
}
|
||||
|
||||
/**
|
||||
* The default buttons in a toolbar
|
||||
* have a different font size/weight
|
||||
* than buttons outside of a toolbar on iOS.
|
||||
* However, we still want the "size"/"strong"
|
||||
* properties to be usable in a toolbar, so we add
|
||||
* the .in-buttons selector such that we
|
||||
* can add the different font size/weight in a toolbar
|
||||
* but still let "size"/"strong" override it.
|
||||
*/
|
||||
:host(.in-buttons) {
|
||||
font-size: #{$toolbar-ios-button-font-size};
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
// iOS Solid Button
|
||||
// --------------------------------------------------
|
||||
|
@ -294,6 +294,7 @@ export class Button implements ComponentInterface, AnchorInterface, ButtonInterf
|
||||
[`${buttonType}-strong`]: strong,
|
||||
'in-toolbar': hostContext('ion-toolbar', this.el),
|
||||
'in-toolbar-color': hostContext('ion-toolbar[color]', this.el),
|
||||
'in-buttons': hostContext('ion-buttons', this.el),
|
||||
'button-has-icon-only': hasIconOnly,
|
||||
'button-disabled': disabled,
|
||||
'ion-activatable': true,
|
||||
|
@ -2,11 +2,53 @@ import { expect } from '@playwright/test';
|
||||
import { test } from '@utils/test/playwright';
|
||||
|
||||
test.describe('button: size', () => {
|
||||
test('should not have visual regressions', async ({ page }) => {
|
||||
await page.goto(`/src/components/button/test/size`);
|
||||
test.beforeEach(({ skip }) => {
|
||||
skip.rtl();
|
||||
});
|
||||
test('should render small buttons', async ({ page }) => {
|
||||
await page.setContent(`
|
||||
<ion-button size="small" fill="solid">Small Button</ion-button>
|
||||
`);
|
||||
|
||||
await page.setIonViewport();
|
||||
const wrapper = page.locator('ion-button');
|
||||
|
||||
expect(await page.screenshot()).toMatchSnapshot(`button-size-${page.getSnapshotSettings()}.png`);
|
||||
expect(await wrapper.screenshot()).toMatchSnapshot(`button-size-small-${page.getSnapshotSettings()}.png`);
|
||||
});
|
||||
test('should render large buttons', async ({ page }) => {
|
||||
await page.setContent(`
|
||||
<ion-button size="large" fill="solid">Large Button</ion-button>
|
||||
`);
|
||||
|
||||
const wrapper = page.locator('ion-button');
|
||||
|
||||
expect(await wrapper.screenshot()).toMatchSnapshot(`button-size-large-${page.getSnapshotSettings()}.png`);
|
||||
});
|
||||
test.describe('in ion-buttons', () => {
|
||||
test('should render small button', async ({ page }) => {
|
||||
await page.setContent(`
|
||||
<ion-buttons>
|
||||
<ion-button size="small" fill="solid">Small Button</ion-button>
|
||||
</ion-buttons>
|
||||
`);
|
||||
|
||||
const wrapper = page.locator('ion-button');
|
||||
|
||||
expect(await wrapper.screenshot()).toMatchSnapshot(
|
||||
`button-size-small-in-buttons-${page.getSnapshotSettings()}.png`
|
||||
);
|
||||
});
|
||||
test('should render large button', async ({ page }) => {
|
||||
await page.setContent(`
|
||||
<ion-buttons>
|
||||
<ion-button size="large" fill="solid">Large Button</ion-button>
|
||||
</ion-buttons>
|
||||
`);
|
||||
|
||||
const wrapper = page.locator('ion-button');
|
||||
|
||||
expect(await wrapper.screenshot()).toMatchSnapshot(
|
||||
`button-size-large-in-buttons-${page.getSnapshotSettings()}.png`
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Before Width: | Height: | Size: 51 KiB |
Before Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 51 KiB |
Before Width: | Height: | Size: 51 KiB |
Before Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 51 KiB |
After Width: | Height: | Size: 5.7 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 6.0 KiB |
After Width: | Height: | Size: 6.6 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 6.5 KiB |
After Width: | Height: | Size: 6.8 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 7.3 KiB |
After Width: | Height: | Size: 6.5 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 48 KiB |
Before Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 48 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 4.8 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 4.2 KiB |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 4.7 KiB |
@ -18,6 +18,11 @@
|
||||
<ion-app>
|
||||
<ion-header>
|
||||
<ion-toolbar>
|
||||
<ion-buttons slot="start">
|
||||
<ion-button fill="solid">Default Button</ion-button>
|
||||
<ion-button fill="solid" size="small">Small Button</ion-button>
|
||||
<ion-button fill="solid" size="large">Large Button</ion-button>
|
||||
</ion-buttons>
|
||||
<ion-title>Button - Size</ion-title>
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
|
@ -1,12 +1,57 @@
|
||||
import { expect } from '@playwright/test';
|
||||
import { test } from '@utils/test/playwright';
|
||||
|
||||
/**
|
||||
* Clear buttons have special font-weight
|
||||
* styles which is why we make sure
|
||||
* to capture the clear button here.
|
||||
*/
|
||||
test.describe('button: strong', () => {
|
||||
test('should not have visual regressions', async ({ page }) => {
|
||||
await page.goto(`/src/components/button/test/strong`);
|
||||
test.beforeEach(({ skip }) => {
|
||||
skip.rtl();
|
||||
});
|
||||
test('should render strong button', async ({ page }) => {
|
||||
await page.setContent(`
|
||||
<ion-button fill="solid" strong="true">Button</ion-button>
|
||||
`);
|
||||
|
||||
await page.setIonViewport();
|
||||
const wrapper = page.locator('ion-button');
|
||||
|
||||
expect(await page.screenshot()).toMatchSnapshot(`button-strong-${page.getSnapshotSettings()}.png`);
|
||||
expect(await wrapper.screenshot()).toMatchSnapshot(`button-strong-${page.getSnapshotSettings()}.png`);
|
||||
});
|
||||
test('should render strong clear button', async ({ page }) => {
|
||||
await page.setContent(`
|
||||
<ion-button fill="clear" strong="true">Button</ion-button>
|
||||
`);
|
||||
|
||||
const wrapper = page.locator('ion-button');
|
||||
|
||||
expect(await wrapper.screenshot()).toMatchSnapshot(`button-clear-strong-${page.getSnapshotSettings()}.png`);
|
||||
});
|
||||
test.describe('in ion-buttons', () => {
|
||||
test('should render strong button', async ({ page }) => {
|
||||
await page.setContent(`
|
||||
<ion-buttons>
|
||||
<ion-button strong="true" fill="solid">Button</ion-button>
|
||||
</ion-buttons>
|
||||
`);
|
||||
|
||||
const wrapper = page.locator('ion-button');
|
||||
|
||||
expect(await wrapper.screenshot()).toMatchSnapshot(`button-strong-in-buttons-${page.getSnapshotSettings()}.png`);
|
||||
});
|
||||
test('should render strong clear button', async ({ page }) => {
|
||||
await page.setContent(`
|
||||
<ion-buttons>
|
||||
<ion-button strong="true" fill="clear">Button</ion-button>
|
||||
</ion-buttons>
|
||||
`);
|
||||
|
||||
const wrapper = page.locator('ion-button');
|
||||
|
||||
expect(await wrapper.screenshot()).toMatchSnapshot(
|
||||
`button-clear-strong-in-buttons-${page.getSnapshotSettings()}.png`
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 43 KiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 40 KiB |
@ -18,6 +18,11 @@
|
||||
<ion-app>
|
||||
<ion-header>
|
||||
<ion-toolbar>
|
||||
<ion-buttons slot="start">
|
||||
<ion-button fill="solid" strong="true">Solid Button</ion-button>
|
||||
<ion-button fill="outline" strong="true">Outline Button</ion-button>
|
||||
<ion-button fill="clear" strong="true">Clear Button</ion-button>
|
||||
</ion-buttons>
|
||||
<ion-title>Button - Strong</ion-title>
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
|