Skip to content

Commit

Permalink
test: add tests for TruncatedTextWithTooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
simonv3 authored and SudharakaP committed Sep 13, 2021
1 parent 12865e5 commit bad2b61
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
27 changes: 27 additions & 0 deletions components/__tests__/TruncatedTextWithTooltip.test.js
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>,
);
});
});
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>
`;

0 comments on commit bad2b61

Please sign in to comment.