@@ -3,17 +3,18 @@ describe('Inputs', () => {
33 cy . visit ( '/lazy/inputs' ) ;
44 } )
55
6- it ( 'should have default value ' , ( ) => {
6+ it ( 'should have default values ' , ( ) => {
77 cy . get ( 'ion-checkbox' ) . should ( 'have.prop' , 'checked' ) . and ( 'equal' , true ) ;
88 cy . get ( 'ion-radio-group' ) . should ( 'have.prop' , 'value' ) . and ( 'equal' , 'nes' ) ;
99 cy . get ( 'ion-toggle' ) . should ( 'have.prop' , 'checked' ) . and ( 'equal' , true ) ;
1010 cy . get ( 'ion-input' ) . should ( 'have.prop' , 'value' ) . and ( 'equal' , 'some text' ) ;
11+ cy . get ( 'ion-input-otp' ) . should ( 'have.prop' , 'value' ) . and ( 'equal' , '1234' ) ;
1112 cy . get ( 'ion-datetime' ) . should ( 'have.prop' , 'value' ) . and ( 'equal' , '1994-03-15' ) ;
1213 cy . get ( 'ion-select' ) . should ( 'have.prop' , 'value' ) . and ( 'equal' , 'nes' ) ;
1314 cy . get ( 'ion-range' ) . should ( 'have.prop' , 'value' ) . and ( 'equal' , 50 ) ;
1415 } ) ;
1516
16- it ( 'should have reset value ' , ( ) => {
17+ it ( 'should reset values ' , ( ) => {
1718 cy . get ( '#reset-button' ) . click ( ) ;
1819
1920 cy . get ( 'ion-checkbox' ) . should ( 'have.prop' , 'checked' ) . and ( 'equal' , false ) ;
@@ -26,33 +27,38 @@ describe('Inputs', () => {
2627 * value property is undefined.
2728 */
2829 cy . get ( 'ion-input' ) . should ( 'not.have.prop' , 'value' ) ;
30+ cy . get ( 'ion-input-otp' ) . should ( 'not.have.prop' , 'value' ) ;
2931 cy . get ( 'ion-datetime' ) . should ( 'not.have.prop' , 'value' ) ;
3032 cy . get ( 'ion-select' ) . should ( 'not.have.prop' , 'value' ) ;
3133 cy . get ( 'ion-range' ) . should ( 'not.have.prop' , 'value' ) ;
3234 } ) ;
3335
34- it ( 'should get some value ' , ( ) => {
36+ it ( 'should set values ' , ( ) => {
3537 cy . get ( '#reset-button' ) . click ( ) ;
3638 cy . get ( '#set-button' ) . click ( ) ;
3739
3840 cy . get ( 'ion-checkbox' ) . should ( 'have.prop' , 'checked' ) . and ( 'equal' , true ) ;
3941 cy . get ( 'ion-radio-group' ) . should ( 'have.prop' , 'value' ) . and ( 'equal' , 'nes' ) ;
4042 cy . get ( 'ion-toggle' ) . should ( 'have.prop' , 'checked' ) . and ( 'equal' , true ) ;
4143 cy . get ( 'ion-input' ) . should ( 'have.prop' , 'value' ) . and ( 'equal' , 'some text' ) ;
44+ cy . get ( 'ion-input-otp' ) . should ( 'have.prop' , 'value' ) . and ( 'equal' , '1234' ) ;
4245 cy . get ( 'ion-datetime' ) . should ( 'have.prop' , 'value' ) . and ( 'equal' , '1994-03-15' ) ;
4346 cy . get ( 'ion-select' ) . should ( 'have.prop' , 'value' ) . and ( 'equal' , 'nes' ) ;
4447 cy . get ( 'ion-range' ) . should ( 'have.prop' , 'value' ) . and ( 'equal' , 50 ) ;
4548 } ) ;
4649
47- it ( 'change values should update angular' , ( ) => {
50+ it ( 'should update angular when values change ' , ( ) => {
4851 cy . get ( '#reset-button' ) . click ( ) ;
4952
5053 cy . get ( 'ion-checkbox#first-checkbox' ) . click ( ) ;
5154 cy . get ( 'ion-radio' ) . first ( ) . click ( ) ;
5255 cy . get ( 'ion-toggle' ) . first ( ) . click ( ) ;
5356
5457 cy . get ( 'ion-input' ) . eq ( 0 ) . type ( 'hola' ) ;
55- cy . get ( 'ion-input input' ) . eq ( 0 ) . blur ( ) ;
58+ cy . focused ( ) . blur ( ) ;
59+
60+ cy . get ( 'ion-input-otp input' ) . eq ( 0 ) . type ( '1234' ) ;
61+ cy . focused ( ) . blur ( ) ;
5662
5763 // Set date to 1994-03-14
5864 cy . get ( 'ion-datetime' ) . first ( ) . shadow ( ) . find ( '.calendar-day:not([disabled])' ) . first ( ) . click ( ) ;
@@ -68,7 +74,18 @@ describe('Inputs', () => {
6874 cy . get ( '#radio-note' ) . should ( 'have.text' , 'nes' ) ;
6975 cy . get ( '#toggle-note' ) . should ( 'have.text' , 'true' ) ;
7076 cy . get ( '#input-note' ) . should ( 'have.text' , 'hola' ) ;
77+ cy . get ( '#input-otp-note' ) . should ( 'have.text' , '1234' ) ;
7178 cy . get ( '#datetime-note' ) . should ( 'have.text' , '1994-03-14' ) ;
7279 cy . get ( '#select-note' ) . should ( 'have.text' , 'ps' ) ;
7380 } ) ;
81+
82+ it ( 'should update values when erasing input' , ( ) => {
83+ cy . get ( 'ion-input' ) . eq ( 0 ) . type ( '{backspace}' ) ;
84+ cy . get ( 'ion-input' ) . should ( 'have.prop' , 'value' ) . and ( 'equal' , 'some tex' ) ;
85+ cy . get ( '#input-note' ) . should ( 'have.text' , 'some tex' ) ;
86+
87+ cy . get ( 'ion-input-otp input:last' ) . eq ( 0 ) . type ( '{backspace}' ) ;
88+ cy . get ( 'ion-input-otp' ) . should ( 'have.prop' , 'value' ) . and ( 'equal' , '123' ) ;
89+ cy . get ( '#input-otp-note' ) . should ( 'have.text' , '123' ) ;
90+ } ) ;
7491} ) ;
0 commit comments