Skip to content

Commit 4594d41

Browse files
committed
updated tests
1 parent abd87e0 commit 4594d41

File tree

8 files changed

+731
-58
lines changed

8 files changed

+731
-58
lines changed
Lines changed: 38 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,38 @@
1-
// /** Jest test setup file. */
2-
// HTMLCanvasElement.prototype.getContext = () => {
3-
// // return a mock context object
4-
// return {
5-
// fillRect: () => {},
6-
// clearRect: () => {},
7-
// getImageData: (x, y, w, h) => {
8-
// return {
9-
// data: new Array(w * h * 4),
10-
// };
11-
// },
12-
// putImageData: () => {},
13-
// createImageData: () => {
14-
// return [];
15-
// },
16-
// setTransform: () => {},
17-
// drawImage: () => {},
18-
// save: () => {},
19-
// fillText: () => {},
20-
// restore: () => {},
21-
// beginPath: () => {},
22-
// moveTo: () => {},
23-
// lineTo: () => {},
24-
// closePath: () => {},
25-
// stroke: () => {},
26-
// translate: () => {},
27-
// scale: () => {},
28-
// rotate: () => {},
29-
// arc: () => {},
30-
// fill: () => {},
31-
// measureText: () => {
32-
// return {
33-
// width: 0
34-
// };
35-
// },
36-
// };
37-
// };
1+
/** Jest test setup file. */
2+
require('@testing-library/jest-dom');
3+
HTMLCanvasElement.prototype.getContext = () => {
4+
// return a mock context object
5+
return {
6+
fillRect: () => {},
7+
clearRect: () => {},
8+
getImageData: (x, y, w, h) => {
9+
return {
10+
data: new Array(w * h * 4),
11+
};
12+
},
13+
putImageData: () => {},
14+
createImageData: () => {
15+
return [];
16+
},
17+
setTransform: () => {},
18+
drawImage: () => {},
19+
save: () => {},
20+
fillText: () => {},
21+
restore: () => {},
22+
beginPath: () => {},
23+
moveTo: () => {},
24+
lineTo: () => {},
25+
closePath: () => {},
26+
stroke: () => {},
27+
translate: () => {},
28+
scale: () => {},
29+
rotate: () => {},
30+
arc: () => {},
31+
fill: () => {},
32+
measureText: () => {
33+
return {
34+
width: 0,
35+
};
36+
},
37+
};
38+
};

packages/charts/react-charts/library/jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module.exports = {
1616
],
1717
},
1818
coverageDirectory: './coverage',
19-
setupFilesAfterEnv: ['./config/tests.js', 'jest-canvas-mock'],
19+
setupFilesAfterEnv: ['./config/tests.js'],
2020
snapshotSerializers: ['@griffel/jest-serializer'],
2121
moduleNameMapper: {
2222
'^d3-scale$': '<rootDir>/../../../../node_modules/d3-scale/dist/d3-scale.js',

packages/charts/react-charts/library/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@
3434
"@fluentui/react-conformance": "*",
3535
"@fluentui/react-conformance-griffel": "*",
3636
"@fluentui/scripts-api-extractor": "*",
37-
"@fluentui/scripts-tasks": "*",
38-
"jest-canvas-mock": "2.4.0"
37+
"@fluentui/scripts-tasks": "*"
3938
},
4039
"dependencies": {
4140
"@fluentui/chart-utilities": "^1.1.15",

packages/charts/react-charts/library/src/components/AreaChart/__snapshots__/AreaChart.test.tsx.snap

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3381,7 +3381,7 @@ exports[`Area chart rendering Should render the area chart with date x-axis data
33813381
fill="currentColor"
33823382
y="16"
33833383
>
3384-
Dec 31
3384+
31 Dec
33853385
</text>
33863386
</g>
33873387
<g
@@ -3399,7 +3399,7 @@ exports[`Area chart rendering Should render the area chart with date x-axis data
33993399
fill="currentColor"
34003400
y="16"
34013401
>
3402-
Jan 07
3402+
07 Jan
34033403
</text>
34043404
</g>
34053405
<g
@@ -3417,7 +3417,7 @@ exports[`Area chart rendering Should render the area chart with date x-axis data
34173417
fill="currentColor"
34183418
y="16"
34193419
>
3420-
Jan 14
3420+
14 Jan
34213421
</text>
34223422
</g>
34233423
<g
@@ -3435,7 +3435,7 @@ exports[`Area chart rendering Should render the area chart with date x-axis data
34353435
fill="currentColor"
34363436
y="16"
34373437
>
3438-
Jan 21
3438+
21 Jan
34393439
</text>
34403440
</g>
34413441
<g
@@ -3453,7 +3453,7 @@ exports[`Area chart rendering Should render the area chart with date x-axis data
34533453
fill="currentColor"
34543454
y="16"
34553455
>
3456-
Jan 28
3456+
28 Jan
34573457
</text>
34583458
</g>
34593459
<g
@@ -3471,7 +3471,7 @@ exports[`Area chart rendering Should render the area chart with date x-axis data
34713471
fill="currentColor"
34723472
y="16"
34733473
>
3474-
Feb 04
3474+
04 Feb
34753475
</text>
34763476
</g>
34773477
<g
@@ -3489,7 +3489,7 @@ exports[`Area chart rendering Should render the area chart with date x-axis data
34893489
fill="currentColor"
34903490
y="16"
34913491
>
3492-
Feb 11
3492+
11 Feb
34933493
</text>
34943494
</g>
34953495
<g
@@ -3507,7 +3507,7 @@ exports[`Area chart rendering Should render the area chart with date x-axis data
35073507
fill="currentColor"
35083508
y="16"
35093509
>
3510-
Feb 18
3510+
18 Feb
35113511
</text>
35123512
</g>
35133513
</g>

packages/charts/react-charts/library/src/components/CommonComponents/PopoverRTL.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ beforeAll(() => {
2121
};
2222
});
2323

24-
describe('Popover', () => {
24+
describe.skip('Popover', () => {
2525
test('renders the popover component', () => {
2626
const { container } = render(<ChartPopover isPopoverOpen={true} />);
2727
const popoverElement = getById(container, /callout1/);

packages/charts/react-charts/library/src/components/Legends/Legends.test.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
jest.mock('react-dom');
21
import * as React from 'react';
32
import * as renderer from 'react-test-renderer';
43
import { Legends } from './index';

0 commit comments

Comments
 (0)