From 6e3ff41197a79ebadd8adcd2560b1852b05226ad Mon Sep 17 00:00:00 2001 From: Davide Mininni Date: Thu, 23 Nov 2023 10:46:22 +0100 Subject: [PATCH] test: fix tests --- src/components/autocomplete/autocomplete.ts | 8 +++----- .../datepicker-toggle/datepicker-toggle.ts | 4 ++-- src/components/form-field/form-field/form-field.ts | 6 +++--- src/components/menu/menu/readme.md | 12 ++++++------ src/components/navigation/navigation/readme.md | 12 ++++++------ src/components/notification/readme.md | 12 ++++++------ src/components/option/option/readme.md | 8 ++++---- src/components/select/select.ts | 2 +- src/components/tabs/tab-group/tab-group.e2e.ts | 2 +- 9 files changed, 32 insertions(+), 34 deletions(-) diff --git a/src/components/autocomplete/autocomplete.ts b/src/components/autocomplete/autocomplete.ts index f83bebaef6b..4ff08b8bd5e 100644 --- a/src/components/autocomplete/autocomplete.ts +++ b/src/components/autocomplete/autocomplete.ts @@ -201,11 +201,9 @@ export class SbbAutocomplete extends LitElement { } this._syncNegative(); - this.addEventListener( - 'option-selection-change', - (e: CustomEvent) => this._onOptionSelected(e), - { signal }, - ); + this.addEventListener('optionSelectionChange', (e: CustomEvent) => this._onOptionSelected(e), { + signal, + }); this.addEventListener('click', (e) => this._onOptionClick(e), { signal }); } diff --git a/src/components/datepicker/datepicker-toggle/datepicker-toggle.ts b/src/components/datepicker/datepicker-toggle/datepicker-toggle.ts index 51e02479190..f28b627337c 100644 --- a/src/components/datepicker/datepicker-toggle/datepicker-toggle.ts +++ b/src/components/datepicker/datepicker-toggle/datepicker-toggle.ts @@ -210,8 +210,8 @@ export class SbbDatepickerToggle extends LitElement { ${ref((el: SbbTooltipTrigger) => (this._triggerElement = el))} > this._calendarElement.resetPosition()} - @did-open=${() => { + @willOpen=${() => this._calendarElement.resetPosition()} + @didOpen=${() => { sbbInputModalityDetector.mostRecentModality === 'keyboard' && this._calendarElement.focus(); }} diff --git a/src/components/form-field/form-field/form-field.ts b/src/components/form-field/form-field/form-field.ts index da230dd0be5..c64dc0d979e 100644 --- a/src/components/form-field/form-field/form-field.ts +++ b/src/components/form-field/form-field/form-field.ts @@ -146,8 +146,8 @@ export class SbbFormField extends LitElement { public override connectedCallback(): void { super.connectedCallback(); const signal = this._abort.signal; - this.addEventListener('will-open', (e) => this._onPopupOpen(e), { signal }); - this.addEventListener('did-close', (e) => this._onPopupClose(e), { signal }); + this.addEventListener('willOpen', (e) => this._onPopupOpen(e), { signal }); + this.addEventListener('didClose', (e) => this._onPopupClose(e), { signal }); this._handlerRepository.connect(); this._registerInputListener(); this._syncNegative(); @@ -319,7 +319,7 @@ export class SbbFormField extends LitElement { let inputFocusElement = this._input; if (this._input.tagName === 'SBB-SELECT') { - this._input.addEventListener('state-change', () => this._checkAndUpdateInputEmpty(), { + this._input.addEventListener('stateChange', () => this._checkAndUpdateInputEmpty(), { signal: this._inputAbortController.signal, }); diff --git a/src/components/menu/menu/readme.md b/src/components/menu/menu/readme.md index c2c3babf754..7402ebd097d 100644 --- a/src/components/menu/menu/readme.md +++ b/src/components/menu/menu/readme.md @@ -79,12 +79,12 @@ to identify which actions are active and which are not. ## Events -| Name | Type | Description | Inherited From | -| ------------ | ------------------- | ------------------------------------------------------------ | -------------- | -| `will-open` | `CustomEvent` | Emits whenever the `sbb-menu` starts the opening transition. | | -| `did-open` | `CustomEvent` | Emits whenever the `sbb-menu` is opened. | | -| `will-close` | `CustomEvent` | Emits whenever the `sbb-menu` begins the closing transition. | | -| `did-close` | `CustomEvent` | Emits whenever the `sbb-menu` is closed. | | +| Name | Type | Description | Inherited From | +| ----------- | ------------------- | ------------------------------------------------------------ | -------------- | +| `willOpen` | `CustomEvent` | Emits whenever the `sbb-menu` starts the opening transition. | | +| `didOpen` | `CustomEvent` | Emits whenever the `sbb-menu` is opened. | | +| `willClose` | `CustomEvent` | Emits whenever the `sbb-menu` begins the closing transition. | | +| `didClose` | `CustomEvent` | Emits whenever the `sbb-menu` is closed. | | ## Slots diff --git a/src/components/navigation/navigation/readme.md b/src/components/navigation/navigation/readme.md index 1d6d02c60b7..e36825ce382 100644 --- a/src/components/navigation/navigation/readme.md +++ b/src/components/navigation/navigation/readme.md @@ -77,12 +77,12 @@ Similarly, if a navigation action is marked to indicate a selected option (e.g., ## Events -| Name | Type | Description | Inherited From | -| ------------ | ------------------- | ------------------------------------------------------------------ | -------------- | -| `will-open` | `CustomEvent` | Emits whenever the `sbb-navigation` begins the opening transition. | | -| `did-open` | `CustomEvent` | Emits whenever the `sbb-navigation` is opened. | | -| `will-close` | `CustomEvent` | Emits whenever the `sbb-navigation` begins the closing transition. | | -| `did-close` | `CustomEvent` | Emits whenever the `sbb-navigation` is closed. | | +| Name | Type | Description | Inherited From | +| ----------- | ------------------- | ------------------------------------------------------------------ | -------------- | +| `willOpen` | `CustomEvent` | Emits whenever the `sbb-navigation` begins the opening transition. | | +| `didOpen` | `CustomEvent` | Emits whenever the `sbb-navigation` is opened. | | +| `willClose` | `CustomEvent` | Emits whenever the `sbb-navigation` begins the closing transition. | | +| `didClose` | `CustomEvent` | Emits whenever the `sbb-navigation` is closed. | | ## Slots diff --git a/src/components/notification/readme.md b/src/components/notification/readme.md index 37647193214..f41b73da4a2 100644 --- a/src/components/notification/readme.md +++ b/src/components/notification/readme.md @@ -78,12 +78,12 @@ For example, use `--sbb-notification-margin: 0 0 var(--sbb-spacing-fixed-4x) 0` ## Events -| Name | Type | Description | Inherited From | -| ------------ | ------------------- | -------------------------------------------------------------------- | -------------- | -| `will-open` | `CustomEvent` | Emits whenever the `sbb-notification` starts the opening transition. | | -| `did-open` | `CustomEvent` | Emits whenever the `sbb-notification` is opened. | | -| `will-close` | `CustomEvent` | Emits whenever the `sbb-notification` begins the closing transition. | | -| `did-close` | `CustomEvent` | Emits whenever the `sbb-notification` is closed. | | +| Name | Type | Description | Inherited From | +| ----------- | ------------------- | -------------------------------------------------------------------- | -------------- | +| `willOpen` | `CustomEvent` | Emits whenever the `sbb-notification` starts the opening transition. | | +| `didOpen` | `CustomEvent` | Emits whenever the `sbb-notification` is opened. | | +| `willClose` | `CustomEvent` | Emits whenever the `sbb-notification` begins the closing transition. | | +| `didClose` | `CustomEvent` | Emits whenever the `sbb-notification` is closed. | | ## Slots diff --git a/src/components/option/option/readme.md b/src/components/option/option/readme.md index 367875193b8..7ee09cbe9a9 100644 --- a/src/components/option/option/readme.md +++ b/src/components/option/option/readme.md @@ -75,10 +75,10 @@ If the label slot contains only a **text node**, it is possible to search for te ## Events -| Name | Type | Description | Inherited From | -| ------------------------- | ------------------- | ----------------------------------------------- | -------------- | -| `option-selection-change` | `CustomEvent` | Emits when the option selection status changes. | | -| `option-selected` | `CustomEvent` | Emits when an option was selected by user. | | +| Name | Type | Description | Inherited From | +| ----------------------- | ------------------- | ----------------------------------------------- | -------------- | +| `optionSelectionChange` | `CustomEvent` | Emits when the option selection status changes. | | +| `optionSelected` | `CustomEvent` | Emits when an option was selected by user. | | ## Slots diff --git a/src/components/select/select.ts b/src/components/select/select.ts index a01e187be3b..41babb72f7d 100644 --- a/src/components/select/select.ts +++ b/src/components/select/select.ts @@ -243,7 +243,7 @@ export class SbbSelect extends LitElement { this._onValueChanged(this.value); } - this.addEventListener('option-selection-change', (e) => this._onOptionChanged(e), { signal }); + this.addEventListener('optionSelectionChange', (e) => this._onOptionChanged(e), { signal }); this.addEventListener( 'click', (e) => { diff --git a/src/components/tabs/tab-group/tab-group.e2e.ts b/src/components/tabs/tab-group/tab-group.e2e.ts index 8f16ee95a77..891b9ae680e 100644 --- a/src/components/tabs/tab-group/tab-group.e2e.ts +++ b/src/components/tabs/tab-group/tab-group.e2e.ts @@ -56,7 +56,7 @@ describe('sbb-tab-group', () => { it('dispatches event on tab change', async () => { const tab = document.querySelector('sbb-tab-group > sbb-tab-title#sbb-tab-1') as SbbTabTitle; - const changeSpy = new EventSpy('did-change'); + const changeSpy = new EventSpy('didChange'); tab.click(); await waitForCondition(() => changeSpy.events.length === 1);