@coveord/plasma-mantine 49.2.2 → 49.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +9 -4
- package/.turbo/turbo-build.log +3 -3
- package/.turbo/turbo-test.log +35 -31
- package/{src/components/code-editor/__mocks__ → __mocks__}/@monaco-editor/react.tsx +6 -8
- package/{src/components/code-editor/__mocks__ → __mocks__}/monaco-editor.ts +0 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/cjs/__tests__/Utils.js.map +1 -1
- package/dist/cjs/__tests__/VitestSetup.js +35 -0
- package/dist/cjs/__tests__/VitestSetup.js.map +1 -0
- package/dist/definitions/__tests__/Utils.d.ts +1 -1
- package/dist/definitions/__tests__/Utils.d.ts.map +1 -1
- package/dist/definitions/__tests__/VitestSetup.d.ts +2 -0
- package/dist/definitions/__tests__/VitestSetup.d.ts.map +1 -0
- package/dist/esm/__tests__/Utils.js +1 -1
- package/dist/esm/__tests__/Utils.js.map +1 -1
- package/dist/esm/__tests__/VitestSetup.js +30 -0
- package/dist/esm/__tests__/VitestSetup.js.map +1 -0
- package/package.json +7 -6
- package/src/__tests__/Utils.tsx +1 -1
- package/src/__tests__/VitestSetup.ts +27 -0
- package/src/components/code-editor/__tests__/CodeEditor.spec.tsx +7 -5
- package/src/components/collection/__tests__/Collection.spec.tsx +2 -2
- package/src/components/date-range-picker/__tests__/DateRangePickerInlineCalendar.spec.tsx +17 -17
- package/src/components/date-range-picker/__tests__/DateRangePickerPopoverCalendar.spec.tsx +11 -7
- package/src/components/date-range-picker/__tests__/DateRangePickerPresetSelect.spec.tsx +1 -1
- package/src/components/inline-confirm/__tests__/InlineConfirm.spec.tsx +6 -6
- package/src/components/modal/__tests__/Modal.spec.tsx +3 -3
- package/src/components/modal-wizard/__tests__/ModalWizard.spec.tsx +8 -8
- package/src/components/prompt/__tests__/Prompt.spec.tsx +2 -2
- package/src/components/table/__tests__/Table.spec.tsx +1 -1
- package/src/components/table/__tests__/TableActions.spec.tsx +1 -1
- package/src/components/table/__tests__/TableDateRangePicker.spec.tsx +11 -8
- package/src/components/table/__tests__/TableFilter.spec.tsx +4 -4
- package/src/components/table/__tests__/TablePagination.spec.tsx +2 -2
- package/src/components/table/__tests__/TablePerPage.spec.tsx +3 -3
- package/src/components/table/__tests__/TablePredicate.spec.tsx +2 -2
- package/src/components/table/__tests__/Th.spec.tsx +1 -1
- package/src/hooks/__tests__/useControlledList.spec.tsx +1 -1
- package/tsconfig.build.json +2 -1
- package/tsconfig.json +3 -2
- package/vitest.config.ts +24 -0
- package/dist/cjs/__tests__/GlobalSetup.js +0 -17
- package/dist/cjs/__tests__/GlobalSetup.js.map +0 -1
- package/dist/cjs/__tests__/Setup.js +0 -6
- package/dist/cjs/__tests__/Setup.js.map +0 -1
- package/dist/cjs/__tests__/SetupAfterEnv.js +0 -19
- package/dist/cjs/__tests__/SetupAfterEnv.js.map +0 -1
- package/dist/cjs/components/code-editor/__mocks__/@monaco-editor/react.js +0 -45
- package/dist/cjs/components/code-editor/__mocks__/@monaco-editor/react.js.map +0 -1
- package/dist/cjs/components/code-editor/__mocks__/monaco-editor.js +0 -24
- package/dist/cjs/components/code-editor/__mocks__/monaco-editor.js.map +0 -1
- package/dist/definitions/__tests__/GlobalSetup.d.ts +0 -3
- package/dist/definitions/__tests__/GlobalSetup.d.ts.map +0 -1
- package/dist/definitions/__tests__/Setup.d.ts +0 -5
- package/dist/definitions/__tests__/Setup.d.ts.map +0 -1
- package/dist/definitions/__tests__/SetupAfterEnv.d.ts +0 -7
- package/dist/definitions/__tests__/SetupAfterEnv.d.ts.map +0 -1
- package/dist/definitions/components/code-editor/__mocks__/@monaco-editor/react.d.ts +0 -10
- package/dist/definitions/components/code-editor/__mocks__/@monaco-editor/react.d.ts.map +0 -1
- package/dist/definitions/components/code-editor/__mocks__/monaco-editor.d.ts +0 -8
- package/dist/definitions/components/code-editor/__mocks__/monaco-editor.d.ts.map +0 -1
- package/dist/esm/__tests__/GlobalSetup.js +0 -7
- package/dist/esm/__tests__/GlobalSetup.js.map +0 -1
- package/dist/esm/__tests__/Setup.js +0 -5
- package/dist/esm/__tests__/Setup.js.map +0 -1
- package/dist/esm/__tests__/SetupAfterEnv.js +0 -15
- package/dist/esm/__tests__/SetupAfterEnv.js.map +0 -1
- package/dist/esm/components/code-editor/__mocks__/@monaco-editor/react.js +0 -24
- package/dist/esm/components/code-editor/__mocks__/@monaco-editor/react.js.map +0 -1
- package/dist/esm/components/code-editor/__mocks__/monaco-editor.js +0 -14
- package/dist/esm/components/code-editor/__mocks__/monaco-editor.js.map +0 -1
- package/jest.config.js +0 -26
- package/src/__tests__/GlobalSetup.ts +0 -5
- package/src/__tests__/Setup.ts +0 -4
- package/src/__tests__/SetupAfterEnv.ts +0 -16
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/__tests__/Utils.tsx"],"sourcesContent":["import {render, RenderOptions, RenderResult} from '@testing-library/react';\nimport userEvent from '@testing-library/user-event';\nimport {FunctionComponent, PropsWithChildren, ReactElement} from 'react';\n\nimport {Plasmantine} from '../theme';\n\nconst customRender = (ui: ReactElement, options?: Omit<RenderOptions, 'queries'>): RenderResult => {\n const TestWrapper: FunctionComponent<PropsWithChildren> = ({children}) => <Plasmantine>{children}</Plasmantine>;\n\n return render(ui, {wrapper: TestWrapper, ...options});\n};\n\nexport
|
|
1
|
+
{"version":3,"sources":["../../../src/__tests__/Utils.tsx"],"sourcesContent":["import {render, RenderOptions, RenderResult} from '@testing-library/react';\nimport userEvent from '@testing-library/user-event';\nimport {FunctionComponent, PropsWithChildren, ReactElement} from 'react';\n\nimport {Plasmantine} from '../theme';\n\nconst customRender = (ui: ReactElement, options?: Omit<RenderOptions, 'queries'>): RenderResult => {\n const TestWrapper: FunctionComponent<PropsWithChildren> = ({children}) => <Plasmantine>{children}</Plasmantine>;\n\n return render(ui, {wrapper: TestWrapper, ...options});\n};\n\nexport * from '@testing-library/react';\nexport {userEvent};\nexport {customRender as render};\n"],"names":["userEvent","render","customRender","ui","options","TestWrapper","children","Plasmantine","wrapper"],"mappings":";;;;;;;;;;;IAaQA,SAAS;eAATA,kBAAS;;IACOC,MAAM;eAAtBC;;;;;;;iCAd0C;8DAC5B;qBAGI;AAE1B,IAAMA,eAAe,SAACC,IAAkBC,SAA2D;IAC/F,IAAMC,cAAoD;YAAEC,iBAAAA;6BAAc,qBAACC,kBAAW;sBAAED;;;IAExF,OAAOL,IAAAA,aAAM,EAACE,IAAI;QAACK,SAASH;OAAgBD;AAChD"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
var _interopRequireDefault = require("@swc/helpers/lib/_interop_require_default.js").default;
|
|
6
|
+
var _matchers = /*#__PURE__*/ _interopRequireDefault(require("@testing-library/jest-dom/matchers"));
|
|
7
|
+
var _react = require("@testing-library/react");
|
|
8
|
+
expect.extend(_matchers.default);
|
|
9
|
+
Object.defineProperty(window, "matchMedia", {
|
|
10
|
+
writable: true,
|
|
11
|
+
value: vi.fn().mockImplementation(function(query) {
|
|
12
|
+
return {
|
|
13
|
+
matches: false,
|
|
14
|
+
media: query,
|
|
15
|
+
onchange: null,
|
|
16
|
+
addListener: vi.fn(),
|
|
17
|
+
removeListener: vi.fn(),
|
|
18
|
+
addEventListener: vi.fn(),
|
|
19
|
+
removeEventListener: vi.fn(),
|
|
20
|
+
dispatchEvent: vi.fn()
|
|
21
|
+
};
|
|
22
|
+
})
|
|
23
|
+
});
|
|
24
|
+
window.ResizeObserver = window.ResizeObserver || vi.fn().mockImplementation(function() {
|
|
25
|
+
return {
|
|
26
|
+
disconnect: vi.fn(),
|
|
27
|
+
observe: vi.fn(),
|
|
28
|
+
unobserve: vi.fn()
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
afterEach(function() {
|
|
32
|
+
(0, _react.cleanup)();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=VitestSetup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/__tests__/VitestSetup.ts"],"sourcesContent":["import matchers from '@testing-library/jest-dom/matchers';\nimport {cleanup} from '@testing-library/react';\nexpect.extend(matchers);\nObject.defineProperty(window, 'matchMedia', {\n writable: true,\n value: vi.fn().mockImplementation((query) => ({\n matches: false,\n media: query,\n onchange: null,\n addListener: vi.fn(), // deprecated\n removeListener: vi.fn(), // deprecated\n addEventListener: vi.fn(),\n removeEventListener: vi.fn(),\n dispatchEvent: vi.fn(),\n })),\n});\nwindow.ResizeObserver =\n window.ResizeObserver ||\n vi.fn().mockImplementation(() => ({\n disconnect: vi.fn(),\n observe: vi.fn(),\n unobserve: vi.fn(),\n }));\n\nafterEach(() => {\n cleanup();\n});\n"],"names":["expect","extend","matchers","Object","defineProperty","window","writable","value","vi","fn","mockImplementation","query","matches","media","onchange","addListener","removeListener","addEventListener","removeEventListener","dispatchEvent","ResizeObserver","disconnect","observe","unobserve","afterEach","cleanup"],"mappings":";;;;;6DAAqB;qBACC;AACtBA,OAAOC,MAAM,CAACC,iBAAQ;AACtBC,OAAOC,cAAc,CAACC,QAAQ,cAAc;IACxCC,UAAU,IAAI;IACdC,OAAOC,GAAGC,EAAE,GAAGC,kBAAkB,CAAC,SAACC;eAAW;YAC1CC,SAAS,KAAK;YACdC,OAAOF;YACPG,UAAU,IAAI;YACdC,aAAaP,GAAGC,EAAE;YAClBO,gBAAgBR,GAAGC,EAAE;YACrBQ,kBAAkBT,GAAGC,EAAE;YACvBS,qBAAqBV,GAAGC,EAAE;YAC1BU,eAAeX,GAAGC,EAAE;QACxB;;AACJ;AACAJ,OAAOe,cAAc,GACjBf,OAAOe,cAAc,IACrBZ,GAAGC,EAAE,GAAGC,kBAAkB,CAAC;WAAO;QAC9BW,YAAYb,GAAGC,EAAE;QACjBa,SAASd,GAAGC,EAAE;QACdc,WAAWf,GAAGC,EAAE;IACpB;;AAEJe,UAAU,WAAM;IACZC,IAAAA,cAAO;AACX"}
|
|
@@ -2,7 +2,7 @@ import { RenderOptions, RenderResult } from '@testing-library/react';
|
|
|
2
2
|
import userEvent from '@testing-library/user-event';
|
|
3
3
|
import { ReactElement } from 'react';
|
|
4
4
|
declare const customRender: (ui: ReactElement, options?: Omit<RenderOptions, 'queries'>) => RenderResult;
|
|
5
|
-
export { userEvent };
|
|
6
5
|
export * from '@testing-library/react';
|
|
6
|
+
export { userEvent };
|
|
7
7
|
export { customRender as render };
|
|
8
8
|
//# sourceMappingURL=Utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Utils.d.ts","sourceRoot":"","sources":["../../../src/__tests__/Utils.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAS,aAAa,EAAE,YAAY,EAAC,MAAM,wBAAwB,CAAC;AAC3E,OAAO,SAAS,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAuC,YAAY,EAAC,MAAM,OAAO,CAAC;AAIzE,QAAA,MAAM,YAAY,OAAQ,YAAY,YAAY,KAAK,aAAa,EAAE,SAAS,CAAC,KAAG,YAIlF,CAAC;AAEF,OAAO,EAAC,SAAS,EAAC,CAAC;AACnB,
|
|
1
|
+
{"version":3,"file":"Utils.d.ts","sourceRoot":"","sources":["../../../src/__tests__/Utils.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAS,aAAa,EAAE,YAAY,EAAC,MAAM,wBAAwB,CAAC;AAC3E,OAAO,SAAS,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAuC,YAAY,EAAC,MAAM,OAAO,CAAC;AAIzE,QAAA,MAAM,YAAY,OAAQ,YAAY,YAAY,KAAK,aAAa,EAAE,SAAS,CAAC,KAAG,YAIlF,CAAC;AAEF,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAC,SAAS,EAAC,CAAC;AACnB,OAAO,EAAC,YAAY,IAAI,MAAM,EAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VitestSetup.d.ts","sourceRoot":"","sources":["../../../src/__tests__/VitestSetup.ts"],"names":[],"mappings":""}
|
|
@@ -14,8 +14,8 @@ var customRender = function(ui, options) {
|
|
|
14
14
|
wrapper: TestWrapper
|
|
15
15
|
}, options));
|
|
16
16
|
};
|
|
17
|
-
export { userEvent };
|
|
18
17
|
export * from "@testing-library/react";
|
|
18
|
+
export { userEvent };
|
|
19
19
|
export { customRender as render };
|
|
20
20
|
|
|
21
21
|
//# sourceMappingURL=Utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/__tests__/Utils.tsx"],"sourcesContent":["import {render, RenderOptions, RenderResult} from '@testing-library/react';\nimport userEvent from '@testing-library/user-event';\nimport {FunctionComponent, PropsWithChildren, ReactElement} from 'react';\n\nimport {Plasmantine} from '../theme';\n\nconst customRender = (ui: ReactElement, options?: Omit<RenderOptions, 'queries'>): RenderResult => {\n const TestWrapper: FunctionComponent<PropsWithChildren> = ({children}) => <Plasmantine>{children}</Plasmantine>;\n\n return render(ui, {wrapper: TestWrapper, ...options});\n};\n\nexport
|
|
1
|
+
{"version":3,"sources":["../../../src/__tests__/Utils.tsx"],"sourcesContent":["import {render, RenderOptions, RenderResult} from '@testing-library/react';\nimport userEvent from '@testing-library/user-event';\nimport {FunctionComponent, PropsWithChildren, ReactElement} from 'react';\n\nimport {Plasmantine} from '../theme';\n\nconst customRender = (ui: ReactElement, options?: Omit<RenderOptions, 'queries'>): RenderResult => {\n const TestWrapper: FunctionComponent<PropsWithChildren> = ({children}) => <Plasmantine>{children}</Plasmantine>;\n\n return render(ui, {wrapper: TestWrapper, ...options});\n};\n\nexport * from '@testing-library/react';\nexport {userEvent};\nexport {customRender as render};\n"],"names":["render","userEvent","Plasmantine","customRender","ui","options","TestWrapper","children","wrapper"],"mappings":";;AAAA,SAAQA,MAAM,QAAoC,yBAAyB;AAC3E,OAAOC,eAAe,8BAA8B;AAGpD,SAAQC,WAAW,QAAO,WAAW;AAErC,IAAMC,eAAe,SAACC,IAAkBC,SAA2D;IAC/F,IAAMC,cAAoD;YAAEC,iBAAAA;6BAAc,KAACL;sBAAaK;;;IAExF,OAAOP,OAAOI,IAAI;QAACI,SAASF;OAAgBD;AAChD;AAEA,cAAc,yBAAyB;AACvC,SAAQJ,SAAS,GAAE;AACnB,SAAQE,gBAAgBH,MAAM,GAAE"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import matchers from "@testing-library/jest-dom/matchers";
|
|
2
|
+
import { cleanup } from "@testing-library/react";
|
|
3
|
+
expect.extend(matchers);
|
|
4
|
+
Object.defineProperty(window, "matchMedia", {
|
|
5
|
+
writable: true,
|
|
6
|
+
value: vi.fn().mockImplementation(function(query) {
|
|
7
|
+
return {
|
|
8
|
+
matches: false,
|
|
9
|
+
media: query,
|
|
10
|
+
onchange: null,
|
|
11
|
+
addListener: vi.fn(),
|
|
12
|
+
removeListener: vi.fn(),
|
|
13
|
+
addEventListener: vi.fn(),
|
|
14
|
+
removeEventListener: vi.fn(),
|
|
15
|
+
dispatchEvent: vi.fn()
|
|
16
|
+
};
|
|
17
|
+
})
|
|
18
|
+
});
|
|
19
|
+
window.ResizeObserver = window.ResizeObserver || vi.fn().mockImplementation(function() {
|
|
20
|
+
return {
|
|
21
|
+
disconnect: vi.fn(),
|
|
22
|
+
observe: vi.fn(),
|
|
23
|
+
unobserve: vi.fn()
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
afterEach(function() {
|
|
27
|
+
cleanup();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=VitestSetup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/__tests__/VitestSetup.ts"],"sourcesContent":["import matchers from '@testing-library/jest-dom/matchers';\nimport {cleanup} from '@testing-library/react';\nexpect.extend(matchers);\nObject.defineProperty(window, 'matchMedia', {\n writable: true,\n value: vi.fn().mockImplementation((query) => ({\n matches: false,\n media: query,\n onchange: null,\n addListener: vi.fn(), // deprecated\n removeListener: vi.fn(), // deprecated\n addEventListener: vi.fn(),\n removeEventListener: vi.fn(),\n dispatchEvent: vi.fn(),\n })),\n});\nwindow.ResizeObserver =\n window.ResizeObserver ||\n vi.fn().mockImplementation(() => ({\n disconnect: vi.fn(),\n observe: vi.fn(),\n unobserve: vi.fn(),\n }));\n\nafterEach(() => {\n cleanup();\n});\n"],"names":["matchers","cleanup","expect","extend","Object","defineProperty","window","writable","value","vi","fn","mockImplementation","query","matches","media","onchange","addListener","removeListener","addEventListener","removeEventListener","dispatchEvent","ResizeObserver","disconnect","observe","unobserve","afterEach"],"mappings":"AAAA,OAAOA,cAAc,qCAAqC;AAC1D,SAAQC,OAAO,QAAO,yBAAyB;AAC/CC,OAAOC,MAAM,CAACH;AACdI,OAAOC,cAAc,CAACC,QAAQ,cAAc;IACxCC,UAAU,IAAI;IACdC,OAAOC,GAAGC,EAAE,GAAGC,kBAAkB,CAAC,SAACC;eAAW;YAC1CC,SAAS,KAAK;YACdC,OAAOF;YACPG,UAAU,IAAI;YACdC,aAAaP,GAAGC,EAAE;YAClBO,gBAAgBR,GAAGC,EAAE;YACrBQ,kBAAkBT,GAAGC,EAAE;YACvBS,qBAAqBV,GAAGC,EAAE;YAC1BU,eAAeX,GAAGC,EAAE;QACxB;;AACJ;AACAJ,OAAOe,cAAc,GACjBf,OAAOe,cAAc,IACrBZ,GAAGC,EAAE,GAAGC,kBAAkB,CAAC;WAAO;QAC9BW,YAAYb,GAAGC,EAAE;QACjBa,SAASd,GAAGC,EAAE;QACdc,WAAWf,GAAGC,EAAE;IACpB;;AAEJe,UAAU,WAAM;IACZxB;AACJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coveord/plasma-mantine",
|
|
3
|
-
"version": "49.2.
|
|
3
|
+
"version": "49.2.3",
|
|
4
4
|
"description": "A Plasma flavoured Mantine theme",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"plasma",
|
|
@@ -49,8 +49,9 @@
|
|
|
49
49
|
"@types/testing-library__jest-dom": "5.14.5",
|
|
50
50
|
"csstype": "3.1.1",
|
|
51
51
|
"embla-carousel-react": "7.0.4",
|
|
52
|
-
"eslint-plugin-jest": "27.1.1",
|
|
53
52
|
"eslint-plugin-testing-library": "5.7.2",
|
|
53
|
+
"eslint-plugin-vitest": "0.0.32",
|
|
54
|
+
"eslint-plugin-vitest-globals": "1.2.0",
|
|
54
55
|
"identity-obj-proxy": "3.0.0",
|
|
55
56
|
"jest": "29.2.1",
|
|
56
57
|
"jest-environment-jsdom": "29.1.2",
|
|
@@ -60,7 +61,8 @@
|
|
|
60
61
|
"react-dom": "18.2.0",
|
|
61
62
|
"rimraf": "3.0.2",
|
|
62
63
|
"tslib": "2.4.0",
|
|
63
|
-
"typescript": "4.9.3"
|
|
64
|
+
"typescript": "4.9.3",
|
|
65
|
+
"vitest": "0.28.3"
|
|
64
66
|
},
|
|
65
67
|
"peerDependencies": {
|
|
66
68
|
"@emotion/react": "^11.10.0",
|
|
@@ -78,8 +80,7 @@
|
|
|
78
80
|
"build": "node ../../scripts/build",
|
|
79
81
|
"clean": "rimraf dist",
|
|
80
82
|
"start": "node ../../scripts/start",
|
|
81
|
-
"test": "
|
|
82
|
-
"test:watch": "
|
|
83
|
-
"test:debug": "node --inspect-brk node_modules/jest/bin/jest --runInBand --watchAll --detectOpenHandles --forceExit"
|
|
83
|
+
"test": "TZ=UTC vitest run",
|
|
84
|
+
"test:watch": "TZ=UTC vitest"
|
|
84
85
|
}
|
|
85
86
|
}
|
package/src/__tests__/Utils.tsx
CHANGED
|
@@ -10,6 +10,6 @@ const customRender = (ui: ReactElement, options?: Omit<RenderOptions, 'queries'>
|
|
|
10
10
|
return render(ui, {wrapper: TestWrapper, ...options});
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
export {userEvent};
|
|
14
13
|
export * from '@testing-library/react';
|
|
14
|
+
export {userEvent};
|
|
15
15
|
export {customRender as render};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import matchers from '@testing-library/jest-dom/matchers';
|
|
2
|
+
import {cleanup} from '@testing-library/react';
|
|
3
|
+
expect.extend(matchers);
|
|
4
|
+
Object.defineProperty(window, 'matchMedia', {
|
|
5
|
+
writable: true,
|
|
6
|
+
value: vi.fn().mockImplementation((query) => ({
|
|
7
|
+
matches: false,
|
|
8
|
+
media: query,
|
|
9
|
+
onchange: null,
|
|
10
|
+
addListener: vi.fn(), // deprecated
|
|
11
|
+
removeListener: vi.fn(), // deprecated
|
|
12
|
+
addEventListener: vi.fn(),
|
|
13
|
+
removeEventListener: vi.fn(),
|
|
14
|
+
dispatchEvent: vi.fn(),
|
|
15
|
+
})),
|
|
16
|
+
});
|
|
17
|
+
window.ResizeObserver =
|
|
18
|
+
window.ResizeObserver ||
|
|
19
|
+
vi.fn().mockImplementation(() => ({
|
|
20
|
+
disconnect: vi.fn(),
|
|
21
|
+
observe: vi.fn(),
|
|
22
|
+
unobserve: vi.fn(),
|
|
23
|
+
}));
|
|
24
|
+
|
|
25
|
+
afterEach(() => {
|
|
26
|
+
cleanup();
|
|
27
|
+
});
|
|
@@ -1,24 +1,26 @@
|
|
|
1
|
-
import {useForm} from '@mantine/form';
|
|
2
1
|
import {loader} from '@monaco-editor/react';
|
|
3
2
|
import {render, screen, waitForElementToBeRemoved, within} from '@test-utils';
|
|
3
|
+
import {useForm} from '../../../form';
|
|
4
4
|
|
|
5
5
|
import {CodeEditor} from '../CodeEditor';
|
|
6
6
|
import {XML} from '../languages/xml';
|
|
7
7
|
|
|
8
|
+
vi.mock('monaco-editor');
|
|
9
|
+
vi.mock('@monaco-editor/react');
|
|
10
|
+
|
|
8
11
|
describe('CodeEditor', () => {
|
|
9
12
|
beforeEach(() => {
|
|
10
|
-
|
|
13
|
+
vi.clearAllMocks();
|
|
11
14
|
});
|
|
12
15
|
|
|
13
16
|
it('renders the monaco editor and a copy to clipboard button', async () => {
|
|
14
|
-
jest.mock('monaco-editor');
|
|
15
17
|
render(<CodeEditor label="label" description="description" />);
|
|
16
18
|
|
|
17
19
|
await waitForElementToBeRemoved(screen.queryByRole('presentation'));
|
|
18
20
|
|
|
19
21
|
expect(screen.getByText(/label/)).toBeInTheDocument();
|
|
20
22
|
expect(screen.getByText(/description/)).toBeInTheDocument();
|
|
21
|
-
expect(screen.
|
|
23
|
+
expect(await screen.findByTestId('monaco-editor')).toBeInTheDocument();
|
|
22
24
|
expect(await screen.findByRole('button', {name: /copy/i})).toBeInTheDocument();
|
|
23
25
|
});
|
|
24
26
|
|
|
@@ -56,7 +58,7 @@ describe('CodeEditor', () => {
|
|
|
56
58
|
});
|
|
57
59
|
|
|
58
60
|
it('loads the xml language in the monaco instance if the editor language is xml', async () => {
|
|
59
|
-
const xmlLanguageSpy =
|
|
61
|
+
const xmlLanguageSpy = vi.spyOn(XML, 'register').mockImplementation(vi.fn());
|
|
60
62
|
render(<CodeEditor label="label" description="description" monacoLoader="cdn" language="xml" />);
|
|
61
63
|
expect(xmlLanguageSpy).toHaveBeenCalledTimes(1);
|
|
62
64
|
});
|
|
@@ -54,7 +54,7 @@ describe('Collection', () => {
|
|
|
54
54
|
|
|
55
55
|
it('calls the onRemoveItem function when clicking on a remove button', async () => {
|
|
56
56
|
const user = userEvent.setup({delay: null});
|
|
57
|
-
const onRemoveItemSpy =
|
|
57
|
+
const onRemoveItemSpy = vi.fn();
|
|
58
58
|
const Fixture = () => {
|
|
59
59
|
const form = useForm({initialValues: {fruits: ['banana', 'orange']}});
|
|
60
60
|
return (
|
|
@@ -128,7 +128,7 @@ describe('Collection', () => {
|
|
|
128
128
|
});
|
|
129
129
|
|
|
130
130
|
it('disables the add button whenever allowAdd callback returns false', () => {
|
|
131
|
-
const allowAdd =
|
|
131
|
+
const allowAdd = vi.fn().mockImplementation(() => false);
|
|
132
132
|
const Fixture = () => {
|
|
133
133
|
const form = useForm({initialValues: {fruits: ['banana', 'orange']}});
|
|
134
134
|
return (
|
|
@@ -6,8 +6,8 @@ import {DateRangePickerInlineCalendar} from '../DateRangePickerInlineCalendar';
|
|
|
6
6
|
describe('DateRangePickerInlineCalendar', () => {
|
|
7
7
|
it('calls onApply when the user clicks on the apply button', async () => {
|
|
8
8
|
const user = userEvent.setup({delay: null});
|
|
9
|
-
const onApply =
|
|
10
|
-
render(<DateRangePickerInlineCalendar initialRange={[null, null]} onApply={onApply} onCancel={
|
|
9
|
+
const onApply = vi.fn();
|
|
10
|
+
render(<DateRangePickerInlineCalendar initialRange={[null, null]} onApply={onApply} onCancel={vi.fn()} />);
|
|
11
11
|
|
|
12
12
|
await user.click(screen.getByRole('button', {name: 'Apply'}));
|
|
13
13
|
|
|
@@ -17,8 +17,8 @@ describe('DateRangePickerInlineCalendar', () => {
|
|
|
17
17
|
|
|
18
18
|
it('calls onCancel when the user clicks on the cancel button', async () => {
|
|
19
19
|
const user = userEvent.setup({delay: null});
|
|
20
|
-
const onCancel =
|
|
21
|
-
render(<DateRangePickerInlineCalendar initialRange={[null, null]} onApply={
|
|
20
|
+
const onCancel = vi.fn();
|
|
21
|
+
render(<DateRangePickerInlineCalendar initialRange={[null, null]} onApply={vi.fn()} onCancel={onCancel} />);
|
|
22
22
|
|
|
23
23
|
await user.click(screen.getByRole('button', {name: 'Cancel'}));
|
|
24
24
|
|
|
@@ -26,14 +26,14 @@ describe('DateRangePickerInlineCalendar', () => {
|
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
it('does not render the preset searchbox when there is no presets', () => {
|
|
29
|
-
render(<DateRangePickerInlineCalendar initialRange={[null, null]} onApply={
|
|
29
|
+
render(<DateRangePickerInlineCalendar initialRange={[null, null]} onApply={vi.fn()} onCancel={vi.fn()} />);
|
|
30
30
|
|
|
31
31
|
expect(screen.queryByRole('searchbox')).not.toBeInTheDocument();
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
it('calls onApply with the selected dates when choosing a preset', async () => {
|
|
35
35
|
const user = userEvent.setup({delay: null});
|
|
36
|
-
const onApply =
|
|
36
|
+
const onApply = vi.fn();
|
|
37
37
|
render(
|
|
38
38
|
<DateRangePickerInlineCalendar
|
|
39
39
|
presets={{
|
|
@@ -41,7 +41,7 @@ describe('DateRangePickerInlineCalendar', () => {
|
|
|
41
41
|
}}
|
|
42
42
|
initialRange={[null, null]}
|
|
43
43
|
onApply={onApply}
|
|
44
|
-
onCancel={
|
|
44
|
+
onCancel={vi.fn()}
|
|
45
45
|
/>
|
|
46
46
|
);
|
|
47
47
|
|
|
@@ -58,9 +58,9 @@ describe('DateRangePickerInlineCalendar', () => {
|
|
|
58
58
|
|
|
59
59
|
it('calls onApply with the selected dates when clicking in the calendar', async () => {
|
|
60
60
|
const user = userEvent.setup({delay: null});
|
|
61
|
-
|
|
62
|
-
const onApply =
|
|
63
|
-
render(<DateRangePickerInlineCalendar initialRange={[null, null]} onApply={onApply} onCancel={
|
|
61
|
+
vi.useFakeTimers().setSystemTime(new Date(2022, 0, 31));
|
|
62
|
+
const onApply = vi.fn();
|
|
63
|
+
render(<DateRangePickerInlineCalendar initialRange={[null, null]} onApply={onApply} onCancel={vi.fn()} />);
|
|
64
64
|
|
|
65
65
|
// click once for the start, once for the end
|
|
66
66
|
await user.click(screen.getAllByRole('button', {name: '8'})[0]);
|
|
@@ -70,27 +70,27 @@ describe('DateRangePickerInlineCalendar', () => {
|
|
|
70
70
|
|
|
71
71
|
expect(onApply).toHaveBeenCalledWith([new Date(2022, 0, 8), new Date(2022, 0, 14)]);
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
vi.useRealTimers();
|
|
74
74
|
});
|
|
75
75
|
|
|
76
76
|
it('set end date same as start date if only one date is selected when clicking in the calendar', async () => {
|
|
77
77
|
const user = userEvent.setup({delay: null});
|
|
78
|
-
|
|
79
|
-
const onApply =
|
|
80
|
-
render(<DateRangePickerInlineCalendar initialRange={[null, null]} onApply={onApply} onCancel={
|
|
78
|
+
vi.useFakeTimers().setSystemTime(new Date(2022, 0, 31));
|
|
79
|
+
const onApply = vi.fn();
|
|
80
|
+
render(<DateRangePickerInlineCalendar initialRange={[null, null]} onApply={onApply} onCancel={vi.fn()} />);
|
|
81
81
|
|
|
82
82
|
await user.click(screen.getAllByRole('button', {name: '8'})[0]);
|
|
83
83
|
await user.click(screen.getByRole('button', {name: 'Apply'}));
|
|
84
84
|
|
|
85
85
|
expect(onApply).toHaveBeenCalledWith([new Date(2022, 0, 8), new Date(2022, 0, 8)]);
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
vi.useRealTimers();
|
|
88
88
|
});
|
|
89
89
|
|
|
90
90
|
it('calls onApply with the selected dates when typing in the inputs', async () => {
|
|
91
91
|
const user = userEvent.setup({delay: null});
|
|
92
|
-
const onApply =
|
|
93
|
-
render(<DateRangePickerInlineCalendar initialRange={[null, null]} onApply={onApply} onCancel={
|
|
92
|
+
const onApply = vi.fn();
|
|
93
|
+
render(<DateRangePickerInlineCalendar initialRange={[null, null]} onApply={onApply} onCancel={vi.fn()} />);
|
|
94
94
|
|
|
95
95
|
const startInput = screen.getByRole('textbox', {
|
|
96
96
|
name: /start/i,
|
|
@@ -7,10 +7,13 @@ import {DateRangePickerPopoverCalendar} from '../DateRangePickerPopoverCalendar'
|
|
|
7
7
|
// Since we're mocking the date and the animations are timer based we're mocking useReduceMotion to disable all the animations
|
|
8
8
|
// I tried wrapping the components in <MantineProvider theme={{components: {Transition: {defaultProps: {duration: 0}}}}}>
|
|
9
9
|
// but the animation was still happening. :(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
vi.mock('@mantine/hooks', async () => {
|
|
11
|
+
const actual = await vi.importActual('@mantine/hooks');
|
|
12
|
+
return {
|
|
13
|
+
...actual,
|
|
14
|
+
useReduceMotion: () => true,
|
|
15
|
+
};
|
|
16
|
+
});
|
|
14
17
|
|
|
15
18
|
describe('DateRangePickerPopoverCalendar', () => {
|
|
16
19
|
it('does not render the preset searchbox when there is no presets', () => {
|
|
@@ -49,7 +52,7 @@ describe('DateRangePickerPopoverCalendar', () => {
|
|
|
49
52
|
|
|
50
53
|
it('calls onApply with the selected dates when clicking in the calendar', async () => {
|
|
51
54
|
const user = userEvent.setup({delay: null});
|
|
52
|
-
|
|
55
|
+
vi.useFakeTimers().setSystemTime(new Date(2022, 0, 31));
|
|
53
56
|
const Fixture = () => {
|
|
54
57
|
const form = useForm<{dates: DateRangePickerValue}>({initialValues: {dates: [null, null]}});
|
|
55
58
|
return (
|
|
@@ -67,11 +70,12 @@ describe('DateRangePickerPopoverCalendar', () => {
|
|
|
67
70
|
await user.click(screen.getAllByRole('button', {name: '14'})[0]);
|
|
68
71
|
|
|
69
72
|
// hides the calendar when the second date is clicked
|
|
70
|
-
expect(screen.
|
|
73
|
+
expect(screen.queryAllByRole('button', {name: '8'})[0]).not.toBeVisible();
|
|
74
|
+
expect(screen.queryAllByRole('button', {name: '8'})[1]).not.toBeVisible();
|
|
71
75
|
|
|
72
76
|
expect(screen.getByTestId('json')).toHaveTextContent('["2022-01-08T00:00:00.000Z","2022-01-14T00:00:00.000Z"]');
|
|
73
77
|
|
|
74
|
-
|
|
78
|
+
vi.useRealTimers();
|
|
75
79
|
});
|
|
76
80
|
|
|
77
81
|
it('calls onApply with the selected dates when typing in the inputs', async () => {
|
|
@@ -5,7 +5,7 @@ import {DateRangePickerPresetSelect} from '../DateRangePickerPresetSelect';
|
|
|
5
5
|
describe('DateRangePickerPresetSelect', () => {
|
|
6
6
|
it('calls onChange when selecting a preset', async () => {
|
|
7
7
|
const user = userEvent.setup({delay: null});
|
|
8
|
-
const onChange =
|
|
8
|
+
const onChange = vi.fn();
|
|
9
9
|
render(
|
|
10
10
|
<DateRangePickerPresetSelect
|
|
11
11
|
value={[null, null]}
|
|
@@ -12,7 +12,7 @@ describe('InlineConfirm', () => {
|
|
|
12
12
|
|
|
13
13
|
it('calls the onClick prop when clicking on a button', async () => {
|
|
14
14
|
const user = userEvent.setup({delay: null});
|
|
15
|
-
const onClickSpy =
|
|
15
|
+
const onClickSpy = vi.fn();
|
|
16
16
|
render(
|
|
17
17
|
<InlineConfirm>
|
|
18
18
|
<InlineConfirm.Button id="delete" onClick={onClickSpy}>
|
|
@@ -28,7 +28,7 @@ describe('InlineConfirm', () => {
|
|
|
28
28
|
|
|
29
29
|
it('calls the onClick prop when clicking on the menu item', async () => {
|
|
30
30
|
const user = userEvent.setup({delay: null});
|
|
31
|
-
const onClickSpy =
|
|
31
|
+
const onClickSpy = vi.fn();
|
|
32
32
|
render(
|
|
33
33
|
<InlineConfirm>
|
|
34
34
|
<Menu>
|
|
@@ -55,7 +55,7 @@ describe('InlineConfirm', () => {
|
|
|
55
55
|
render(
|
|
56
56
|
<InlineConfirm>
|
|
57
57
|
<InlineConfirm.Button id="my-button-id">Remove</InlineConfirm.Button>
|
|
58
|
-
<InlineConfirm.Prompt id="my-button-id" label="Are you sure?" onConfirm={
|
|
58
|
+
<InlineConfirm.Prompt id="my-button-id" label="Are you sure?" onConfirm={vi.fn()} />
|
|
59
59
|
</InlineConfirm>
|
|
60
60
|
);
|
|
61
61
|
expect(screen.queryByText('Are you sure?')).not.toBeInTheDocument();
|
|
@@ -69,7 +69,7 @@ describe('InlineConfirm', () => {
|
|
|
69
69
|
|
|
70
70
|
it('hides the prompt when the user cancel and call onConfirm when the user confirms', async () => {
|
|
71
71
|
const user = userEvent.setup({delay: null});
|
|
72
|
-
const confirmSpy =
|
|
72
|
+
const confirmSpy = vi.fn();
|
|
73
73
|
render(
|
|
74
74
|
<InlineConfirm>
|
|
75
75
|
<InlineConfirm.Button id="my-button-id">Remove</InlineConfirm.Button>
|
|
@@ -103,10 +103,10 @@ describe('InlineConfirm', () => {
|
|
|
103
103
|
render(
|
|
104
104
|
<InlineConfirm>
|
|
105
105
|
<InlineConfirm.Button id="remove">Remove</InlineConfirm.Button>
|
|
106
|
-
<InlineConfirm.Prompt id="remove" label="Delete X?" onConfirm={
|
|
106
|
+
<InlineConfirm.Prompt id="remove" label="Delete X?" onConfirm={vi.fn()} />
|
|
107
107
|
|
|
108
108
|
<InlineConfirm.Button id="print">Print</InlineConfirm.Button>
|
|
109
|
-
<InlineConfirm.Prompt id="print" label="Print?" onConfirm={
|
|
109
|
+
<InlineConfirm.Prompt id="print" label="Print?" onConfirm={vi.fn()} />
|
|
110
110
|
</InlineConfirm>
|
|
111
111
|
);
|
|
112
112
|
|
|
@@ -6,7 +6,7 @@ import {Modal} from '../Modal';
|
|
|
6
6
|
describe('Modal', () => {
|
|
7
7
|
it('renders title, desctiption, close button, and child', () => {
|
|
8
8
|
render(
|
|
9
|
-
<Modal opened onClose={
|
|
9
|
+
<Modal opened onClose={vi.fn()} title="title" description="modal description">
|
|
10
10
|
<Container>Children</Container>
|
|
11
11
|
</Modal>
|
|
12
12
|
);
|
|
@@ -22,7 +22,7 @@ describe('Modal', () => {
|
|
|
22
22
|
render(
|
|
23
23
|
<Modal
|
|
24
24
|
opened
|
|
25
|
-
onClose={
|
|
25
|
+
onClose={vi.fn()}
|
|
26
26
|
title={
|
|
27
27
|
<div>
|
|
28
28
|
<QuestionSize32Px />
|
|
@@ -38,7 +38,7 @@ describe('Modal', () => {
|
|
|
38
38
|
});
|
|
39
39
|
|
|
40
40
|
it('trigger onClose function when click on the close button', () => {
|
|
41
|
-
const onClose =
|
|
41
|
+
const onClose = vi.fn();
|
|
42
42
|
render(
|
|
43
43
|
<Modal opened onClose={onClose} title="title">
|
|
44
44
|
<Container>Children</Container>
|
|
@@ -169,7 +169,7 @@ describe('ModalWizard', () => {
|
|
|
169
169
|
];
|
|
170
170
|
|
|
171
171
|
const isDirty = () => false;
|
|
172
|
-
const onClose =
|
|
172
|
+
const onClose = vi.fn();
|
|
173
173
|
|
|
174
174
|
render(
|
|
175
175
|
<ModalWizard isDirty={isDirty} onClose={onClose} closeButtonLabel="closebuttonlabel" opened={true}>
|
|
@@ -205,7 +205,7 @@ describe('ModalWizard', () => {
|
|
|
205
205
|
];
|
|
206
206
|
|
|
207
207
|
const isDirty = () => false;
|
|
208
|
-
const onClose =
|
|
208
|
+
const onClose = vi.fn();
|
|
209
209
|
|
|
210
210
|
render(
|
|
211
211
|
<ModalWizard isDirty={isDirty} onClose={onClose} opened={true}>
|
|
@@ -241,8 +241,8 @@ describe('ModalWizard', () => {
|
|
|
241
241
|
];
|
|
242
242
|
|
|
243
243
|
const isDirty = () => false;
|
|
244
|
-
const onClose =
|
|
245
|
-
const onFinish =
|
|
244
|
+
const onClose = vi.fn();
|
|
245
|
+
const onFinish = vi.fn();
|
|
246
246
|
|
|
247
247
|
render(
|
|
248
248
|
<ModalWizard isDirty={isDirty} onClose={onClose} onFinish={onFinish} opened={true}>
|
|
@@ -278,8 +278,8 @@ describe('ModalWizard', () => {
|
|
|
278
278
|
];
|
|
279
279
|
|
|
280
280
|
const isDirty = () => true;
|
|
281
|
-
const onClose =
|
|
282
|
-
const handleDirtyState =
|
|
281
|
+
const onClose = vi.fn();
|
|
282
|
+
const handleDirtyState = vi.fn();
|
|
283
283
|
|
|
284
284
|
render(
|
|
285
285
|
<ModalWizard
|
|
@@ -323,8 +323,8 @@ describe('ModalWizard', () => {
|
|
|
323
323
|
];
|
|
324
324
|
|
|
325
325
|
const isDirty = () => true;
|
|
326
|
-
const onClose =
|
|
327
|
-
const handleDirtyState =
|
|
326
|
+
const onClose = vi.fn();
|
|
327
|
+
const handleDirtyState = vi.fn();
|
|
328
328
|
|
|
329
329
|
render(
|
|
330
330
|
<ModalWizard
|
|
@@ -4,7 +4,7 @@ import {Prompt} from '../Prompt';
|
|
|
4
4
|
describe('Prompt', () => {
|
|
5
5
|
it('displays the title, body and close button', () => {
|
|
6
6
|
render(
|
|
7
|
-
<Prompt variant="default" opened onClose={
|
|
7
|
+
<Prompt variant="default" opened onClose={vi.fn()} title="title modal">
|
|
8
8
|
content modal
|
|
9
9
|
<Prompt.Footer>footer content</Prompt.Footer>
|
|
10
10
|
</Prompt>
|
|
@@ -16,7 +16,7 @@ describe('Prompt', () => {
|
|
|
16
16
|
});
|
|
17
17
|
|
|
18
18
|
it('calls onClose when clicking on the close button', () => {
|
|
19
|
-
const onClose =
|
|
19
|
+
const onClose = vi.fn();
|
|
20
20
|
render(
|
|
21
21
|
<Prompt variant="default" opened onClose={onClose} title="title modal">
|
|
22
22
|
content modal
|
|
@@ -169,7 +169,7 @@ describe('Table', () => {
|
|
|
169
169
|
|
|
170
170
|
it('calls an action when user double clicks on a row', async () => {
|
|
171
171
|
const user = userEvent.setup();
|
|
172
|
-
const doubleClickSpy =
|
|
172
|
+
const doubleClickSpy = vi.fn();
|
|
173
173
|
render(
|
|
174
174
|
<Table<RowData>
|
|
175
175
|
data={[{firstName: 'Mario'}, {firstName: 'Luigi'}]}
|
|
@@ -38,7 +38,7 @@ describe('Table.Actions', () => {
|
|
|
38
38
|
describe('when multi row selection is enabled', () => {
|
|
39
39
|
it('passes down an array of selected rows', async () => {
|
|
40
40
|
const user = userEvent.setup({delay: null});
|
|
41
|
-
const renderSpy =
|
|
41
|
+
const renderSpy = vi.fn().mockImplementation(() => <div />);
|
|
42
42
|
render(
|
|
43
43
|
<Table<RowData>
|
|
44
44
|
data={[{name: 'fruit'}, {name: 'vegetable'}, {name: 'bread'}]}
|
|
@@ -11,20 +11,23 @@ const columns: Array<ColumnDef<RowData>> = [columnHelper.accessor('name', {enabl
|
|
|
11
11
|
// Since we're mocking the date and the animations are timer based we're mocking useReduceMotion to disable all the animations
|
|
12
12
|
// I tried wrapping the components in <MantineProvider theme={{components: {Transition: {defaultProps: {duration: 0}}}}}>
|
|
13
13
|
// but the animation was still happening. :(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
vi.mock('@mantine/hooks', async () => {
|
|
15
|
+
const actual = await vi.importActual('@mantine/hooks');
|
|
16
|
+
return {
|
|
17
|
+
...actual,
|
|
18
|
+
useReduceMotion: () => true,
|
|
19
|
+
};
|
|
20
|
+
});
|
|
18
21
|
|
|
19
22
|
describe('Table.DateRangePicker', () => {
|
|
20
|
-
|
|
23
|
+
// vi.setTimeout(15000);
|
|
21
24
|
|
|
22
25
|
beforeEach(() => {
|
|
23
|
-
|
|
26
|
+
vi.useFakeTimers().setSystemTime(new Date(2022, 0, 15));
|
|
24
27
|
});
|
|
25
28
|
|
|
26
29
|
afterEach(() => {
|
|
27
|
-
|
|
30
|
+
vi.useRealTimers();
|
|
28
31
|
});
|
|
29
32
|
|
|
30
33
|
it('displays the intial dates', async () => {
|
|
@@ -47,7 +50,7 @@ describe('Table.DateRangePicker', () => {
|
|
|
47
50
|
|
|
48
51
|
it('displays the selected date range in the table', async () => {
|
|
49
52
|
const user = userEvent.setup({delay: null});
|
|
50
|
-
const onChange =
|
|
53
|
+
const onChange = vi.fn();
|
|
51
54
|
render(
|
|
52
55
|
<Table
|
|
53
56
|
data={[{name: 'fruit'}, {name: 'vegetable'}]}
|