Skip to content

Commit

Permalink
Add a describe test asserting proper behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasTy committed May 22, 2024
1 parent 8dd6224 commit 88a42a2
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/utils/pickers/describePicker/describePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,22 @@ function innerDescribePicker(ElementToTest: React.ElementType, options: Describe
expect(screen.queryByTestId('pickers-toolbar')).to.equal(null);
});
});

describe('prop: disableOpenPicker', () => {
it('should not render the open picker button, but still render the picker if its open', function test() {
if (variant === 'static') {
this.skip();
}

render(<ElementToTest disableOpenPicker {...propsToOpen} />);

expect(screen.queryByRole('button', { name: /Choose/ })).to.equal(null);
// check if anything has been rendered inside the layout content wrapper
expect(document.querySelector('.MuiPickersLayout-contentWrapper')?.hasChildNodes()).to.equal(
true,
);
});
});
}

/**
Expand Down

0 comments on commit 88a42a2

Please sign in to comment.