Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 61 additions & 61 deletions core/src/components/chip/chip.scss
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,6 @@
color: var(--ion-chip-hue-bold-solid-default-color);
}

// Default: Activated
:host(.chip-hue-bold.chip-fill-solid.ion-activated) {
background: var(--ion-chip-hue-bold-solid-activated-background, var(--ion-chip-hue-bold-solid-default-background));
}

// Default: Focus
:host(.chip-hue-bold.chip-fill-solid.ion-focused) {
background: var(--ion-chip-hue-bold-solid-focus-background, var(--ion-chip-hue-bold-solid-default-background));
Expand All @@ -212,20 +207,17 @@
}
}

// Default: Activated
:host(.chip-hue-bold.chip-fill-solid.ion-activated) {
background: var(--ion-chip-hue-bold-solid-activated-background, var(--ion-chip-hue-bold-solid-default-background));
}

// Colors
:host(.chip-hue-bold.chip-fill-solid.ion-color) {
background: var(--ion-chip-hue-bold-solid-semantic-default-background);
color: var(--ion-chip-hue-bold-solid-semantic-default-color);
}

// Colors: Activated
:host(.chip-hue-bold.chip-fill-solid.ion-color.ion-activated) {
background: var(
--ion-chip-hue-bold-solid-semantic-activated-background,
var(--ion-chip-hue-bold-solid-semantic-default-background)
);
}

// Colors: Focus
:host(.chip-hue-bold.chip-fill-solid.ion-color.ion-focused) {
background: var(
Expand All @@ -244,6 +236,14 @@
}
}

// Colors: Activated
:host(.chip-hue-bold.chip-fill-solid.ion-color.ion-activated) {
background: var(
--ion-chip-hue-bold-solid-semantic-activated-background,
var(--ion-chip-hue-bold-solid-semantic-default-background)
);
}

// Chip: Bold Outline
// ---------------------------------------------

Expand All @@ -257,14 +257,6 @@
color: var(--ion-chip-hue-bold-outline-default-color);
}

// Default: Activated
:host(.chip-hue-bold.chip-fill-outline.ion-activated) {
background: var(
--ion-chip-hue-bold-outline-activated-background,
var(--ion-chip-hue-bold-outline-default-background)
);
}

// Default: Focus
:host(.chip-hue-bold.chip-fill-outline.ion-focused) {
background: var(--ion-chip-hue-bold-outline-focus-background, var(--ion-chip-hue-bold-outline-default-background));
Expand All @@ -277,6 +269,14 @@
}
}

// Default: Activated
:host(.chip-hue-bold.chip-fill-outline.ion-activated) {
background: var(
--ion-chip-hue-bold-outline-activated-background,
var(--ion-chip-hue-bold-outline-default-background)
);
}

// Colors
:host(.chip-hue-bold.chip-fill-outline.ion-color) {
border-width: var(--ion-chip-hue-bold-outline-semantic-default-border-width);
Expand All @@ -287,14 +287,6 @@
color: var(--ion-chip-hue-bold-outline-semantic-default-color);
}

// Colors: Activated
:host(.chip-hue-bold.chip-fill-outline.ion-color.ion-activated) {
background: var(
--ion-chip-hue-bold-outline-semantic-activated-background,
var(--ion-chip-hue-bold-outline-semantic-default-background)
);
}

// Colors: Focus
:host(.chip-hue-bold.chip-fill-outline.ion-color.ion-focused) {
background: var(
Expand All @@ -313,6 +305,14 @@
}
}

// Colors: Activated
:host(.chip-hue-bold.chip-fill-outline.ion-color.ion-activated) {
background: var(
--ion-chip-hue-bold-outline-semantic-activated-background,
var(--ion-chip-hue-bold-outline-semantic-default-background)
);
}

// Chip: Subtle Solid
// ---------------------------------------------

Expand All @@ -322,14 +322,6 @@
color: var(--ion-chip-hue-subtle-solid-default-color);
}

// Default: Activated
:host(.chip-hue-subtle.chip-fill-solid.ion-activated) {
background: var(
--ion-chip-hue-subtle-solid-activated-background,
var(--ion-chip-hue-subtle-solid-default-background)
);
}

// Default: Focus
:host(.chip-hue-subtle.chip-fill-solid.ion-focused) {
background: var(--ion-chip-hue-subtle-solid-focus-background, var(--ion-chip-hue-subtle-solid-default-background));
Expand All @@ -342,20 +334,20 @@
}
}

// Default: Activated
:host(.chip-hue-subtle.chip-fill-solid.ion-activated) {
background: var(
--ion-chip-hue-subtle-solid-activated-background,
var(--ion-chip-hue-subtle-solid-default-background)
);
}

// Colors
:host(.chip-hue-subtle.chip-fill-solid.ion-color) {
background: var(--ion-chip-hue-subtle-solid-semantic-default-background);
color: var(--ion-chip-hue-subtle-solid-semantic-default-color);
}

