chore(): sync with main

This commit is contained in:
Liam DeBeasi
2023-02-08 09:44:42 -05:00
189 changed files with 288 additions and 311 deletions

View File

@ -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
// --------------------------------------------------

View File

@ -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,

View File

@ -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`
);
});
});
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -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>

View File

@ -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`
);
});
});
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -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>