@@ -7,6 +7,8 @@ import DialogTest, { type DialogTestProps } from "./dialog-test.svelte";
77import DialogNestedTest from "./dialog-nested-test.svelte" ;
88import { expectExists , expectNotExists , setupBrowserUserEvents } from "../browser-utils" ;
99import DialogForceMountTest from "./dialog-force-mount-test.svelte" ;
10+ import DialogIntegrationTest from "./dialog-integration-test.svelte" ;
11+ import DialogTooltipTest from "./dialog-tooltip-test.svelte" ;
1012
1113const kbd = getTestKbd ( ) ;
1214
@@ -384,3 +386,39 @@ describe("Nested Dialogs", () => {
384386 await expect . element ( page . getByTestId ( "second-open" ) ) . toHaveFocus ( ) ;
385387 } ) ;
386388} ) ;
389+
390+ describe ( "Integration with other components" , ( ) => {
391+ it ( "should allow opening nested floating components within the dialog" , async ( ) => {
392+ render ( DialogIntegrationTest ) ;
393+ await page . getByTestId ( "dialog-trigger" ) . click ( ) ;
394+ await expectExists ( page . getByTestId ( "dialog-content" ) ) ;
395+ await page . getByTestId ( "dropdown-trigger" ) . click ( ) ;
396+ await expectExists ( page . getByTestId ( "dropdown-content" ) ) ;
397+ await userEvent . keyboard ( kbd . ESCAPE ) ;
398+ await expectNotExists ( page . getByTestId ( "dropdown-content" ) ) ;
399+ await expectExists ( page . getByTestId ( "dialog-content" ) ) ;
400+ await page . getByTestId ( "popover-trigger" ) . click ( ) ;
401+ await expectExists ( page . getByTestId ( "popover-content" ) ) ;
402+ await userEvent . keyboard ( kbd . ESCAPE ) ;
403+ await expectNotExists ( page . getByTestId ( "popover-content" ) ) ;
404+ await expectExists ( page . getByTestId ( "dialog-content" ) ) ;
405+ await userEvent . keyboard ( kbd . ESCAPE ) ;
406+ await expectNotExists ( page . getByTestId ( "dialog-content" ) ) ;
407+ } ) ;
408+
409+ it ( "should not break tooltip when opened from tooltip trigger and disableCloseOnTriggerClick is true" , async ( ) => {
410+ // https://github.com/huntabyte/bits-ui/issues/1666
411+ render ( DialogTooltipTest ) ;
412+ const trigger = page . getByTestId ( "trigger" ) ;
413+ await trigger . hover ( ) ;
414+ await expectExists ( page . getByTestId ( "tooltip-content" ) ) ;
415+ await trigger . click ( ) ;
416+ await expectExists ( page . getByTestId ( "dialog-content" ) ) ;
417+ await expectNotExists ( page . getByTestId ( "tooltip-content" ) ) ;
418+ await page . getByTestId ( "dialog-close" ) . click ( ) ;
419+
420+ await expectNotExists ( page . getByTestId ( "dialog-content" ) ) ;
421+ await trigger . hover ( ) ;
422+ await expectExists ( page . getByTestId ( "tooltip-content" ) ) ;
423+ } ) ;
424+ } ) ;
0 commit comments