-
Notifications
You must be signed in to change notification settings - Fork 5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix sticky autodetection banner
- Loading branch information
Showing
3 changed files
with
48 additions
and
5 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
.../detected-token-ignored-popover/__snapshots__/detected-token-ignored-popover.test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`DetectedTokenIgnoredPopover should match snapshot for ignore mode 1`] = `<DocumentFragment />`; | ||
|
||
exports[`DetectedTokenIgnoredPopover should match snapshot for import mode 1`] = `<DocumentFragment />`; |
36 changes: 36 additions & 0 deletions
36
.../app/detected-token/detected-token-ignored-popover/detected-token-ignored-popover.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import React from 'react'; | ||
import { render, screen, fireEvent } from '@testing-library/react'; | ||
import DetectedTokenIgnoredPopover from './detected-token-ignored-popover'; | ||
|
||
describe('DetectedTokenIgnoredPopover', () => { | ||
const defaultProps = { | ||
partiallyIgnoreDetectedTokens: false, | ||
onCancelIgnore: jest.fn(), | ||
handleClearTokensSelection: jest.fn(), | ||
isOpen: true, | ||
}; | ||
|
||
const renderComponent = (props = {}) => | ||
render(<DetectedTokenIgnoredPopover {...defaultProps} {...props} />); | ||
|
||
it('should match snapshot for ignore mode', () => { | ||
const { asFragment } = renderComponent(); | ||
expect(asFragment()).toMatchSnapshot(); | ||
}); | ||
|
||
it('should match snapshot for import mode', () => { | ||
const { asFragment } = renderComponent({ | ||
partiallyIgnoreDetectedTokens: true, | ||
}); | ||
expect(asFragment()).toMatchSnapshot(); | ||
}); | ||
|
||
it('should call handleClearTokensSelection when the confirm button is clicked', () => { | ||
renderComponent(); | ||
const confirmButton = screen.getByTestId( | ||
'detected-token-ignored-popover-confirm-button', | ||
); | ||
fireEvent.click(confirmButton); | ||
expect(defaultProps.handleClearTokensSelection).toHaveBeenCalled(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters