@@ -128,6 +128,18 @@ describe('<lion-field>', () => {
128128 expect ( el . inputElement . getAttribute ( 'name' ) ) . to . equal ( 'foo' ) ;
129129 } ) ;
130130
131+ it ( 'has a type which is reflected to an attribute and is synced down to the native input' , async ( ) => {
132+ const el = await fixture ( `<${ tagString } >${ inputSlotString } </${ tagString } >` ) ;
133+ expect ( el . type ) . to . equal ( 'text' ) ;
134+ expect ( el . getAttribute ( 'type' ) ) . to . equal ( 'text' ) ;
135+ expect ( el . inputElement . getAttribute ( 'type' ) ) . to . equal ( 'text' ) ;
136+
137+ el . type = 'foo' ;
138+ await el . updateComplete ;
139+ expect ( el . getAttribute ( 'type' ) ) . to . equal ( 'foo' ) ;
140+ expect ( el . inputElement . getAttribute ( 'type' ) ) . to . equal ( 'foo' ) ;
141+ } ) ;
142+
131143 // TODO: find out if we could put all listeners on this.value (instead of this.inputElement.value)
132144 // and make it act on this.value again
133145 it ( 'has a class "state-filled" if this.value is filled' , async ( ) => {
@@ -397,23 +409,6 @@ describe('<lion-field>', () => {
397409 expect ( el . inputElement . value ) . to . equal ( 'one' ) ;
398410 } ) ;
399411
400- it ( 'delegates property type' , async ( ) => {
401- const el = await fixture ( `<${ tagString } type="text">${ inputSlotString } </${ tagString } >` ) ;
402- const inputElemTag = el . inputElement . tagName . toLowerCase ( ) ;
403- if ( inputElemTag === 'select' ) {
404- // TODO: later on we might want to support multi select ?
405- expect ( el . inputElement . type ) . to . contain ( 'select-one' ) ;
406- } else if ( inputElemTag === 'textarea' ) {
407- expect ( el . inputElement . type ) . to . contain ( 'textarea' ) ;
408- } else {
409- // input or custom inputElement
410- expect ( el . inputElement . type ) . to . contain ( 'text' ) ;
411- el . type = 'password' ;
412- expect ( el . type ) . to . equal ( 'password' ) ;
413- expect ( el . inputElement . type ) . to . equal ( 'password' ) ;
414- }
415- } ) ;
416-
417412 it ( 'delegates property selectionStart and selectionEnd' , async ( ) => {
418413 const el = await fixture ( html `
419414 < ${ tag }
0 commit comments