diff --git a/change/@fluentui-react-charting-053d3178-4089-4eb8-af55-9706b4484337.json b/change/@fluentui-react-charting-053d3178-4089-4eb8-af55-9706b4484337.json new file mode 100644 index 0000000000000..a48947a68702c --- /dev/null +++ b/change/@fluentui-react-charting-053d3178-4089-4eb8-af55-9706b4484337.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "Added component tests for donut chart", + "packageName": "@fluentui/react-charting", + "email": "srmukher@microsoft.com", + "dependentChangeType": "none" +} diff --git a/packages/react-charting/config/setup-env.js b/packages/react-charting/config/setup-env.js new file mode 100644 index 0000000000000..093264800d8c6 --- /dev/null +++ b/packages/react-charting/config/setup-env.js @@ -0,0 +1 @@ +require('@testing-library/jest-dom'); diff --git a/packages/react-charting/docs/TestPlans/BasicDonutChart.png b/packages/react-charting/docs/TestPlans/BasicDonutChart.png new file mode 100644 index 0000000000000..847d9ffb767fd Binary files /dev/null and b/packages/react-charting/docs/TestPlans/BasicDonutChart.png differ diff --git a/packages/react-charting/docs/TestPlans/DonutChart/ComponentTests.md b/packages/react-charting/docs/TestPlans/DonutChart/ComponentTests.md new file mode 100644 index 0000000000000..0c4434f9bc9d6 --- /dev/null +++ b/packages/react-charting/docs/TestPlans/DonutChart/ComponentTests.md @@ -0,0 +1,35 @@ +
+ +# Component testing - Donut chart test plan + +![Alt text](BasicDonutChart.png) + +### Subcomponents: Pie and Legend + +### Library used: jest and (enzyme or react testing library) + +
+ +| Test case | Execution steps | Validation steps | Library used | +| -------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ------------ | +| Test case 1: [Snapshot testing] [Component] | | Donut chart renders correctly | Enzyme | +| Test case 2: [Snapshot testing] [Individual Props] | Renders donut chart with: | Donut chart renders correctly | Enzyme | +| | | Donut chart renders correctly | Enzyme | +| | | Donut chart renders correctly | Enzyme | +| | | Donut chart renders correctly | Enzyme | +| | | Donut chart renders correctly | Enzyme | +| | | Donut chart renders correctly | Enzyme | +| Test case 3: [Specific DOM elements] Renders individual elements on a prop change: | | Legend mounts correctly | Enzyme | +| | | Callout mounts correctly | Enzyme | +| | | Should not render onRenderCalloutPerStack | Enzyme | +| | | Should render onRenderCalloutPerDataPoint correctly | Enzyme | +| Test case 4: [Mouse events – Donut chart] Renders individual elements on mouse events: | | Should render callout | Enzyme | +| | | Html in step 1 should not be the same as in step 3 | Enzyme | +| | | Should render the custom callout | Enzyme | +| | | On mouse over, callout should be defined, on mouse leave, callout should disappear. | Enzyme | +| Test case 5: [Mouse events – Legends] Renders individual elements on mouse events: | | Should highlight the corresponding pie | RTL | +| | | Should change the value inside donut with the legend value | Enzyme | +| | | Should highlight the corresponding pie with aria-selected set to “true” and tabIndex set to 0. | RTL | +| | | Should have opacity 0.1 for second Pie initially (during mouseOver on first legend) and opacity set to 1 for both the Pies on mouse out. | RTL | +| Test case 6: [Keyboard events – Donut chart] Renders individual elements on keyboard events: | | Should render the corresponding callout | RTL | +| | | Should remove focus from the corresponding Pie | RTL | diff --git a/packages/react-charting/jest.config.js b/packages/react-charting/jest.config.js index b70cd24668eeb..0ac954180f24e 100644 --- a/packages/react-charting/jest.config.js +++ b/packages/react-charting/jest.config.js @@ -19,7 +19,7 @@ function getEsmOnlyPackagesToCjsMapping() { const config = createConfig({ setupFiles: ['./config/tests.js'], snapshotSerializers: ['@fluentui/jest-serializer-merge-styles', 'enzyme-to-json/serializer'], - + setupFilesAfterEnv: ['./config/setup-env.js'], moduleNameMapper: { ...getEsmOnlyPackagesToCjsMapping(), }, diff --git a/packages/react-charting/package.json b/packages/react-charting/package.json index b52c38d1462e9..8f806ec256cb9 100644 --- a/packages/react-charting/package.json +++ b/packages/react-charting/package.json @@ -37,6 +37,7 @@ }, "dependencies": { "@fluentui/react-focus": "^8.8.21", + "@fluentui/theme-samples": "^8.7.70", "@microsoft/load-themed-styles": "^1.10.26", "@types/d3-array": "1.2.1", "@types/d3-axis": "1.0.10", diff --git a/packages/react-charting/src/components/DonutChart/DonutChart.test.tsx b/packages/react-charting/src/components/DonutChart/DonutChart.test.tsx index d6ca50995241c..bb7efc643b61f 100644 --- a/packages/react-charting/src/components/DonutChart/DonutChart.test.tsx +++ b/packages/react-charting/src/components/DonutChart/DonutChart.test.tsx @@ -32,11 +32,12 @@ function sharedAfterEach() { const points: IChartDataPoint[] = [ { legend: 'first', data: 20000, color: '#E5E5E5', xAxisCalloutData: '2020/04/30' }, { legend: 'second', data: 39000, color: '#0078D4', xAxisCalloutData: '2020/04/20' }, + { legend: 'third', data: 45000, color: '#DADADA', xAxisCalloutData: '2020/04/25' }, ]; const chartTitle = 'Stacked Bar chart example'; -const chartPoints: IChartProps = { +export const chartPoints: IChartProps = { chartTitle: chartTitle, chartData: points, }; diff --git a/packages/react-charting/src/components/DonutChart/DonutChartRTL.test.tsx b/packages/react-charting/src/components/DonutChart/DonutChartRTL.test.tsx new file mode 100644 index 0000000000000..d0e65307484d4 --- /dev/null +++ b/packages/react-charting/src/components/DonutChart/DonutChartRTL.test.tsx @@ -0,0 +1,204 @@ +import { render, screen, queryAllByAttribute, fireEvent, act } from '@testing-library/react'; +import { chartPoints } from './DonutChart.test'; +import { DonutChart } from './index'; +import * as React from 'react'; +import { DarkTheme } from '@fluentui/theme-samples'; +import { ThemeProvider } from '@fluentui/react'; +import * as utils from '../../utilities/utilities'; + +test('Should hide callout on mouse leave', () => { + // Arrange + const { container } = render(); + + // Act + const getById = queryAllByAttribute.bind(null, 'id'); + fireEvent.mouseOver(getById(container, /Pie/i)[0]); + expect(getById(container, /callout/i)[0]).toBeDefined(); + fireEvent.mouseLeave(getById(container, /Pie/i)[0]); + + // Assert + expect(getById(container, /callout/i)[0]).toHaveStyle('opacity: 0'); + expect(container).toMatchSnapshot(); +}); + +test('Should show callout on focus', () => { + // Arrange + const { container } = render(); + + // Act + const getById = queryAllByAttribute.bind(null, 'id'); + fireEvent.focus(getById(container, /Pie/i)[0]); + + // Assert + expect(getById(container, /focusRing/i)).toBeDefined(); +}); + +test('Should remove focus on blur', () => { + // Arrange + const { container } = render(); + + // Act + const getById = queryAllByAttribute.bind(null, 'id'); + fireEvent.blur(getById(container, /Pie/i)[0]); + + // Assert + const value = getById(container, /Pie/i)[0].getAttribute('id'); + expect(value).not.toContain('focusRing'); +}); + +test('Should highlight the corresponding Pie on mouse over on legends', () => { + // Arrange + const { container } = render(); + + // Act + const legend = screen.queryByText('first'); + expect(legend).toBeDefined(); + fireEvent.mouseOver(legend!); + + // Assert + const getById = queryAllByAttribute.bind(null, 'id'); + expect(getById(container, /Pie.*?second/i)[0]).toHaveAttribute('opacity', '0.1'); + expect(getById(container, /Pie.*?third/i)[0]).toHaveAttribute('opacity', '0.1'); +}); + +test('Should select legend on single mouse click on legends', () => { + // Arrange + const { container } = render(); + + // Act + const legend = screen.queryByText('first'); + expect(legend).toBeDefined(); + fireEvent.click(legend!); + + // Assert + const getById = queryAllByAttribute.bind(null, 'id'); + expect(getById(container, /Pie.*?second/i)[0]).toHaveAttribute('opacity', '0.1'); + const firstLegend = screen.queryByText('first')?.closest('button'); + expect(firstLegend).toHaveAttribute('aria-selected', 'true'); + expect(firstLegend).toHaveAttribute('tabIndex', '0'); +}); + +test('Should deselect legend on double mouse click on legends', () => { + // Arrange + const { container } = render(); + + // Act + const legend = screen.queryByText('first'); + expect(legend).toBeDefined(); + + //single click on first legend + fireEvent.click(legend!); + const getById = queryAllByAttribute.bind(null, 'id'); + expect(getById(container, /Pie.*?second/i)[0]).toHaveAttribute('opacity', '0.1'); + const firstLegend = screen.queryByText('first')?.closest('button'); + expect(firstLegend).toHaveAttribute('aria-selected', 'true'); + expect(firstLegend).toHaveAttribute('tabIndex', '0'); + // double click on same first legend + fireEvent.click(legend!); + + // Assert + expect(firstLegend).toHaveAttribute('aria-selected', 'false'); +}); + +test('Should show Pies with same opacity on mouse out of legends', () => { + // Arrange + const { container } = render(); + + // Act + const legend = screen.queryByText('first'); + expect(legend).toBeDefined(); + fireEvent.mouseOver(legend!); + const getById = queryAllByAttribute.bind(null, 'id'); + expect(getById(container, /Pie.*?second/i)[0]).toHaveAttribute('opacity', '0.1'); + fireEvent.mouseOut(legend!); + + // Assert + expect(getById(container, /Pie.*?first/i)[0]).toHaveAttribute('opacity', '1'); + expect(getById(container, /Pie.*?second/i)[0]).toHaveAttribute('opacity', '1'); +}); + +test('Should display correct callout data on mouse move', () => { + // Arrange + const { container } = render(); + + // Act + const getById = queryAllByAttribute.bind(null, 'id'); + fireEvent.mouseOver(getById(container, /Pie/i)[0]); + expect(getById(container, /callout/i)[0]).toHaveTextContent('20,000'); + fireEvent.mouseLeave(getById(container, /Pie/i)[0]); + fireEvent.mouseOver(getById(container, /Pie/i)[1]); + + // Assert + expect(getById(container, /callout/i)[0]).toHaveTextContent('39,000'); +}); + +test('Should reflect theme change', () => { + // Arrange + const { container } = render( + + + , + ); + + // Assert + expect(container).toMatchSnapshot(); +}); + +describe('Screen resolution', () => { + const originalInnerWidth = global.innerWidth; + const originalInnerHeight = global.innerHeight; + afterEach(() => { + global.innerWidth = originalInnerWidth; + global.innerHeight = originalInnerHeight; + act(() => { + global.dispatchEvent(new Event('resize')); + }); + }); + + test('Should remain unchanged on zoom in', () => { + // Arrange + const { container } = render(); + + // Act + global.innerWidth = window.innerWidth / 2; + global.innerHeight = window.innerHeight / 2; + act(() => { + global.dispatchEvent(new Event('resize')); + }); + + // Assert + expect(container).toMatchSnapshot(); + }); + + test('Should remain unchanged on zoom out', () => { + // Arrange + const { container } = render(); + + // Act + global.innerWidth = window.innerWidth * 2; + global.innerHeight = window.innerHeight * 2; + act(() => { + global.dispatchEvent(new Event('resize')); + }); + + // Assert + expect(container).toMatchSnapshot(); + }); +}); + +test('Should change value inside donut with the legend value on mouseOver legend ', () => { + // Mock the implementation of wrapTextInsideDonut as it internally calls a Browser Function like + // getComputedTextLength() which will otherwise lead to a crash if mounted + jest.spyOn(utils, 'wrapTextInsideDonut').mockImplementation(() => '1000'); + // Arrange + const { container } = render( + , + ); + const getByClass = queryAllByAttribute.bind(null, 'class'); + + // Act + fireEvent.mouseOver(screen.getByText('first')); + + // Assert + expect(getByClass(container, /insideDonutString.*?/)[0].textContent).toBe('20,000'); +}); diff --git a/packages/react-charting/src/components/DonutChart/__snapshots__/DonutChart.test.tsx.snap b/packages/react-charting/src/components/DonutChart/__snapshots__/DonutChart.test.tsx.snap index 704e8d6b879c6..1e4d32b9c68c0 100644 --- a/packages/react-charting/src/components/DonutChart/__snapshots__/DonutChart.test.tsx.snap +++ b/packages/react-charting/src/components/DonutChart/__snapshots__/DonutChart.test.tsx.snap @@ -60,7 +60,7 @@ exports[`DonutChart - mouse events Should render callout correctly on mouseover &::-moz-focus-inner { border: 0; } - d="M0.5852252416681621,-54.99688637928982A55,55,0,0,1,46.747508639798205,28.977067414974766L-16.565176770869186,-11.206913872688409Z" + d="M0.5852252416681621,-54.99688637928982A55,55,0,0,1,51.38327129377018,-19.61528565050261L-18.954518060764226,6.381711767556007Z" data-is-focusable={true} id="_Pie_1first20000" onBlur={[Function]} @@ -86,7 +86,7 @@ exports[`DonutChart - mouse events Should render callout correctly on mouseover &::-moz-focus-inner { border: 0; } - d="M46.12029951098431,29.965279458351464A55,55,0,1,1,-0.5852252416682054,-54.99688637928982L-0.5852252416681382,19.99143595183984Z" + d="M51.78904378270381,-18.51742271681424A55,55,0,0,1,-22.33777910309799,50.259562520392066L8.845500303099026,-17.937589703967337Z" data-is-focusable={true} id="_Pie_1second39000" onBlur={[Function]} @@ -98,6 +98,32 @@ exports[`DonutChart - mouse events Should render callout correctly on mouseover role="img" /> + + + @@ -341,7 +367,7 @@ exports[`DonutChart - mouse events Should render callout correctly on mouseover aria-label="first" aria-posinset={1} aria-selected={false} - aria-setsize={2} + aria-setsize={3} className= { @@ -432,7 +458,7 @@ exports[`DonutChart - mouse events Should render callout correctly on mouseover aria-label="second" aria-posinset={2} aria-selected={false} - aria-setsize={2} + aria-setsize={3} className= { @@ -509,6 +535,97 @@ exports[`DonutChart - mouse events Should render callout correctly on mouseover +
+ +
@@ -579,7 +696,7 @@ exports[`DonutChart - mouse events Should render customized callout on mouseover &::-moz-focus-inner { border: 0; } - d="M0.5852252416681621,-54.99688637928982A55,55,0,0,1,46.747508639798205,28.977067414974766L-16.565176770869186,-11.206913872688409Z" + d="M0.5852252416681621,-54.99688637928982A55,55,0,0,1,51.38327129377018,-19.61528565050261L-18.954518060764226,6.381711767556007Z" data-is-focusable={true} id="_Pie_1first20000" onBlur={[Function]} @@ -605,7 +722,7 @@ exports[`DonutChart - mouse events Should render customized callout on mouseover &::-moz-focus-inner { border: 0; } - d="M46.12029951098431,29.965279458351464A55,55,0,1,1,-0.5852252416682054,-54.99688637928982L-0.5852252416681382,19.99143595183984Z" + d="M51.78904378270381,-18.51742271681424A55,55,0,0,1,-22.33777910309799,50.259562520392066L8.845500303099026,-17.937589703967337Z" data-is-focusable={true} id="_Pie_1second39000" onBlur={[Function]} @@ -617,6 +734,32 @@ exports[`DonutChart - mouse events Should render customized callout on mouseover role="img" /> + + + @@ -778,7 +921,7 @@ exports[`DonutChart - mouse events Should render customized callout on mouseover aria-label="first" aria-posinset={1} aria-selected={false} - aria-setsize={2} + aria-setsize={3} className= { @@ -869,7 +1012,7 @@ exports[`DonutChart - mouse events Should render customized callout on mouseover aria-label="second" aria-posinset={2} aria-selected={false} - aria-setsize={2} + aria-setsize={3} className= { @@ -946,6 +1089,97 @@ exports[`DonutChart - mouse events Should render customized callout on mouseover +
+ +
@@ -1016,7 +1250,7 @@ exports[`DonutChart snapShot testing Should render arc labels 1`] = ` &::-moz-focus-inner { border: 0; } - d="M0.5999900000500041,-59.99700002499991A60,60,0,0,1,50.977019571412924,31.644011686506882L0,0Z" + d="M0.5999900000500041,-59.99700002499991A60,60,0,0,1,56.06817542356052,-21.36257720109735L0,0Z" data-is-focusable={true} id="_Pie_20first20000" onBlur={[Function]} @@ -1038,8 +1272,8 @@ exports[`DonutChart snapShot testing Should render arc labels 1`] = ` } dominantBaseline="auto" textAnchor="start" - x={54.33177576763747} - y={-29.867342398264405} + x={35.43557344375781} + y={-50.87553571916512} > 20.0k @@ -1058,7 +1292,7 @@ exports[`DonutChart snapShot testing Should render arc labels 1`] = ` &::-moz-focus-inner { border: 0; } - d="M50.33398646478252,32.65715551855505A60,60,0,1,1,-0.5999900000500514,-59.99700002499991L0,0Z" + d="M56.484185223414,-20.237016075673292A60,60,0,0,1,-24.40360777596704,54.81299049966861L0,0Z" data-is-focusable={true} id="_Pie_20second39000" onBlur={[Function]} @@ -1079,13 +1313,55 @@ exports[`DonutChart snapShot testing Should render arc labels 1`] = ` font-weight: 600; } dominantBaseline="hanging" - textAnchor="end" - x={-54.33177576763744} - y={29.867342398264462} + textAnchor="start" + x={42.16983494620299} + y={45.45002772947447} > 39.0k + + + + 45.0k + + @@ -1169,7 +1445,7 @@ exports[`DonutChart snapShot testing Should render arc labels 1`] = ` aria-label="first" aria-posinset={1} aria-selected={false} - aria-setsize={2} + aria-setsize={3} className= { @@ -1259,7 +1535,7 @@ exports[`DonutChart snapShot testing Should render arc labels 1`] = ` aria-label="second" aria-posinset={2} aria-selected={false} - aria-setsize={2} + aria-setsize={3} className= { @@ -1336,15 +1612,105 @@ exports[`DonutChart snapShot testing Should render arc labels 1`] = ` - - - - - - - - -`; +
+ +
+ + + + + + + + +`; exports[`DonutChart snapShot testing Should render arc labels in percentage format 1`] = `
- 34% + 19% @@ -1448,7 +1814,7 @@ exports[`DonutChart snapShot testing Should render arc labels in percentage form &::-moz-focus-inner { border: 0; } - d="M50.33398646478252,32.65715551855505A60,60,0,1,1,-0.5999900000500514,-59.99700002499991L0,0Z" + d="M56.484185223414,-20.237016075673292A60,60,0,0,1,-24.40360777596704,54.81299049966861L0,0Z" data-is-focusable={true} id="_Pie_24second39000" onBlur={[Function]} @@ -1469,11 +1835,53 @@ exports[`DonutChart snapShot testing Should render arc labels in percentage form font-weight: 600; } dominantBaseline="hanging" + textAnchor="start" + x={42.16983494620299} + y={45.45002772947447} + > + 38% + + + + + - 66% + 43% @@ -1559,7 +1967,7 @@ exports[`DonutChart snapShot testing Should render arc labels in percentage form aria-label="first" aria-posinset={1} aria-selected={false} - aria-setsize={2} + aria-setsize={3} className= { @@ -1649,7 +2057,7 @@ exports[`DonutChart snapShot testing Should render arc labels in percentage form aria-label="second" aria-posinset={2} aria-selected={false} - aria-setsize={2} + aria-setsize={3} className= { @@ -1726,6 +2134,96 @@ exports[`DonutChart snapShot testing Should render arc labels in percentage form
+
+ +
@@ -1796,7 +2294,7 @@ exports[`DonutChart snapShot testing renders DonutChart correctly 1`] = ` &::-moz-focus-inner { border: 0; } - d="M1.141252199959434,-99.99348750501748A100,100,0,0,1,85.03612397688221,52.619935566174156L47.03809752649778,28.502936359043495A55,55,0,0,0,1.1412521999594298,-54.98815821080106Z" + d="M1.141252199959434,-99.99348750501748A100,100,0,0,1,93.39656512824911,-35.736278796829446L51.18232065229373,-20.133803730189335A55,55,0,0,0,1.1412521999594298,-54.98815821080106Z" data-is-focusable={true} id="_Pie_1first20000" onBlur={[Function]} @@ -1822,7 +2320,7 @@ exports[`DonutChart snapShot testing renders DonutChart correctly 1`] = ` &::-moz-focus-inner { border: 0; } - d="M83.81299867891468,54.54705539667788A100,100,0,1,1,-1.141252199959535,-99.99348750501748L-1.1412521999594853,-54.98815821080106A55,55,0,1,0,45.81497222853026,30.430056189547226Z" + d="M94.18786514866262,-33.595327930195076A100,100,0,0,1,-40.54357552149029,91.41235411000646L-21.828478096689523,50.482844055999315A55,55,0,0,0,51.97362067270725,-17.992852863554965Z" data-is-focusable={true} id="_Pie_1second39000" onBlur={[Function]} @@ -1834,6 +2332,32 @@ exports[`DonutChart snapShot testing renders DonutChart correctly 1`] = ` role="img" /> + + + @@ -1917,7 +2441,7 @@ exports[`DonutChart snapShot testing renders DonutChart correctly 1`] = ` aria-label="first" aria-posinset={1} aria-selected={false} - aria-setsize={2} + aria-setsize={3} className= { @@ -2007,7 +2531,7 @@ exports[`DonutChart snapShot testing renders DonutChart correctly 1`] = ` aria-label="second" aria-posinset={2} aria-selected={false} - aria-setsize={2} + aria-setsize={3} className= { @@ -2084,6 +2608,96 @@ exports[`DonutChart snapShot testing renders DonutChart correctly 1`] = ` +
+ +
@@ -2154,7 +2768,7 @@ exports[`DonutChart snapShot testing renders enabledLegendsWrapLines correctly 1 &::-moz-focus-inner { border: 0; } - d="M0.9999833334166736,-99.99500004166653A100,100,0,0,1,84.96169928568821,52.74001947751147L0,0Z" + d="M0.9999833334166736,-99.99500004166653A100,100,0,0,1,93.44695903926753,-35.60429533516224L0,0Z" data-is-focusable={true} id="_Pie_12first20000" onBlur={[Function]} @@ -2180,7 +2794,7 @@ exports[`DonutChart snapShot testing renders enabledLegendsWrapLines correctly 1 &::-moz-focus-inner { border: 0; } - d="M83.8899774413042,54.42859253092508A100,100,0,1,1,-0.9999833334167523,-99.99500004166653L0,0Z" + d="M94.14030870569,-33.728360126122155A100,100,0,0,1,-40.67267962661173,91.35498416611435L0,0Z" data-is-focusable={true} id="_Pie_12second39000" onBlur={[Function]} @@ -2192,6 +2806,32 @@ exports[`DonutChart snapShot testing renders enabledLegendsWrapLines correctly 1 role="img" /> + + + @@ -2272,10 +2912,100 @@ exports[`DonutChart snapShot testing renders enabledLegendsWrapLines correctly 1 role="none" > + +
+
@@ -2362,10 +3092,10 @@ exports[`DonutChart snapShot testing renders enabledLegendsWrapLines correctly 1 role="none" > @@ -2512,7 +3242,7 @@ exports[`DonutChart snapShot testing renders hideLegend correctly 1`] = ` &::-moz-focus-inner { border: 0; } - d="M0.9999833334166736,-99.99500004166653A100,100,0,0,1,84.96169928568821,52.74001947751147L0,0Z" + d="M0.9999833334166736,-99.99500004166653A100,100,0,0,1,93.44695903926753,-35.60429533516224L0,0Z" data-is-focusable={true} id="_Pie_5first20000" onBlur={[Function]} @@ -2538,7 +3268,7 @@ exports[`DonutChart snapShot testing renders hideLegend correctly 1`] = ` &::-moz-focus-inner { border: 0; } - d="M83.8899774413042,54.42859253092508A100,100,0,1,1,-0.9999833334167523,-99.99500004166653L0,0Z" + d="M94.14030870569,-33.728360126122155A100,100,0,0,1,-40.67267962661173,91.35498416611435L0,0Z" data-is-focusable={true} id="_Pie_5second39000" onBlur={[Function]} @@ -2550,6 +3280,32 @@ exports[`DonutChart snapShot testing renders hideLegend correctly 1`] = ` role="img" /> + + + @@ -2620,7 +3376,7 @@ exports[`DonutChart snapShot testing renders hideTooltip correctly 1`] = ` &::-moz-focus-inner { border: 0; } - d="M0.9999833334166736,-99.99500004166653A100,100,0,0,1,84.96169928568821,52.74001947751147L0,0Z" + d="M0.9999833334166736,-99.99500004166653A100,100,0,0,1,93.44695903926753,-35.60429533516224L0,0Z" data-is-focusable={true} id="_Pie_8first20000" onBlur={[Function]} @@ -2646,7 +3402,7 @@ exports[`DonutChart snapShot testing renders hideTooltip correctly 1`] = ` &::-moz-focus-inner { border: 0; } - d="M83.8899774413042,54.42859253092508A100,100,0,1,1,-0.9999833334167523,-99.99500004166653L0,0Z" + d="M94.14030870569,-33.728360126122155A100,100,0,0,1,-40.67267962661173,91.35498416611435L0,0Z" data-is-focusable={true} id="_Pie_8second39000" onBlur={[Function]} @@ -2658,6 +3414,32 @@ exports[`DonutChart snapShot testing renders hideTooltip correctly 1`] = ` role="img" /> + + + @@ -2741,7 +3523,7 @@ exports[`DonutChart snapShot testing renders hideTooltip correctly 1`] = ` aria-label="first" aria-posinset={1} aria-selected={false} - aria-setsize={2} + aria-setsize={3} className= { @@ -2831,7 +3613,7 @@ exports[`DonutChart snapShot testing renders hideTooltip correctly 1`] = ` aria-label="second" aria-posinset={2} aria-selected={false} - aria-setsize={2} + aria-setsize={3} className= { @@ -2908,6 +3690,96 @@ exports[`DonutChart snapShot testing renders hideTooltip correctly 1`] = ` +
+ +
@@ -2978,7 +3850,7 @@ exports[`DonutChart snapShot testing renders value inside onf the pie 1`] = ` &::-moz-focus-inner { border: 0; } - d="M0.9999833334166736,-99.99500004166653A100,100,0,0,1,84.96169928568821,52.74001947751147L0,0Z" + d="M0.9999833334166736,-99.99500004166653A100,100,0,0,1,93.44695903926753,-35.60429533516224L0,0Z" data-is-focusable={true} id="_Pie_16first20000" onBlur={[Function]} @@ -3004,7 +3876,7 @@ exports[`DonutChart snapShot testing renders value inside onf the pie 1`] = ` &::-moz-focus-inner { border: 0; } - d="M83.8899774413042,54.42859253092508A100,100,0,1,1,-0.9999833334167523,-99.99500004166653L0,0Z" + d="M94.14030870569,-33.728360126122155A100,100,0,0,1,-40.67267962661173,91.35498416611435L0,0Z" data-is-focusable={true} id="_Pie_16second39000" onBlur={[Function]} @@ -3016,6 +3888,32 @@ exports[`DonutChart snapShot testing renders value inside onf the pie 1`] = ` role="img" /> + + + +
+ +
diff --git a/packages/react-charting/src/components/DonutChart/__snapshots__/DonutChartRTL.test.tsx.snap b/packages/react-charting/src/components/DonutChart/__snapshots__/DonutChartRTL.test.tsx.snap new file mode 100644 index 0000000000000..12a197ade6576 --- /dev/null +++ b/packages/react-charting/src/components/DonutChart/__snapshots__/DonutChartRTL.test.tsx.snap @@ -0,0 +1,6194 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`DonutChart - mouse events Should render callout correctly on mouseover 1`] = ` +
+
+
+ + + + + + + + + + + + + +
+
+
+ +
+
+
+
+
+
+
+
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+
+
+
+`; + +exports[`DonutChart - mouse events Should render customized callout on mouseover 1`] = ` +
+
+
+ + + + + + + + + + + + + +
+
+
+ +
+
+
+
+
+
+
+
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+
+
+
+`; + +exports[`DonutChart snapShot testing Should render arc labels 1`] = ` +
+
+
+ + + + + + 20.0k + + + + + + 39.0k + + + + + + 45.0k + + + + +
+
+ +
+
+
+
+
+
+
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+
+
+
+`; + +exports[`DonutChart snapShot testing Should render arc labels in percentage format 1`] = ` +
+
+
+ + + + + + 19% + + + + + + 38% + + + + + + 43% + + + + +
+
+ +
+
+
+
+
+
+
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+
+
+
+`; + +exports[`DonutChart snapShot testing renders DonutChart correctly 1`] = ` +
+
+
+ + + + + + + + + + + + + +
+
+ +
+
+
+
+
+
+
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+
+
+
+`; + +exports[`DonutChart snapShot testing renders enabledLegendsWrapLines correctly 1`] = ` +
+
+
+ + + + + + + + + + + + + +
+
+ +
+
+
+
+
+
+
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+
+
+
+`; + +exports[`DonutChart snapShot testing renders hideLegend correctly 1`] = ` +
+
+
+ + + + + + + + + + + + + +
+
+ +
+`; + +exports[`DonutChart snapShot testing renders hideTooltip correctly 1`] = ` +
+
+
+ + + + + + + + + + + + + +
+
+ +
+
+
+
+
+
+
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+
+
+
+`; + +exports[`DonutChart snapShot testing renders value inside onf the pie 1`] = ` +
+
+
+ + + + + + + + + + + + + 1,000 + + + +
+
+ +
+
+
+
+
+
+
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+
+
+
+`; + +exports[`Screen resolution Should remain unchanged on zoom in 1`] = ` +
+
+
+
+ + + + + + + + + + + + + +
+
+ +
+
+
+
+
+
+
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+
+
+
+
+`; + +exports[`Screen resolution Should remain unchanged on zoom out 1`] = ` +
+
+
+
+ + + + + + + + + + + + + +
+
+ +
+
+
+
+
+
+
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+
+
+
+
+`; + +exports[`Should hide callout on mouse leave 1`] = ` +
+
+
+
+ + + + + + + + + + + + + +
+
+ +
+
+
+
+
+
+
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+
+
+
+
+`; + +exports[`Should reflect theme change 1`] = ` +
+
+
+
+
+ + + + + + + + + + + + + +
+
+ +
+
+
+
+
+
+
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+
+
+
+
+
+`; diff --git a/packages/react-charting/tsconfig.json b/packages/react-charting/tsconfig.json index d9e220a59c215..0c2581357d8c0 100644 --- a/packages/react-charting/tsconfig.json +++ b/packages/react-charting/tsconfig.json @@ -19,7 +19,7 @@ "skipLibCheck": true, "lib": ["es5", "dom"], "typeRoots": ["../../node_modules/@types", "../../typings"], - "types": ["jest", "custom-global"], + "types": ["jest", "custom-global", "@testing-library/jest-dom"], "isolatedModules": true }, "include": ["src"]