-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(heatmap): fix support for enableLabels property
- Loading branch information
Raphaël Benitte
authored and
Raphaël Benitte
committed
Oct 25, 2018
1 parent
2b0cfec
commit a866586
Showing
11 changed files
with
724 additions
and
53 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
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
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
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
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
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,2 @@ | ||
env: | ||
jest: true |
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,50 @@ | ||
import React from 'react' | ||
import renderer from 'react-test-renderer' | ||
import { mount } from 'enzyme' | ||
import HeatMapCellRect from '../src/HeatMapCellRect' | ||
import HeatMap from '../src/HeatMap' | ||
|
||
const sampleProps = { | ||
indexBy: 'age', | ||
keys: ['rent', 'loan', 'income'], | ||
data: [ | ||
{ | ||
age: 20, | ||
rent: 30, | ||
loan: 24, | ||
income: 60, | ||
}, | ||
{ | ||
age: 30, | ||
rent: 40, | ||
loan: 50, | ||
income: 90, | ||
}, | ||
{ | ||
age: 40, | ||
rent: 20, | ||
loan: 13, | ||
income: 40, | ||
}, | ||
], | ||
width: 500, | ||
height: 300, | ||
animate: false, | ||
} | ||
|
||
it('should render a basic heat map chart', () => { | ||
const component = renderer.create(<HeatMap {...sampleProps} />) | ||
|
||
let tree = component.toJSON() | ||
expect(tree).toMatchSnapshot() | ||
}) | ||
|
||
it('should allow to disable labels', () => { | ||
const wrapper = mount(<HeatMap {...sampleProps} enableLabels={false} />) | ||
|
||
const cells = wrapper.find(HeatMapCellRect) | ||
expect(cells).toHaveLength(9) | ||
cells.forEach(cell => { | ||
expect(cell.find('text').exists()).toBe(false) | ||
}) | ||
}) |
Oops, something went wrong.