Skip to content

Commit

Permalink
Remove non-spy
Browse files Browse the repository at this point in the history
  • Loading branch information
atomiks committed Jan 23, 2025
1 parent be38b74 commit f7b81f5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
9 changes: 3 additions & 6 deletions packages/react/src/preview-card/root/PreviewCardRoot.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -532,10 +532,7 @@ describe('<PreviewCard.Root />', () => {
it('is called on close when the exit animation finishes', async () => {
globalThis.BASE_UI_ANIMATIONS_DISABLED = false;

let onOpenChangeCompleteValue: boolean | null = null;
function notifyOnOpenChangeComplete(open: boolean) {
onOpenChangeCompleteValue = open;
}
const onOpenChangeComplete = spy();

function Test() {
const style = `
Expand All @@ -557,7 +554,7 @@ describe('<PreviewCard.Root />', () => {
{/* eslint-disable-next-line react/no-danger */}
<style dangerouslySetInnerHTML={{ __html: style }} />
<button onClick={() => setOpen(false)}>Close</button>
<PreviewCard.Root open={open} onOpenChangeComplete={notifyOnOpenChangeComplete}>
<PreviewCard.Root open={open} onOpenChangeComplete={onOpenChangeComplete}>
<PreviewCard.Portal>
<PreviewCard.Positioner>
<PreviewCard.Popup className="animation-test-indicator" data-testid="popup" />
Expand All @@ -579,7 +576,7 @@ describe('<PreviewCard.Root />', () => {
expect(screen.queryByTestId('popup')).to.equal(null);
});

expect(onOpenChangeCompleteValue).to.equal(false);
expect(onOpenChangeComplete.lastCall.args[0]).to.equal(false);
});
});

Expand Down
9 changes: 3 additions & 6 deletions packages/react/src/tooltip/root/TooltipRoot.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -431,10 +431,7 @@ describe('<Tooltip.Root />', () => {
it('is called on close when the exit animation finishes', async () => {
globalThis.BASE_UI_ANIMATIONS_DISABLED = false;

let onOpenChangeCompleteValue: boolean | null = null;
function notifyOnOpenChangeComplete(open: boolean) {
onOpenChangeCompleteValue = open;
}
const onOpenChangeComplete = spy();

function Test() {
const style = `
Expand All @@ -456,7 +453,7 @@ describe('<Tooltip.Root />', () => {
{/* eslint-disable-next-line react/no-danger */}
<style dangerouslySetInnerHTML={{ __html: style }} />
<button onClick={() => setOpen(false)}>Close</button>
<Tooltip.Root open={open} onOpenChangeComplete={notifyOnOpenChangeComplete}>
<Tooltip.Root open={open} onOpenChangeComplete={onOpenChangeComplete}>
<Tooltip.Portal>
<Tooltip.Positioner>
<Tooltip.Popup className="animation-test-indicator" data-testid="popup" />
Expand All @@ -478,7 +475,7 @@ describe('<Tooltip.Root />', () => {
expect(screen.queryByTestId('popup')).to.equal(null);
});

expect(onOpenChangeCompleteValue).to.equal(false);
expect(onOpenChangeComplete.lastCall.args[0]).to.equal(false);
});
});

Expand Down

0 comments on commit f7b81f5

Please sign in to comment.