banner.spec.tsx 674 B

1234567891011121314151617181920
  1. import {render, screen, userEvent} from 'sentry-test/reactTestingLibrary';
  2. import Banner from 'sentry/components/banner';
  3. describe('Banner', function () {
  4. it('can be dismissed', function () {
  5. render(<Banner dismissKey="test" title="test" />);
  6. expect(screen.getByText('test')).toBeInTheDocument();
  7. userEvent.click(screen.getByLabelText('Close'));
  8. expect(screen.queryByText('test')).not.toBeInTheDocument();
  9. expect(localStorage.getItem('test-banner-dismissed')).toBe('true');
  10. });
  11. it('is not dismissable', function () {
  12. render(<Banner isDismissable={false} />);
  13. expect(screen.queryByLabelText('Close')).not.toBeInTheDocument();
  14. });
  15. });