Skip to content

Commit

Permalink
Add test for ignored events
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardHelm committed Mar 13, 2024
1 parent a599fb8 commit 52a9804
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
13 changes: 12 additions & 1 deletion libs/components/src/lib/select/select.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ describe('vwc-select', () => {
it('should prevent focusin from firing before click event', async () => {
element.innerHTML = `
<option value="1" id="id1">1</option>
<option value="2" id="id2>2</option>
<option value="2" id="id2">2</option>
<option value="3">3</option>
`;
await elementUpdated(element);
Expand Down Expand Up @@ -543,6 +543,17 @@ describe('vwc-select', () => {
});
});

describe('feedback messages', () => {
it('should ignore events when triggered on feedback messages', async () => {
element.helperText = 'helper text';
await elementUpdated(element);

element.shadowRoot!.querySelector('.helper-message')!.dispatchEvent(new Event('click', { bubbles: true, composed: true }));

expect(element.open).toBe(false);
});
});

describe('a11y', () => {
it('should pass html a11y test', async () => {
element.innerHTML = `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export interface FormElement {

export interface FormElementHelperText {
helperText?: string;
_helperTextSlottedContent: HTMLElement[];
_helperTextSlottedContent?: HTMLElement[];
}

export interface FormElementSuccessText {
Expand All @@ -34,7 +34,7 @@ export class FormElementHelperText {
/**
* @internal
*/
@observable _helperTextSlottedContent: HTMLElement[] = [];
@observable _helperTextSlottedContent?: HTMLElement[];
}

export class FormElementSuccessText {
Expand Down

0 comments on commit 52a9804

Please sign in to comment.