File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed
core/src/components/datetime Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -1027,6 +1027,13 @@ export class Datetime implements ComponentInterface {
1027
1027
this . destroyInteractionListeners ( ) ;
1028
1028
1029
1029
this . initializeListeners ( ) ;
1030
+
1031
+ /**
1032
+ * The month/year picker from the date interface
1033
+ * should be closed as it is not available in non-date
1034
+ * interfaces.
1035
+ */
1036
+ this . showMonthAndYear = false ;
1030
1037
}
1031
1038
1032
1039
private processValue = ( value ?: string | null ) => {
Original file line number Diff line number Diff line change @@ -83,6 +83,27 @@ test.describe('datetime: presentation', () => {
83
83
84
84
expect ( ionChangeSpy . length ) . toBe ( 1 ) ;
85
85
} ) ;
86
+
87
+ test ( 'switching presentation should close month/year picker' , async ( { page } , testInfo ) => {
88
+ await test . skip ( testInfo . project . metadata . rtl === true , 'This feature does not have RTL specific behaviors.' ) ;
89
+
90
+ await page . setContent ( `
91
+ <ion-datetime presentation="date"></ion-datetime>
92
+ ` ) ;
93
+
94
+ await page . waitForSelector ( '.datetime-ready' ) ;
95
+
96
+ const datetime = page . locator ( 'ion-datetime' ) ;
97
+ const monthYearButton = page . locator ( 'ion-datetime .calendar-month-year' ) ;
98
+ await monthYearButton . click ( ) ;
99
+
100
+ await expect ( datetime ) . toHaveClass ( / s h o w - m o n t h - a n d - y e a r / ) ;
101
+
102
+ await datetime . evaluate ( ( el : HTMLIonDatetimeElement ) => ( el . presentation = 'time' ) ) ;
103
+ await page . waitForChanges ( ) ;
104
+
105
+ await expect ( datetime ) . not . toHaveClass ( / s h o w - m o n t h - a n d - y e a r / ) ;
106
+ } ) ;
86
107
} ) ;
87
108
88
109
test . describe ( 'datetime: presentation: time' , ( ) => {
You can’t perform that action at this time.
0 commit comments