Skip to content

Commit

Permalink
fix(core/button): prevent native events to be dispatched (#804)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielleroux authored Oct 5, 2023
1 parent 12d2472 commit ac756a5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/core/src/components/button/button-mixin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@
}

:host(.disabled) {
pointer-events: none;

.btn-#{$name} {
&.disabled,
&:disabled {
Expand Down
8 changes: 8 additions & 0 deletions packages/core/src/components/button/test/button.ct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,11 @@ test('replace icon with spinner while loading', async ({ mount, page }) => {
await expect(button.locator('ix-spinner')).toBeVisible();
await expect(button.locator('ix-icon')).not.toBeVisible();
});

test('should not fire event when disabled', async ({ mount, page }) => {
await mount(`<ix-button disabled>Content</ix-button>`);
const button = page.locator('ix-button');

await expect(button).toHaveClass(/hydrated/);
expect(button).toHaveCSS('pointer-events', 'none');
});

0 comments on commit ac756a5

Please sign in to comment.