forked from FormidableLabs/victory-chart
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request FormidableLabs#416 from AugustinLF/feature/pan-onl…
…y-victory-zoom Make zoom optional in VictoryZoom closes FormidableLabs#429
- Loading branch information
Showing
3 changed files
with
92 additions
and
61 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
29 changes: 29 additions & 0 deletions
29
test/client/spec/components/victory-zoom/victory-zoom.spec.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,29 @@ | ||
/** | ||
* Client tests | ||
*/ | ||
/*eslint-disable max-nested-callbacks */ | ||
/* eslint no-unused-expressions: 0 */ | ||
import React from "react"; | ||
import { shallow } from "enzyme"; | ||
import VictoryZoom from "src/components/victory-zoom/victory-zoom"; | ||
import VictoryChart from "src/components/victory-chart/victory-chart"; | ||
|
||
describe("components/victory-zoom", () => { | ||
describe("allowZoom property", () => { | ||
it("should allow or disallow zooming on the chart", () => { | ||
const wrapper = shallow( | ||
<VictoryZoom> | ||
<VictoryChart /> | ||
</VictoryZoom> | ||
); | ||
const getHandlersList = (chart) => Object.keys(chart.props().events[0].eventHandlers); | ||
|
||
const zoomableChart = wrapper.find(VictoryChart); | ||
expect(getHandlersList(zoomableChart).indexOf("onWheel") !== -1).to.equal(true); | ||
|
||
wrapper.setProps({allowZoom: false}); | ||
const nonZoomableChart = wrapper.find(VictoryChart); | ||
expect(getHandlersList(nonZoomableChart).indexOf("onWheel") === -1).to.equal(true); | ||
}); | ||
}); | ||
}); |