// Colors: Activated
:host(.chip-hue-subtle.chip-fill-solid.ion-color.ion-activated) {
background: var(
--ion-chip-hue-subtle-solid-semantic-activated-background,
var(--ion-chip-hue-subtle-solid-semantic-default-background)
);
}

// Colors: Focus
:host(.chip-hue-subtle.chip-fill-solid.ion-color.ion-focused) {
background: var(
Expand All @@ -374,6 +366,14 @@
}
}

// Colors: Activated
:host(.chip-hue-subtle.chip-fill-solid.ion-color.ion-activated) {
background: var(
--ion-chip-hue-subtle-solid-semantic-activated-background,
var(--ion-chip-hue-subtle-solid-semantic-default-background)
);
}

// Chip: Subtle Outline
// ---------------------------------------------

Expand All @@ -387,14 +387,6 @@
color: var(--ion-chip-hue-subtle-outline-default-color);
}

// Default: Activated
:host(.chip-hue-subtle.chip-fill-outline.ion-activated) {
background: var(
--ion-chip-hue-subtle-outline-activated-background,
var(--ion-chip-hue-subtle-outline-default-background)
);
}

// Default: Focus
:host(.chip-hue-subtle.chip-fill-outline.ion-focused) {
background: var(
Expand All @@ -413,6 +405,14 @@
}
}

// Default: Activated
:host(.chip-hue-subtle.chip-fill-outline.ion-activated) {
background: var(
--ion-chip-hue-subtle-outline-activated-background,
var(--ion-chip-hue-subtle-outline-default-background)
);
}

// Colors
:host(.chip-hue-subtle.chip-fill-outline.ion-color) {
border-width: var(--ion-chip-hue-subtle-outline-semantic-default-border-width);
Expand All @@ -423,14 +423,6 @@
color: var(--ion-chip-hue-subtle-outline-semantic-default-color);
}

// Colors: Activated
:host(.chip-hue-subtle.chip-fill-outline.ion-color.ion-activated) {
background: var(
--ion-chip-hue-subtle-outline-semantic-activated-background,
var(--ion-chip-hue-subtle-outline-semantic-default-background)
);
}

// Colors: Focus
:host(.chip-hue-subtle.chip-fill-outline.ion-color.ion-focused) {
background: var(
Expand All @@ -449,6 +441,14 @@
}
}

// Colors: Activated
:host(.chip-hue-subtle.chip-fill-outline.ion-color.ion-activated) {
background: var(
--ion-chip-hue-subtle-outline-semantic-activated-background,
var(--ion-chip-hue-subtle-outline-semantic-default-background)
);
}

// Chip States
// ---------------------------------------------

Expand Down
58 changes: 58 additions & 0 deletions core/src/components/chip/test/states/chip.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { expect } from '@playwright/test';
import { configs, test } from '@utils/test/playwright';

import { HUES } from '../../../../themes/themes.interfaces';
import { ION_CHIP_FILLS } from '../../chip.interface';

/**
* This behavior does not vary across directions.
*
Expand Down Expand Up @@ -90,3 +93,58 @@ configs({ modes: ['ios', 'ionic-md'], directions: ['ltr'] }).forEach(({ title, s
});
});
});

/**
* This behavior does not vary across modes or directions.
*/
configs({ modes: ['ionic-md'], directions: ['ltr'] }).forEach(({ title, config }) => {
test.describe(title('chip: pressed state'), () => {
/**
* `(any-hover: hover)` evaluates to "none" when the browser reports a
* touch device, so turn that off to apply the hover rules. Headless
* Firefox reports no hover capability regardless, so it skips the test.
*/
test.use({
hasTouch: false,
isMobile: false,
});

HUES.forEach((hue) => {
ION_CHIP_FILLS.forEach((fill) => {
['', 'primary'].forEach((color) => {
test(`should show the activated background when pressing a hovered ${hue} ${fill} chip${
color ? ` with a color` : ''
}`, async ({ page, skip }) => {
skip.browser('firefox', 'Headless Firefox reports no hover capability');

const prefix = `--ion-chip-hue-${hue}-${fill}${color ? '-semantic' : ''}`;

await page.setContent(
`
<style>
ion-chip {
${prefix}-hover-background: rgb(255, 0, 0);
${prefix}-activated-background: rgb(0, 0, 255);
}
</style>

<ion-chip hue="${hue}" fill="${fill}"${color ? ` color="${color}"` : ''}>
<ion-label>Chip</ion-label>
</ion-chip>
`,
config
);

const chip = page.locator('ion-chip');

await chip.hover();
await chip.evaluate((el) => el.classList.add('ion-activated'));
await page.waitForChanges();

await expect(chip).toHaveCSS('background-color', 'rgb(0, 0, 255)');
});
});
});
});
});
});
Loading