-
-
Notifications
You must be signed in to change notification settings - Fork 411
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add tests for TruncatedTextWithTooltip
to do with opencollective/opencollective#4495
- Loading branch information
1 parent
12865e5
commit bad2b61
Showing
2 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
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,27 @@ | ||
import 'jest-styled-components'; | ||
|
||
import React from 'react'; | ||
import { ThemeProvider } from 'styled-components'; | ||
|
||
import theme from '../../lib/theme'; | ||
import { snapshot } from '../../test/snapshot-helpers'; | ||
|
||
import TruncatedTextWithTooltip from '../TruncatedTextWithTooltip'; | ||
|
||
describe('TruncatedTextWithTooltip component', () => { | ||
it('renders default options', () => { | ||
snapshot( | ||
<ThemeProvider theme={theme}> | ||
<TruncatedTextWithTooltip value="A short string" /> | ||
</ThemeProvider>, | ||
); | ||
}); | ||
|
||
it('renders default options', () => { | ||
snapshot( | ||
<ThemeProvider theme={theme}> | ||
<TruncatedTextWithTooltip value="a string that is more than 30 characters long" /> | ||
</ThemeProvider>, | ||
); | ||
}); | ||
}); |
23 changes: 23 additions & 0 deletions
23
components/__tests__/__snapshots__/TruncatedTextWithTooltip.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,23 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`TruncatedTextWithTooltip component renders default options 1`] = `"A short string"`; | ||
|
||
exports[`TruncatedTextWithTooltip component renders default options 2`] = ` | ||
.c0 { | ||
display: inline-block; | ||
cursor: help; | ||
} | ||
.c0 button:disabled { | ||
pointer-events: none; | ||
} | ||
<div | ||
className="c0" | ||
display="inline-block" | ||
onMouseEnter={[Function]} | ||
onMouseLeave={[Function]} | ||
> | ||
a string that is more than ... | ||
</div> | ||
`; |