File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,10 @@ export class LionInput extends LionField {
3030 type : Number ,
3131 reflect : true ,
3232 } ,
33+ placeholder : {
34+ type : String ,
35+ reflect : true ,
36+ } ,
3337 } ;
3438 }
3539
@@ -80,6 +84,9 @@ export class LionInput extends LionField {
8084 if ( changedProps . has ( 'step' ) ) {
8185 this . inputElement . step = this . step ;
8286 }
87+ if ( changedProps . has ( 'placeholder' ) ) {
88+ this . inputElement . placeholder = this . placeholder ;
89+ }
8390 }
8491
8592 __delegateReadOnly ( ) {
Original file line number Diff line number Diff line change @@ -38,4 +38,15 @@ describe('<lion-input>', () => {
3838 expect ( el . getAttribute ( 'type' ) ) . to . equal ( 'foo' ) ;
3939 expect ( el . inputElement . getAttribute ( 'type' ) ) . to . equal ( 'foo' ) ;
4040 } ) ;
41+
42+ it ( 'has an attribute that can be used to set the placeholder text of the input' , async ( ) => {
43+ const el = await fixture ( `<lion-input placeholder="text"></lion-input>` ) ;
44+ expect ( el . getAttribute ( 'placeholder' ) ) . to . equal ( 'text' ) ;
45+ expect ( el . inputElement . getAttribute ( 'placeholder' ) ) . to . equal ( 'text' ) ;
46+
47+ el . placeholder = 'foo' ;
48+ await el . updateComplete ;
49+ expect ( el . getAttribute ( 'placeholder' ) ) . to . equal ( 'foo' ) ;
50+ expect ( el . inputElement . getAttribute ( 'placeholder' ) ) . to . equal ( 'foo' ) ;
51+ } ) ;
4152} ) ;
You can’t perform that action at this time.
0 commit comments