11import { ControllerMixinClass } from '@vaadin/component-base/src/controller-mixin.js' ;
2+ import { DisabledMixinClass } from '@vaadin/component-base/src/disabled-mixin.js' ;
23import { ElementMixinClass } from '@vaadin/component-base/src/element-mixin.js' ;
4+ import { FocusMixinClass } from '@vaadin/component-base/src/focus-mixin.js' ;
5+ import { KeyboardMixinClass } from '@vaadin/component-base/src/keyboard-mixin.js' ;
6+ import { DelegateFocusMixinClass } from '@vaadin/field-base/src/delegate-focus-mixin.js' ;
7+ import { DelegateStateMixinClass } from '@vaadin/field-base/src/delegate-state-mixin.js' ;
8+ import { FieldMixinClass } from '@vaadin/field-base/src/field-mixin.js' ;
9+ import { InputConstraintsMixinClass } from '@vaadin/field-base/src/input-constraints-mixin.js' ;
10+ import { InputControlMixinClass } from '@vaadin/field-base/src/input-control-mixin.js' ;
11+ import { InputMixinClass } from '@vaadin/field-base/src/input-mixin.js' ;
12+ import { LabelMixinClass } from '@vaadin/field-base/src/label-mixin.js' ;
13+ import { PatternMixinClass } from '@vaadin/field-base/src/pattern-mixin.js' ;
14+ import { ValidateMixinClass } from '@vaadin/field-base/src/validate-mixin.js' ;
315import { ThemableMixinClass } from '@vaadin/vaadin-themable-mixin' ;
416import { ComboBoxDataProviderMixinClass } from '../../src/vaadin-combo-box-data-provider-mixin' ;
517import { ComboBoxMixinClass } from '../../src/vaadin-combo-box-mixin' ;
@@ -10,6 +22,7 @@ import {
1022 ComboBoxFilterChangedEvent ,
1123 ComboBoxInvalidChangedEvent ,
1224 ComboBoxOpenedChangedEvent ,
25+ ComboBoxRenderer ,
1326 ComboBoxSelectedItemChangedEvent ,
1427 ComboBoxValueChangedEvent
1528} from '../../vaadin-combo-box' ;
@@ -30,16 +43,11 @@ interface TestComboBoxItem {
3043
3144const assertType = < TExpected > ( actual : TExpected ) => actual ;
3245
33- /* ComboBoxElement */
46+ /* ComboBox */
3447const genericComboBox = document . createElement ( 'vaadin-combo-box' ) ;
48+ assertType < ComboBox > ( genericComboBox ) ;
3549
3650const narrowedComboBox = genericComboBox as ComboBox < TestComboBoxItem > ;
37- assertType < ComboBox > ( narrowedComboBox ) ;
38- assertType < ControllerMixinClass > ( narrowedComboBox ) ;
39- assertType < ElementMixinClass > ( narrowedComboBox ) ;
40- assertType < ComboBoxDataProviderMixinClass < TestComboBoxItem > > ( narrowedComboBox ) ;
41- assertType < ComboBoxMixinClass < TestComboBoxItem > > ( narrowedComboBox ) ;
42- assertType < ThemableMixinClass > ( narrowedComboBox ) ;
4351
4452narrowedComboBox . addEventListener ( 'change' , ( event ) => {
4553 assertType < ComboBoxChangeEvent < TestComboBoxItem > > ( event ) ;
@@ -76,14 +84,65 @@ narrowedComboBox.addEventListener('selected-item-changed', (event) => {
7684 assertType < TestComboBoxItem | null | undefined > ( event . detail . value ) ;
7785} ) ;
7886
79- /* ComboBoxLightElement */
87+ // ComboBox properties
88+ assertType < ( ) => boolean > ( narrowedComboBox . checkValidity ) ;
89+ assertType < ( ) => boolean > ( narrowedComboBox . validate ) ;
90+ assertType < ( ) => void > ( narrowedComboBox . close ) ;
91+ assertType < ( ) => void > ( narrowedComboBox . open ) ;
92+ assertType < ( ) => void > ( narrowedComboBox . requestContentUpdate ) ;
93+ assertType < boolean > ( narrowedComboBox . allowCustomValue ) ;
94+ assertType < boolean > ( narrowedComboBox . autofocus ) ;
95+ assertType < boolean > ( narrowedComboBox . autoselect ) ;
96+ assertType < boolean | null | undefined > ( narrowedComboBox . autoOpenDisabled ) ;
97+ assertType < boolean > ( narrowedComboBox . opened ) ;
98+ assertType < string > ( narrowedComboBox . filter ) ;
99+ assertType < TestComboBoxItem [ ] | undefined > ( narrowedComboBox . filteredItems ) ;
100+ assertType < TestComboBoxItem [ ] | undefined > ( narrowedComboBox . items ) ;
101+ assertType < string | null | undefined > ( narrowedComboBox . itemIdPath ) ;
102+ assertType < string > ( narrowedComboBox . itemLabelPath ) ;
103+ assertType < string > ( narrowedComboBox . itemValuePath ) ;
104+ assertType < boolean > ( narrowedComboBox . loading ) ;
105+ assertType < ComboBoxRenderer < TestComboBoxItem > | null | undefined > ( narrowedComboBox . renderer ) ;
106+ assertType < TestComboBoxItem | null | undefined > ( narrowedComboBox . selectedItem ) ;
107+ assertType < boolean > ( narrowedComboBox . invalid ) ;
108+ assertType < HTMLElement | null | undefined > ( narrowedComboBox . focusElement ) ;
109+ assertType < boolean > ( narrowedComboBox . disabled ) ;
110+ assertType < boolean > ( narrowedComboBox . clearButtonVisible ) ;
111+ assertType < string | null | undefined > ( narrowedComboBox . errorMessage ) ;
112+ assertType < string > ( narrowedComboBox . placeholder ) ;
113+ assertType < string | null | undefined > ( narrowedComboBox . helperText ) ;
114+ assertType < string > ( narrowedComboBox . pattern ) ;
115+ assertType < boolean | null | undefined > ( narrowedComboBox . preventInvalidInput ) ;
116+ assertType < boolean > ( narrowedComboBox . readonly ) ;
117+ assertType < string | null | undefined > ( narrowedComboBox . label ) ;
118+ assertType < string > ( narrowedComboBox . value ) ;
119+ assertType < boolean > ( narrowedComboBox . required ) ;
120+ assertType < string > ( narrowedComboBox . name ) ;
121+
122+ // ComboBox mixins
123+ assertType < ComboBoxDataProviderMixinClass < TestComboBoxItem > > ( narrowedComboBox ) ;
124+ assertType < ComboBoxMixinClass < TestComboBoxItem > > ( narrowedComboBox ) ;
125+ assertType < ControllerMixinClass > ( narrowedComboBox ) ;
126+ assertType < ElementMixinClass > ( narrowedComboBox ) ;
127+ assertType < DelegateFocusMixinClass > ( narrowedComboBox ) ;
128+ assertType < DelegateStateMixinClass > ( narrowedComboBox ) ;
129+ assertType < DisabledMixinClass > ( narrowedComboBox ) ;
130+ assertType < FieldMixinClass > ( narrowedComboBox ) ;
131+ assertType < FocusMixinClass > ( narrowedComboBox ) ;
132+ assertType < InputConstraintsMixinClass > ( narrowedComboBox ) ;
133+ assertType < InputControlMixinClass > ( narrowedComboBox ) ;
134+ assertType < InputMixinClass > ( narrowedComboBox ) ;
135+ assertType < KeyboardMixinClass > ( narrowedComboBox ) ;
136+ assertType < LabelMixinClass > ( narrowedComboBox ) ;
137+ assertType < PatternMixinClass > ( narrowedComboBox ) ;
138+ assertType < ValidateMixinClass > ( narrowedComboBox ) ;
139+ assertType < ThemableMixinClass > ( narrowedComboBox ) ;
140+
141+ /* ComboBoxLight */
80142const genericComboBoxLight = document . createElement ( 'vaadin-combo-box-light' ) ;
81143assertType < ComboBoxLight > ( genericComboBoxLight ) ;
82144
83145const narrowedComboBoxLight = genericComboBoxLight as ComboBoxLight < TestComboBoxItem > ;
84- assertType < ComboBoxDataProviderMixinClass < TestComboBoxItem > > ( narrowedComboBoxLight ) ;
85- assertType < ComboBoxMixinClass < TestComboBoxItem > > ( narrowedComboBoxLight ) ;
86- assertType < ThemableMixinClass > ( narrowedComboBoxLight ) ;
87146
88147narrowedComboBoxLight . addEventListener ( 'change' , ( event ) => {
89148 assertType < ComboBoxLightChangeEvent < TestComboBoxItem > > ( event ) ;
@@ -119,3 +178,23 @@ narrowedComboBoxLight.addEventListener('selected-item-changed', (event) => {
119178 assertType < ComboBoxLightSelectedItemChangedEvent < TestComboBoxItem > > ( event ) ;
120179 assertType < TestComboBoxItem | null | undefined > ( event . detail . value ) ;
121180} ) ;
181+
182+ // ComboBoxLight properties
183+ assertType < ( ) => boolean > ( narrowedComboBoxLight . checkValidity ) ;
184+ assertType < ( ) => boolean > ( narrowedComboBoxLight . validate ) ;
185+ assertType < ( ) => void > ( narrowedComboBoxLight . close ) ;
186+ assertType < ( ) => void > ( narrowedComboBoxLight . open ) ;
187+ assertType < boolean | null | undefined > ( narrowedComboBoxLight . autoOpenDisabled ) ;
188+ assertType < boolean > ( narrowedComboBoxLight . opened ) ;
189+ assertType < boolean > ( narrowedComboBoxLight . invalid ) ;
190+ assertType < boolean > ( narrowedComboBoxLight . disabled ) ;
191+ assertType < boolean > ( narrowedComboBoxLight . readonly ) ;
192+ assertType < string > ( narrowedComboBoxLight . value ) ;
193+
194+ // ComboBoxLight mixins
195+ assertType < ComboBoxDataProviderMixinClass < TestComboBoxItem > > ( narrowedComboBoxLight ) ;
196+ assertType < ComboBoxMixinClass < TestComboBoxItem > > ( narrowedComboBoxLight ) ;
197+ assertType < DisabledMixinClass > ( narrowedComboBoxLight ) ;
198+ assertType < InputMixinClass > ( narrowedComboBoxLight ) ;
199+ assertType < KeyboardMixinClass > ( narrowedComboBoxLight ) ;
200+ assertType < ThemableMixinClass > ( narrowedComboBoxLight ) ;
0 commit comments