Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] feat(Dialog): add containerRef prop #5314

Merged
merged 9 commits into from
May 27, 2022
Prev Previous commit
Next Next commit
just pushing the test for the pr's sake... cannot figure out yarn tes…
…t locally currently
dlichen committed May 24, 2022
commit 897e71b6c7a2dc714ed77f56ee25b4463a8cfdab
10 changes: 10 additions & 0 deletions packages/core/test/dialog/dialogTests.tsx
Original file line number Diff line number Diff line change
@@ -192,6 +192,16 @@ describe("<Dialog>", () => {
// test existence here because id is generated
assert.notExists(dialog.find(".no-default-if-no-title").hostNodes().prop("aria-labelledby"));
});

it("supports ref objects attached to container", () => {
const containerRef = React.createRef<HTMLDivElement>();
mount(
<Dialog containerRef={containerRef} usePortal={false}>
{createDialogContents()}
</Dialog>,
);
assert.isTrue(containerRef.current?.classList.contains(Classes.DIALOG_CONTAINER));
});
});

// everything else about Dialog is tested by Overlay