File tree 2 files changed +21
-1
lines changed
2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -208,6 +208,26 @@ describe("bl-dialog", () => {
208
208
await resetMouse ( ) ;
209
209
} ) ;
210
210
211
+ it ( "should prevent parent dialog from closing when the child dialog is closed" , async ( ) => {
212
+ const dialog = await fixture < typeOfBlDialog > ( html `< bl-dialog id ="parent " open >
213
+ < bl-dialog id ="child " open >
214
+ Child dialog
215
+ </ bl-dialog >
216
+ </ bl-dialog > ` ) ;
217
+
218
+ const childDialog = dialog . querySelector ( "bl-dialog" ) as typeOfBlDialog ;
219
+ const childDialogCloseBtn = childDialog ?. shadowRoot ?. querySelector ( "bl-button" ) ;
220
+
221
+ expect ( dialog . open ) . to . equal ( true ) ;
222
+
223
+ childDialogCloseBtn ?. click ( ) ;
224
+
225
+ setTimeout ( ( ) => {
226
+ expect ( dialog . open ) . to . equal ( true ) ;
227
+ expect ( childDialog . open ) . to . equal ( false ) ;
228
+ } ) ;
229
+ } ) ;
230
+
211
231
it ( "should add shadow to footer when the content is too long" , async ( ) => {
212
232
window . innerWidth = 400 ;
213
233
Original file line number Diff line number Diff line change @@ -111,7 +111,7 @@ export default class BlDialog extends LitElement {
111
111
this . content ?. addEventListener ( "scroll" , this . toggleFooterShadow ) ;
112
112
} else {
113
113
this . dialog ?. close ?.( ) ;
114
- this . onClose ( { isOpen : false } ) ;
114
+ this . onClose ( { isOpen : false } , { bubbles : false } ) ;
115
115
document . body . style . overflow = "auto" ;
116
116
window ?. removeEventListener ( "keydown" , this . onKeydown ) ;
117
117
window ?. removeEventListener ( "resize" , this . toggleFooterShadow ) ;
You can’t perform that action at this time.
0 commit comments