Skip to main content

ComponentTests

Horizontal Bar Chart – Component test plan

Sub-components: Bar, Callout, Labels, Benchmark

  1. Bar: Bar data, Bar color (single), bar label(left and right)
  2. Callout: Default/custom callout
  3. Labels: Default/Custom labels
Test stepsValidationTool used
Test 1: [Snapshot testing]
- With only data prop, string data on x-axis.Should render horizontal bar chart legend with string dataRTL
- With variant set to “absolute scale”Should render absolute scale variant correctlyEnzyme
- With variant set to “absolute scale” and hide labels set to “true”Should not render bar labels in absolute scale variantEnzyme
Test 2: Basic props testing
- HideTooltip prop set to “true”Should not mount callout when hideTootip is trueEnzyme
- HideTooltip prop set to “false”Should mount callout when hideTootip is falseEnzyme
- onRenderCalloutPerHorizantalBar prop is not givenShould not render onRenderCalloutPerHorizantalBarEnzyme
- onRenderCalloutPerHorizantalBar is givenShould render onRenderCalloutPerHorizantalBarEnzyme
- HideLabels prop set to “true”Should not render bar labels when hideLabels is trueRTL
- Legend value set to “x”Should display legend/left side label with specified dataRTL
Test 3: Render calling with respective to props
- No prop changes: Mount HorizontalBarChart and then set the same props againRender function should have been called twiceEnzyme
- Prop changes: Mount HorizontalBarChart chart and then set some other propRender function should have been called twiceEnzyme
Test 4: Mouse events
- Mouse over on a barShould render callout correctly on mouseoverEnzyme
- Mouse move from one bar to other barShould render callout correctly on mouse moveRTL
- Mouse over on a bar with customized calloutShould render customized callout on mouseoverRTL
Test 5: [Sub-Component]: Bar
- Specify bar colorShould render bar with the specified colorRTL
- setbarHeight to “x”Should render bars with specified heightRTL
- set variant to “absolute scale”Should render bars right side label inline with barRTL
- set variant to “part to whole”Should render bars right side label on top of barRTL
- set chartDataMode to “fraction”Should render bar right side label value as a fractional oneRTL
- set chartDataMode to “percentage”Should render bar right side label value as a percentage valueRTL
- set barChartCustomData to “x”Should show custom data on bar right side labelRTL
Test 6: [Sub-Component]: Benchmark
- Specify benchmark dataShould render bars with benchmark symbolRTL
Test 7: [Sub-Component]: Callout
- Hover mouse over a barShould call the handler on mouse over barRTL
- Hover mouse over a bar to display calloutShould show the default callout over that barRTL
- Specify custom callout and hover mouse over a barShould show the custom callout over that barRTL
Test 8: [Sub-Component]: Screen resolution
- Increase the screen resolution (zoom in)Should remain unchanged on zoom inRTL
- Decrease the screen resolution (zoom out)Should remain unchanged on zoom outRTL
Test 9: Theme changed to Dark ThemeShould reflect theme changeRTL
Test 10: Horizontal bar chart re-rendering
- Update chart dataShould re-render chart when data is updatedRTL
Test 11: Horizontal bar chart with empty data
- Chart with Empty dataShould render chart with Empty chart are labelEnzyme
- Chart with proper dataShould not render chart with empty chart are labelEnzyme