@@ -133,4 +133,65 @@ test.describe('sheet modal: setting the breakpoint', () => {
133
133
expect ( ionBreakpointDidChange . events . length ) . toBe ( 1 ) ;
134
134
} ) ;
135
135
} ) ;
136
+
137
+ test ( 'it should reset the breakpoint value on dismiss' , async ( { page } ) => {
138
+ test . info ( ) . annotations . push ( {
139
+ type : 'issue' ,
140
+ description : 'https://github.com/ionic-team/ionic-framework/issues/25245' ,
141
+ } ) ;
142
+
143
+ await page . setContent ( `
144
+ <ion-content>
145
+ <ion-button id="open-modal">Open</ion-button>
146
+ <ion-modal trigger="open-modal" initial-breakpoint="0.25">
147
+ <ion-content>
148
+ <ion-button id="dismiss" onclick="modal.dismiss();">Dismiss</ion-button>
149
+ <ion-button id="set-breakpoint">Set breakpoint</ion-button>
150
+ </ion-content>
151
+ </ion-modal>
152
+ </ion-content>
153
+ <script>
154
+ const modal = document.querySelector('ion-modal');
155
+ const setBreakpointButton = document.querySelector('#set-breakpoint');
156
+
157
+ modal.breakpoints = [0.25, 0.5, 1];
158
+
159
+ setBreakpointButton.addEventListener('click', () => {
160
+ modal.setCurrentBreakpoint(0.5);
161
+ });
162
+ </script>
163
+ ` ) ;
164
+
165
+ const modal = page . locator ( 'ion-modal' ) ;
166
+ const dismissButton = page . locator ( '#dismiss' ) ;
167
+ const openButton = page . locator ( '#open-modal' ) ;
168
+ const setBreakpointButton = page . locator ( '#set-breakpoint' ) ;
169
+
170
+ const ionModalDidPresent = await page . spyOnEvent ( 'ionModalDidPresent' ) ;
171
+ const ionModalDidDismiss = await page . spyOnEvent ( 'ionModalDidDismiss' ) ;
172
+ const ionBreakpointDidChange = await page . spyOnEvent ( 'ionBreakpointDidChange' ) ;
173
+
174
+ await openButton . click ( ) ;
175
+ await ionModalDidPresent . next ( ) ;
176
+
177
+ await setBreakpointButton . click ( ) ;
178
+ await ionBreakpointDidChange . next ( ) ;
179
+
180
+ await dismissButton . click ( ) ;
181
+ await ionModalDidDismiss . next ( ) ;
182
+
183
+ await openButton . click ( ) ;
184
+ await ionModalDidPresent . next ( ) ;
185
+
186
+ const breakpoint = await modal . evaluate ( ( el : HTMLIonModalElement ) => el . getCurrentBreakpoint ( ) ) ;
187
+
188
+ expect ( breakpoint ) . toBe ( 0.25 ) ;
189
+
190
+ await setBreakpointButton . click ( ) ;
191
+ await ionBreakpointDidChange . next ( ) ;
192
+
193
+ const updatedBreakpoint = await modal . evaluate ( ( el : HTMLIonModalElement ) => el . getCurrentBreakpoint ( ) ) ;
194
+
195
+ expect ( updatedBreakpoint ) . toBe ( 0.5 ) ;
196
+ } ) ;
136
197
} ) ;
0 commit comments