diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a13a97238..bd2a5f2e9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -108,6 +108,6 @@ jobs: key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} - name: coverage - run: npm test -- --coverage && bash <(curl -s https://codecov.io/bash) + run: npm run coverage && bash <(curl -s https://codecov.io/bash) needs: setup diff --git a/.gitignore b/.gitignore index 2c1b5ee4b..3111e398c 100644 --- a/.gitignore +++ b/.gitignore @@ -32,7 +32,7 @@ package-lock.json es/ .storybook .doc -!tests/__mocks__/rc-util/lib +!__mocks__/rc-util/lib examples/debug.tsx .history ~* @@ -42,4 +42,4 @@ examples/debug.tsx .umi-production .umi-test .env.local -.dumi \ No newline at end of file +.dumi diff --git a/tests/__mocks__/rc-util/lib/getScrollBarSize.ts b/__mocks__/rc-util/lib/getScrollBarSize.ts similarity index 100% rename from tests/__mocks__/rc-util/lib/getScrollBarSize.ts rename to __mocks__/rc-util/lib/getScrollBarSize.ts diff --git a/jest.config.js b/jest.config.js deleted file mode 100644 index 86627c33b..000000000 --- a/jest.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - setupFiles: ['./tests/setup.js'], - snapshotSerializers: [require.resolve('enzyme-to-json/serializer')], -}; diff --git a/package.json b/package.json index a26e93c16..1e54808c4 100644 --- a/package.json +++ b/package.json @@ -40,8 +40,8 @@ "compile": "father build && lessc assets/index.less assets/index.css", "deploy": "npm run docs:build && npm run docs:deploy", "prettier": "prettier --write \"**/*.{js,jsx,tsx,ts,less,md,json}\"", - "test": "rc-test", - "coverage": "rc-test --coverage", + "test": "vitest", + "coverage": "vitest run --coverage", "prepublishOnly": "npm run compile && np --no-cleanup --yolo --no-publish", "lint": "eslint src/ --ext .tsx,.ts", "lint:tsc": "tsc -p tsconfig.json --noEmit", @@ -63,7 +63,6 @@ "@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "^12.1.5", "@types/enzyme": "^3.10.5", - "@types/jest": "^28.1.2", "@types/react": "^17.0.35", "@types/react-dom": "^18.0.5", "@types/responselike": "^1.0.0", @@ -86,7 +85,6 @@ "rc-animate": "^3.0.0", "rc-dropdown": "~4.0.1", "rc-menu": "~9.6.0", - "rc-test": "^7.0.14", "rc-tooltip": "^5.2.1", "react": "^16.0.0", "react-dnd": "^2.5.4", @@ -97,7 +95,11 @@ "react-window": "^1.8.5", "regenerator-runtime": "^0.13.7", "styled-components": "^5.0.1", - "typescript": "^4.8.4" + "typescript": "^4.8.4", + "@vitest/coverage-c8": "^0.31.0", + "@types/testing-library__jest-dom": "^5.14.5", + "jsdom": "^22.0.0", + "vitest": "^0.31.0" }, "lint-staged": { "**/*.{js,jsx,tsx,ts,md,json}": [ diff --git a/src/stickyScrollBar.tsx b/src/stickyScrollBar.tsx index 712878283..6aa84777b 100644 --- a/src/stickyScrollBar.tsx +++ b/src/stickyScrollBar.tsx @@ -1,10 +1,10 @@ +import { useContext } from '@rc-component/context'; import classNames from 'classnames'; import addEventListener from 'rc-util/lib/Dom/addEventListener'; import { getOffset } from 'rc-util/lib/Dom/css'; import getScrollBarSize from 'rc-util/lib/getScrollBarSize'; import * as React from 'react'; import TableContext from './context/TableContext'; -import { useContext } from '@rc-component/context'; import { useLayoutState } from './hooks/useFrame'; interface StickyScrollBarProps { diff --git a/tests/ColSpan.spec.js b/tests/ColSpan.spec.jsx similarity index 100% rename from tests/ColSpan.spec.js rename to tests/ColSpan.spec.jsx diff --git a/tests/Colgroup.spec.js b/tests/Colgroup.spec.jsx similarity index 100% rename from tests/Colgroup.spec.js rename to tests/Colgroup.spec.jsx index 1b88224f6..e112721a6 100644 --- a/tests/Colgroup.spec.js +++ b/tests/Colgroup.spec.jsx @@ -1,5 +1,5 @@ -import React from 'react'; import { mount } from 'enzyme'; +import React from 'react'; import Table, { INTERNAL_COL_DEFINE } from '../src'; describe('Table.ColGroup', () => { diff --git a/tests/Deprecated.spec.js b/tests/Deprecated.spec.jsx similarity index 90% rename from tests/Deprecated.spec.js rename to tests/Deprecated.spec.jsx index 12cb00988..274c6b546 100644 --- a/tests/Deprecated.spec.js +++ b/tests/Deprecated.spec.jsx @@ -1,13 +1,13 @@ -import React from 'react'; import { mount } from 'enzyme'; import { resetWarned } from 'rc-util/lib/warning'; +import React from 'react'; import Table from '../src'; describe('Table.Deprecated', () => { let errorSpy; beforeAll(() => { - errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {}); + errorSpy = vi.spyOn(console, 'error').mockImplementation(() => {}); }); beforeEach(() => { @@ -34,7 +34,7 @@ describe('Table.Deprecated', () => { removedProp => { it(`warning for '${removedProp}'`, () => { const props = { - [removedProp]: jest.fn(), + [removedProp]: vi.fn(), }; mount(
- Name - | -- Age - | -
---|---|
- - - Lucy - | -- 27 - | -
- - - Jim - | -- 1 - | -
- - - Jack - | -- 28 - | -
- Name - | -- Age - | -
---|---|
- Jack - | -- 28 - | -
- Jack - | -- 28 - | -
- Jack - | -- 28 - | -
- Name - | -- Age - | -
---|---|
- - - Lucy - | -- 27 - | -
- - - Jim - | -- 1 - | -
- - - Jack - | -- 28 - | -
- Name - | -- Age - | -
---|---|
- - - Lucy - | -- 27 - | -
- - - Jack - | -- 28 - | -
- - - Jack - | -- 28 - | -
- - - Jack - | -- 28 - | -
- - - Jack - | -- 28 - | -
- - - Jack - | -- 28 - | -
+ Name + | ++ Age + | +
---|---|
+ + + Lucy + | ++ 27 + | +
+ + + Jim + | ++ 1 + | +
+ + + Jack + | ++ 28 + | +
+
+ , + ], + "endIndex": null, + "next": null, + "parent": null, + "prev": null, + "startIndex": null, + "type": "root", + "x-mode": "quirks", + }, + "_root": [Circular], + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, + }, + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, +} +`; + +exports[`Table.Expand > not use nest when children is invalidate 1`] = ` +LoadedCheerio { + "0":
+ Name + | ++ Age + | +
---|---|
+ Jack + | ++ 28 + | +
+ Jack + | ++ 28 + | +
+ Jack + | ++ 28 + | +
, + "_root": LoadedCheerio { + "0": Document { + "children": [ + +
+
+ , + ], + "endIndex": null, + "next": null, + "parent": null, + "prev": null, + "startIndex": null, + "type": "root", + "x-mode": "quirks", + }, + "_root": [Circular], + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, + }, + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, +} +`; + +exports[`Table.Expand > renders fixed column correctly > work 1`] = ` +LoadedCheerio { + "0":
, + "_root": LoadedCheerio { + "0": Document { + "children": [ + +
+
+ , + ], + "endIndex": null, + "next": null, + "parent": null, + "prev": null, + "startIndex": null, + "type": "root", + "x-mode": "quirks", + }, + "_root": [Circular], + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, + }, + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, +} +`; + +exports[`Table.Expand > renders tree row correctly 1`] = ` +LoadedCheerio { + "0":
+ Name + | ++ Age + | +
---|---|
+ + + Lucy + | ++ 27 + | +
+ + + Jim + | ++ 1 + | +
+ + + Jack + | ++ 28 + | +
, + "_root": LoadedCheerio { + "0": Document { + "children": [ + +
+
+ , + ], + "endIndex": null, + "next": null, + "parent": null, + "prev": null, + "startIndex": null, + "type": "root", + "x-mode": "quirks", + }, + "_root": [Circular], + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, + }, + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, +} +`; + +exports[`Table.Expand > renders tree row correctly with different children 1`] = ` +LoadedCheerio { + "0":
+ Name + | ++ Age + | +
---|---|
+ + + Lucy + | ++ 27 + | +
+ + + Jack + | ++ 28 + | +
+ + + Jack + | ++ 28 + | +
+ + + Jack + | ++ 28 + | +
+ + + Jack + | ++ 28 + | +
+ + + Jack + | ++ 28 + | +
, + "_root": LoadedCheerio { + "0": Document { + "children": [ + +
+
+ , + ], + "endIndex": null, + "next": null, + "parent": null, + "prev": null, + "startIndex": null, + "type": "root", + "x-mode": "quirks", + }, + "_root": [Circular], + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, + }, + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, +} +`; + +exports[`Table.Expand > work in expandable fix 1`] = ` +LoadedCheerio { + "0":
, + "_root": LoadedCheerio { + "0": Document { + "children": [ + +
+
+ , + ], + "endIndex": null, + "next": null, + "parent": null, + "prev": null, + "startIndex": null, + "type": "root", + "x-mode": "quirks", + }, + "_root": [Circular], + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, + }, + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, +} +`; + +exports[`Table.Expand > work in expandable fix 2`] = ` +LoadedCheerio { + "0":
, + "_root": LoadedCheerio { + "0": Document { + "children": [ + +
+
+ , + ], + "endIndex": null, + "next": null, + "parent": null, + "prev": null, + "startIndex": null, + "type": "root", + "x-mode": "quirks", + }, + "_root": [Circular], + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, + }, + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, +} +`; diff --git a/tests/__snapshots__/FixedColumn.spec.js.snap b/tests/__snapshots__/FixedColumn.spec.js.snap deleted file mode 100644 index 99648e662..000000000 --- a/tests/__snapshots__/FixedColumn.spec.js.snap +++ /dev/null @@ -1,2965 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Table.FixedColumn fixed column renders correctly RTL 1`] = ` -
-`; - -exports[`Table.FixedColumn renders correctly all column has width should use it 1`] = ` -
-`; - -exports[`Table.FixedColumn renders correctly scrollX - with data 1`] = ` -
-`; - -exports[`Table.FixedColumn renders correctly scrollX - without data 1`] = ` -
-`; - -exports[`Table.FixedColumn renders correctly scrollXY - with data 1`] = ` -
- 123 - | -- - - 1111 - - - | -- | - xxxxxxxx - | -- xxxxxxxx - | -- xxxxxxxx - | -- xxxxxxxx - | -- xxxxxxxx - | -- xxxxxxxx - | -- xxxxxxxx - | -- xxxxxxxx - | -- xxxxxxxx - | -
- cdd - | -- - - 1111 - - - | -- | - edd12221 - | -- edd12221 - | -- edd12221 - | -- edd12221 - | -- edd12221 - | -- edd12221 - | -- edd12221 - | -- edd12221 - | -- edd12221 - | -
- 133 - | -- - - 1111 - - - | -- edd12221 - | -- | - | - | - | - | - | - | - | - |
- 133 - | -- - - 1111 - - - | -- edd12221 - | -- | - | - | - | - | - | - | - | - |
- 133 - | -- - - 1111 - - - | -- edd12221 - | -- | - | - | - | - | - | - | - | - |
- 133 - | -- - - 1111 - - - | -- edd12221 - | -- | - | - | - | - | - | - | - | - |
- 133 - | -- - - 1111 - - - | -- edd12221 - | -- | - | - | - | - | - | - | - | - |
- 133 - | -- - - 1111 - - - | -- edd12221 - | -- | - | - | - | - | - | - | - | - |
- 133 - | -- - - 1111 - - - | -- edd12221 - | -- | - | - | - | - | - | - | - | - |
-`; - -exports[`Table.FixedColumn renders correctly scrollXY - without data 1`] = ` -
- | - -
-`; diff --git a/tests/__snapshots__/FixedColumn.spec.jsx.snap b/tests/__snapshots__/FixedColumn.spec.jsx.snap new file mode 100644 index 000000000..249dfc2ef --- /dev/null +++ b/tests/__snapshots__/FixedColumn.spec.jsx.snap @@ -0,0 +1,3145 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`Table.FixedColumn > fixed column renders correctly RTL 1`] = ` +LoadedCheerio { + "0":
, + "_root": LoadedCheerio { + "0": Document { + "children": [ + +
+
+ , + ], + "endIndex": null, + "next": null, + "parent": null, + "prev": null, + "startIndex": null, + "type": "root", + "x-mode": "quirks", + }, + "_root": [Circular], + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, + }, + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, +} +`; + +exports[`Table.FixedColumn > renders correctly > all column has width should use it 1`] = ` +LoadedCheerio { + "0":
, + "_root": LoadedCheerio { + "0": Document { + "children": [ + +
+
+ , + ], + "endIndex": null, + "next": null, + "parent": null, + "prev": null, + "startIndex": null, + "type": "root", + "x-mode": "quirks", + }, + "_root": [Circular], + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, + }, + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, +} +`; + +exports[`Table.FixedColumn > renders correctly > scrollX - with data 1`] = ` +LoadedCheerio { + "0":
, + "_root": LoadedCheerio { + "0": Document { + "children": [ + +
+
+ , + ], + "endIndex": null, + "next": null, + "parent": null, + "prev": null, + "startIndex": null, + "type": "root", + "x-mode": "quirks", + }, + "_root": [Circular], + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, + }, + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, +} +`; + +exports[`Table.FixedColumn > renders correctly > scrollX - without data 1`] = ` +LoadedCheerio { + "0":
, + "_root": LoadedCheerio { + "0": Document { + "children": [ + +
+
+ , + ], + "endIndex": null, + "next": null, + "parent": null, + "prev": null, + "startIndex": null, + "type": "root", + "x-mode": "quirks", + }, + "_root": [Circular], + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, + }, + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, +} +`; + +exports[`Table.FixedColumn > renders correctly > scrollXY - with data 1`] = ` +LoadedCheerio { + "0":
+ 123 + | ++ + + 1111 + + + | ++ | + xxxxxxxx + | ++ xxxxxxxx + | ++ xxxxxxxx + | ++ xxxxxxxx + | ++ xxxxxxxx + | ++ xxxxxxxx + | ++ xxxxxxxx + | ++ xxxxxxxx + | ++ xxxxxxxx + | +
+ cdd + | ++ + + 1111 + + + | ++ | + edd12221 + | ++ edd12221 + | ++ edd12221 + | ++ edd12221 + | ++ edd12221 + | ++ edd12221 + | ++ edd12221 + | ++ edd12221 + | ++ edd12221 + | +
+ 133 + | ++ + + 1111 + + + | ++ edd12221 + | ++ | + | + | + | + | + | + | + | + |
+ 133 + | ++ + + 1111 + + + | ++ edd12221 + | ++ | + | + | + | + | + | + | + | + |
+ 133 + | ++ + + 1111 + + + | ++ edd12221 + | ++ | + | + | + | + | + | + | + | + |
+ 133 + | ++ + + 1111 + + + | ++ edd12221 + | ++ | + | + | + | + | + | + | + | + |
+ 133 + | ++ + + 1111 + + + | ++ edd12221 + | ++ | + | + | + | + | + | + | + | + |
+ 133 + | ++ + + 1111 + + + | ++ edd12221 + | ++ | + | + | + | + | + | + | + | + |
+ 133 + | ++ + + 1111 + + + | ++ edd12221 + | ++ | + | + | + | + | + | + | + | + |
, + "_root": LoadedCheerio { + "0": Document { + "children": [ + +
+
+ , + ], + "endIndex": null, + "next": null, + "parent": null, + "prev": null, + "startIndex": null, + "type": "root", + "x-mode": "quirks", + }, + "_root": [Circular], + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, + }, + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, +} +`; + +exports[`Table.FixedColumn > renders correctly > scrollXY - without data 1`] = ` +LoadedCheerio { + "0":
+ | + +
, + "_root": LoadedCheerio { + "0": Document { + "children": [ + +
+
+ , + ], + "endIndex": null, + "next": null, + "parent": null, + "prev": null, + "startIndex": null, + "type": "root", + "x-mode": "quirks", + }, + "_root": [Circular], + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, + }, + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, +} +`; diff --git a/tests/__snapshots__/Summary.spec.tsx.snap b/tests/__snapshots__/Summary.spec.tsx.snap index e72a20741..40aec2575 100644 --- a/tests/__snapshots__/Summary.spec.tsx.snap +++ b/tests/__snapshots__/Summary.spec.tsx.snap @@ -1,28 +1,58 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Table.Summary support data type 1`] = ` -
-+exports[`Table.Summary > support data type 1`] = ` +LoadedCheerio { + "0":
+, + "_root": LoadedCheerio { + "0": Document { + "children": [ + +
+
+ , + ], + "endIndex": null, + "next": null, + "parent": null, + "prev": null, + "startIndex": null, + "type": "root", + "x-mode": "quirks", + }, + "_root": [Circular], + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, + }, + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, +} `; diff --git a/tests/__snapshots__/Table.spec.js.snap b/tests/__snapshots__/Table.spec.js.snap deleted file mode 100644 index 13d03fd8c..000000000 --- a/tests/__snapshots__/Table.spec.js.snap +++ /dev/null @@ -1,918 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Table.Basic columns support JSX condition 1`] = ` -[ - , -
- title - | -- title3 - | -
---|---|
- 2 - | -- 3 - | -
- 2 - | -- 3 - | -
, -] -`; - -exports[`Table.Basic custom components renders correctly 1`] = ` -
- Name - | -
---|
- Lucy - | -
- Jack - | -
-`; - -exports[`Table.Basic custom components renders fixed column and header correctly 1`] = ` -
- Lucy - | -- 27 - | -- F - | -
-`; - -exports[`Table.Basic custom components scroll content with scroll 1`] = ` -
-`; - -exports[`Table.Basic internal api transformColumns basic 1`] = ` -
- before - | -- Name - | -- after - | -
---|---|---|
- | - Lucy - | -- |
- | - Jack - | -- |
-`; - -exports[`Table.Basic renders colSpan correctly 1`] = ` -
- Name - | -|
---|---|
- John - | -|
- Terry - | -- Garner - | -
-`; - -exports[`Table.Basic renders correctly RTL 1`] = ` -
- Name - | -
---|
- Lucy - | -
- Jack - | -
-`; - -exports[`Table.Basic renders correctly basic 1`] = ` -
- Name - | -
---|
- Lucy - | -
- Jack - | -
-`; - -exports[`Table.Basic renders correctly column children undefined 1`] = ` -
- 姓名 - | -- 年龄 - | -
---|---|
- Lucy - | -- |
- Jack - | -- |
-`; - -exports[`Table.Basic renders correctly falsy columns 1`] = ` -
- 姓名 - | -
---|
- Lucy - | -
- Jack - | -
-`; - -exports[`Table.Basic renders correctly no columns 1`] = ` -
- |
- |
- |
-`; - -exports[`Table.Basic renders rowSpan correctly 1`] = ` -
- First Name - | -- Last Name - | -
---|---|
- John - | -- Doe - | -
- Terry - | -
-`; - -exports[`Table.Basic should get scrollbar size 1`] = ` -
-`; - -exports[`Table.Basic syntactic sugar 1`] = ` -
- total - | -
---|
- Name - | -
- No Data - | -
-`; diff --git a/tests/__snapshots__/Table.spec.jsx.snap b/tests/__snapshots__/Table.spec.jsx.snap new file mode 100644 index 000000000..3dc5283f0 --- /dev/null +++ b/tests/__snapshots__/Table.spec.jsx.snap @@ -0,0 +1,1336 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`Table.Basic > columns support JSX condition 1`] = ` +LoadedCheerio { + "0": , + "1":
+ title + | ++ title3 + | +
---|---|
+ 2 + | ++ 3 + | +
+ 2 + | ++ 3 + | +
, + "_root": LoadedCheerio { + "0": Document { + "children": [ + +
+
+ , + ], + "endIndex": null, + "next": null, + "parent": null, + "prev": null, + "startIndex": null, + "type": "root", + "x-mode": "quirks", + }, + "_root": [Circular], + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, + }, + "length": 2, + "options": { + "decodeEntities": true, + "xml": false, + }, +} +`; + +exports[`Table.Basic > custom components > renders correctly 1`] = ` +LoadedCheerio { + "0":
+ Name + | +
---|
+ Lucy + | +
+ Jack + | +
, + "_root": LoadedCheerio { + "0": Document { + "children": [ + +
+
+ , + ], + "endIndex": null, + "next": null, + "parent": null, + "prev": null, + "startIndex": null, + "type": "root", + "x-mode": "quirks", + }, + "_root": [Circular], + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, + }, + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, +} +`; + +exports[`Table.Basic > custom components > renders fixed column and header correctly 1`] = ` +LoadedCheerio { + "0":
+ Lucy + | ++ 27 + | ++ F + | +
, + "_root": LoadedCheerio { + "0": Document { + "children": [ + +
+
+ , + ], + "endIndex": null, + "next": null, + "parent": null, + "prev": null, + "startIndex": null, + "type": "root", + "x-mode": "quirks", + }, + "_root": [Circular], + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, + }, + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, +} +`; + +exports[`Table.Basic > custom components > scroll content > with scroll 1`] = ` +LoadedCheerio { + "0":
, + "_root": LoadedCheerio { + "0": Document { + "children": [ + +
+
+ , + ], + "endIndex": null, + "next": null, + "parent": null, + "prev": null, + "startIndex": null, + "type": "root", + "x-mode": "quirks", + }, + "_root": [Circular], + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, + }, + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, +} +`; + +exports[`Table.Basic > internal api > transformColumns > basic 1`] = ` +LoadedCheerio { + "0":
+ before + | ++ Name + | ++ after + | +
---|---|---|
+ | + Lucy + | ++ |
+ | + Jack + | ++ |
, + "_root": LoadedCheerio { + "0": Document { + "children": [ + +
+
+ , + ], + "endIndex": null, + "next": null, + "parent": null, + "prev": null, + "startIndex": null, + "type": "root", + "x-mode": "quirks", + }, + "_root": [Circular], + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, + }, + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, +} +`; + +exports[`Table.Basic > renders colSpan correctly 1`] = ` +LoadedCheerio { + "0":
+ Name + | +|
---|---|
+ John + | +|
+ Terry + | ++ Garner + | +
, + "_root": LoadedCheerio { + "0": Document { + "children": [ + +
+
+ , + ], + "endIndex": null, + "next": null, + "parent": null, + "prev": null, + "startIndex": null, + "type": "root", + "x-mode": "quirks", + }, + "_root": [Circular], + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, + }, + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, +} +`; + +exports[`Table.Basic > renders correctly > RTL 1`] = ` +LoadedCheerio { + "0":
+ Name + | +
---|
+ Lucy + | +
+ Jack + | +
, + "_root": LoadedCheerio { + "0": Document { + "children": [ + +
+
+ , + ], + "endIndex": null, + "next": null, + "parent": null, + "prev": null, + "startIndex": null, + "type": "root", + "x-mode": "quirks", + }, + "_root": [Circular], + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, + }, + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, +} +`; + +exports[`Table.Basic > renders correctly > basic 1`] = ` +LoadedCheerio { + "0":
+ Name + | +
---|
+ Lucy + | +
+ Jack + | +
, + "_root": LoadedCheerio { + "0": Document { + "children": [ + +
+
+ , + ], + "endIndex": null, + "next": null, + "parent": null, + "prev": null, + "startIndex": null, + "type": "root", + "x-mode": "quirks", + }, + "_root": [Circular], + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, + }, + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, +} +`; + +exports[`Table.Basic > renders correctly > column children undefined 1`] = ` +LoadedCheerio { + "0":
+ 姓名 + | ++ 年龄 + | +
---|---|
+ Lucy + | ++ |
+ Jack + | ++ |
, + "_root": LoadedCheerio { + "0": Document { + "children": [ + +
+
+ , + ], + "endIndex": null, + "next": null, + "parent": null, + "prev": null, + "startIndex": null, + "type": "root", + "x-mode": "quirks", + }, + "_root": [Circular], + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, + }, + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, +} +`; + +exports[`Table.Basic > renders correctly > falsy columns 1`] = ` +LoadedCheerio { + "0":
+ 姓名 + | +
---|
+ Lucy + | +
+ Jack + | +
, + "_root": LoadedCheerio { + "0": Document { + "children": [ + +
+
+ , + ], + "endIndex": null, + "next": null, + "parent": null, + "prev": null, + "startIndex": null, + "type": "root", + "x-mode": "quirks", + }, + "_root": [Circular], + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, + }, + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, +} +`; + +exports[`Table.Basic > renders correctly > no columns 1`] = ` +LoadedCheerio { + "0":
+ |
+ |
+ |
, + "_root": LoadedCheerio { + "0": Document { + "children": [ + +
+
+ , + ], + "endIndex": null, + "next": null, + "parent": null, + "prev": null, + "startIndex": null, + "type": "root", + "x-mode": "quirks", + }, + "_root": [Circular], + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, + }, + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, +} +`; + +exports[`Table.Basic > renders rowSpan correctly 1`] = ` +LoadedCheerio { + "0":
+ First Name + | ++ Last Name + | +
---|---|
+ John + | ++ Doe + | +
+ Terry + | +
, + "_root": LoadedCheerio { + "0": Document { + "children": [ + +
+
+ , + ], + "endIndex": null, + "next": null, + "parent": null, + "prev": null, + "startIndex": null, + "type": "root", + "x-mode": "quirks", + }, + "_root": [Circular], + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, + }, + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, +} +`; + +exports[`Table.Basic > should get scrollbar size 1`] = ` +LoadedCheerio { + "0":
, + "_root": LoadedCheerio { + "0": Document { + "children": [ + +
+
+ , + ], + "endIndex": null, + "next": null, + "parent": null, + "prev": null, + "startIndex": null, + "type": "root", + "x-mode": "quirks", + }, + "_root": [Circular], + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, + }, + "length": 1, + "options": { + "decodeEntities": true, + "xml": false, + }, +} +`; + +exports[`Table.Basic > syntactic sugar 1`] = ` +LoadedCheerio { + "0":
+ total + | +
---|
+ Name + | +
+ No Data + | +
, + "_root": LoadedCheerio { + "0": Document { + "children": [ + +
+
+ ,
+ ],
+ "endIndex": null,
+ "next": null,
+ "parent": null,
+ "prev": null,
+ "startIndex": null,
+ "type": "root",
+ "x-mode": "quirks",
+ },
+ "_root": [Circular],
+ "length": 1,
+ "options": {
+ "decodeEntities": true,
+ "xml": false,
+ },
+ },
+ "length": 1,
+ "options": {
+ "decodeEntities": true,
+ "xml": false,
+ },
+}
+`;
diff --git a/tests/setup.js b/tests/setup.js
deleted file mode 100644
index 154da504f..000000000
--- a/tests/setup.js
+++ /dev/null
@@ -1,7 +0,0 @@
-global.requestAnimationFrame = cb => setTimeout(cb, 0);
-require('regenerator-runtime');
-
-const Enzyme = require('enzyme');
-const Adapter = require('enzyme-adapter-react-16');
-
-Enzyme.configure({ adapter: new Adapter() });
diff --git a/tests/setup.ts b/tests/setup.ts
new file mode 100644
index 000000000..8597c2d9b
--- /dev/null
+++ b/tests/setup.ts
@@ -0,0 +1,23 @@
+import type { TestingLibraryMatchers } from '@testing-library/jest-dom/matchers';
+import matchers from '@testing-library/jest-dom/matchers';
+import { expect } from 'vitest';
+
+declare module 'vitest' {
+ interface Assertion