@patternfly/react-data-view 1.0.0-prerelease.3 → 1.0.0-prerelease.4
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/dist/cjs/Hooks/index.d.ts +1 -1
- package/dist/cjs/Hooks/index.js +1 -1
- package/dist/cjs/Hooks/pagination.d.ts +13 -0
- package/dist/cjs/Hooks/pagination.js +16 -0
- package/dist/cjs/Hooks/pagination.test.js +49 -0
- package/dist/esm/Hooks/index.d.ts +1 -1
- package/dist/esm/Hooks/index.js +1 -1
- package/dist/esm/Hooks/pagination.d.ts +13 -0
- package/dist/esm/Hooks/pagination.js +12 -0
- package/dist/esm/Hooks/pagination.test.js +47 -0
- package/package.json +1 -1
- package/patternfly-docs/content/extensions/data-view/examples/DataView/DataView.md +2 -1
- package/patternfly-docs/content/extensions/data-view/examples/DataView/DataViewPredefinedLayoutExample.tsx +58 -17
- package/patternfly-docs/content/extensions/data-view/examples/Hooks/Hooks.md +1 -4
- package/src/Hooks/index.ts +1 -1
- package/src/Hooks/pagination.test.tsx +57 -0
- package/src/Hooks/pagination.ts +28 -0
- package/dist/cjs/DataView/DataView.test.js +0 -16
- package/dist/cjs/Hooks/useDataViewPagination.d.ts +0 -4
- package/dist/cjs/Hooks/useDataViewPagination.js +0 -2
- package/dist/esm/DataView/DataView.test.js +0 -11
- package/dist/esm/Hooks/useDataViewPagination.d.ts +0 -4
- package/dist/esm/Hooks/useDataViewPagination.js +0 -1
- package/src/DataView/DataView.test.tsx +0 -13
- package/src/Hooks/useDataViewPagination.ts +0 -4
- /package/dist/cjs/{DataView/DataView.test.d.ts → Hooks/pagination.test.d.ts} +0 -0
- /package/dist/esm/{DataView/DataView.test.d.ts → Hooks/pagination.test.d.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './pagination';
|
package/dist/cjs/Hooks/index.js
CHANGED
|
@@ -14,4 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./pagination"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface UseDataViewPaginationProps {
|
|
2
|
+
page?: number;
|
|
3
|
+
perPage: number;
|
|
4
|
+
}
|
|
5
|
+
export interface DataViewPaginationProps extends UseDataViewPaginationProps {
|
|
6
|
+
page: number;
|
|
7
|
+
}
|
|
8
|
+
export declare const useDataViewPagination: ({ page, perPage }: UseDataViewPaginationProps) => {
|
|
9
|
+
onPerPageSelect: (_event: React.MouseEvent | React.KeyboardEvent | MouseEvent | undefined, newPerPage: number) => void;
|
|
10
|
+
onSetPage: (_event: React.MouseEvent | React.KeyboardEvent | MouseEvent | undefined, newPage: number) => void;
|
|
11
|
+
page: number;
|
|
12
|
+
perPage: number;
|
|
13
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useDataViewPagination = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const useDataViewPagination = ({ page = 1, perPage }) => {
|
|
6
|
+
const [state, setState] = (0, react_1.useState)({ page, perPage });
|
|
7
|
+
const onPerPageSelect = (_event, newPerPage) => {
|
|
8
|
+
setState(prev => (Object.assign(Object.assign({}, prev), { perPage: newPerPage })));
|
|
9
|
+
};
|
|
10
|
+
const onSetPage = (_event, newPage) => {
|
|
11
|
+
setState(prev => (Object.assign(Object.assign({}, prev), { page: newPage })));
|
|
12
|
+
};
|
|
13
|
+
return Object.assign(Object.assign({}, state), { onPerPageSelect,
|
|
14
|
+
onSetPage });
|
|
15
|
+
};
|
|
16
|
+
exports.useDataViewPagination = useDataViewPagination;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
require("@testing-library/jest-dom");
|
|
4
|
+
const react_1 = require("@testing-library/react");
|
|
5
|
+
const pagination_1 = require("./pagination");
|
|
6
|
+
describe('useDataViewPagination', () => {
|
|
7
|
+
it('should get initial state correctly - no page', () => {
|
|
8
|
+
const { result } = (0, react_1.renderHook)(() => (0, pagination_1.useDataViewPagination)({ perPage: 7 }));
|
|
9
|
+
expect(result.current).toEqual({
|
|
10
|
+
onPerPageSelect: expect.any(Function),
|
|
11
|
+
onSetPage: expect.any(Function),
|
|
12
|
+
page: 1,
|
|
13
|
+
perPage: 7
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
it('should get initial state correctly - page set', () => {
|
|
17
|
+
const { result } = (0, react_1.renderHook)(() => (0, pagination_1.useDataViewPagination)({ page: 3, perPage: 5 }));
|
|
18
|
+
expect(result.current).toEqual({
|
|
19
|
+
onPerPageSelect: expect.any(Function),
|
|
20
|
+
onSetPage: expect.any(Function),
|
|
21
|
+
page: 3,
|
|
22
|
+
perPage: 5
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
it('should set page correctly', () => {
|
|
26
|
+
const { result } = (0, react_1.renderHook)(() => (0, pagination_1.useDataViewPagination)({ page: 3, perPage: 5 }));
|
|
27
|
+
(0, react_1.act)(() => {
|
|
28
|
+
result.current.onSetPage(undefined, 8);
|
|
29
|
+
});
|
|
30
|
+
expect(result.current).toEqual({
|
|
31
|
+
onPerPageSelect: expect.any(Function),
|
|
32
|
+
onSetPage: expect.any(Function),
|
|
33
|
+
page: 8,
|
|
34
|
+
perPage: 5
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
it('should set perPage correctly', () => {
|
|
38
|
+
const { result } = (0, react_1.renderHook)(() => (0, pagination_1.useDataViewPagination)({ page: 3, perPage: 5 }));
|
|
39
|
+
(0, react_1.act)(() => {
|
|
40
|
+
result.current.onPerPageSelect(undefined, 50);
|
|
41
|
+
});
|
|
42
|
+
expect(result.current).toEqual({
|
|
43
|
+
onPerPageSelect: expect.any(Function),
|
|
44
|
+
onSetPage: expect.any(Function),
|
|
45
|
+
page: 3,
|
|
46
|
+
perPage: 50
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './pagination';
|
package/dist/esm/Hooks/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './pagination';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface UseDataViewPaginationProps {
|
|
2
|
+
page?: number;
|
|
3
|
+
perPage: number;
|
|
4
|
+
}
|
|
5
|
+
export interface DataViewPaginationProps extends UseDataViewPaginationProps {
|
|
6
|
+
page: number;
|
|
7
|
+
}
|
|
8
|
+
export declare const useDataViewPagination: ({ page, perPage }: UseDataViewPaginationProps) => {
|
|
9
|
+
onPerPageSelect: (_event: React.MouseEvent | React.KeyboardEvent | MouseEvent | undefined, newPerPage: number) => void;
|
|
10
|
+
onSetPage: (_event: React.MouseEvent | React.KeyboardEvent | MouseEvent | undefined, newPage: number) => void;
|
|
11
|
+
page: number;
|
|
12
|
+
perPage: number;
|
|
13
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
export const useDataViewPagination = ({ page = 1, perPage }) => {
|
|
3
|
+
const [state, setState] = useState({ page, perPage });
|
|
4
|
+
const onPerPageSelect = (_event, newPerPage) => {
|
|
5
|
+
setState(prev => (Object.assign(Object.assign({}, prev), { perPage: newPerPage })));
|
|
6
|
+
};
|
|
7
|
+
const onSetPage = (_event, newPage) => {
|
|
8
|
+
setState(prev => (Object.assign(Object.assign({}, prev), { page: newPage })));
|
|
9
|
+
};
|
|
10
|
+
return Object.assign(Object.assign({}, state), { onPerPageSelect,
|
|
11
|
+
onSetPage });
|
|
12
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
2
|
+
import { renderHook, act } from '@testing-library/react';
|
|
3
|
+
import { useDataViewPagination } from './pagination';
|
|
4
|
+
describe('useDataViewPagination', () => {
|
|
5
|
+
it('should get initial state correctly - no page', () => {
|
|
6
|
+
const { result } = renderHook(() => useDataViewPagination({ perPage: 7 }));
|
|
7
|
+
expect(result.current).toEqual({
|
|
8
|
+
onPerPageSelect: expect.any(Function),
|
|
9
|
+
onSetPage: expect.any(Function),
|
|
10
|
+
page: 1,
|
|
11
|
+
perPage: 7
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
it('should get initial state correctly - page set', () => {
|
|
15
|
+
const { result } = renderHook(() => useDataViewPagination({ page: 3, perPage: 5 }));
|
|
16
|
+
expect(result.current).toEqual({
|
|
17
|
+
onPerPageSelect: expect.any(Function),
|
|
18
|
+
onSetPage: expect.any(Function),
|
|
19
|
+
page: 3,
|
|
20
|
+
perPage: 5
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
it('should set page correctly', () => {
|
|
24
|
+
const { result } = renderHook(() => useDataViewPagination({ page: 3, perPage: 5 }));
|
|
25
|
+
act(() => {
|
|
26
|
+
result.current.onSetPage(undefined, 8);
|
|
27
|
+
});
|
|
28
|
+
expect(result.current).toEqual({
|
|
29
|
+
onPerPageSelect: expect.any(Function),
|
|
30
|
+
onSetPage: expect.any(Function),
|
|
31
|
+
page: 8,
|
|
32
|
+
perPage: 5
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
it('should set perPage correctly', () => {
|
|
36
|
+
const { result } = renderHook(() => useDataViewPagination({ page: 3, perPage: 5 }));
|
|
37
|
+
act(() => {
|
|
38
|
+
result.current.onPerPageSelect(undefined, 50);
|
|
39
|
+
});
|
|
40
|
+
expect(result.current).toEqual({
|
|
41
|
+
onPerPageSelect: expect.any(Function),
|
|
42
|
+
onSetPage: expect.any(Function),
|
|
43
|
+
page: 3,
|
|
44
|
+
perPage: 50
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
});
|
package/package.json
CHANGED
|
@@ -13,7 +13,8 @@ source: react
|
|
|
13
13
|
propComponents: ['DataView']
|
|
14
14
|
sourceLink: https://github.com/patternfly/react-data-view/blob/main/packages/module/patternfly-docs/content/extensions/data-view/examples/DataView/DataView.md
|
|
15
15
|
---
|
|
16
|
-
import {
|
|
16
|
+
import { useMemo } from 'react';
|
|
17
|
+
import { useDataViewPagination } from '@patternfly/react-data-view/dist/dynamic/Hooks';
|
|
17
18
|
import DataView from '@patternfly/react-data-view/dist/dynamic/DataView';
|
|
18
19
|
import DataViewToolbar from '@patternfly/react-data-view/dist/dynamic/DataViewToolbar';
|
|
19
20
|
|
|
@@ -1,24 +1,65 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
2
|
import { Pagination } from '@patternfly/react-core';
|
|
3
|
+
import { Table, Tbody, Th, Thead, Tr, Td } from '@patternfly/react-table';
|
|
4
|
+
import { useDataViewPagination } from '@patternfly/react-data-view/dist/dynamic/Hooks';
|
|
3
5
|
import DataView from '@patternfly/react-data-view/dist/dynamic/DataView';
|
|
4
6
|
import DataViewToolbar from '@patternfly/react-data-view/dist/dynamic/DataViewToolbar';
|
|
5
7
|
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
border: 'var(--pf-t--global--border--width--box--default) dashed var(--pf-t--global--border--color--default)'
|
|
11
|
-
};
|
|
8
|
+
const perPageOptions = [
|
|
9
|
+
{ title: '5', value: 5 },
|
|
10
|
+
{ title: '10', value: 10 }
|
|
11
|
+
]
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
interface Repository {
|
|
14
|
+
name: string;
|
|
15
|
+
branches: string | null;
|
|
16
|
+
prs: string | null;
|
|
17
|
+
workspaces: string;
|
|
18
|
+
lastCommit: string;
|
|
16
19
|
}
|
|
17
20
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
const repositories: Repository[] = [
|
|
22
|
+
{ name: 'one', branches: 'two', prs: 'three', workspaces: 'four', lastCommit: 'five' },
|
|
23
|
+
{ name: 'one - 2', branches: null, prs: null, workspaces: 'four - 2', lastCommit: 'five - 2' },
|
|
24
|
+
{ name: 'one - 3', branches: 'two - 3', prs: 'three - 3', workspaces: 'four - 3', lastCommit: 'five - 3' },
|
|
25
|
+
{ name: 'one - 4', branches: 'two - 4', prs: 'null', workspaces: 'four - 4', lastCommit: 'five - 4' },
|
|
26
|
+
{ name: 'one - 5', branches: 'two - 5', prs: 'three - 5', workspaces: 'four - 5', lastCommit: 'five - 5' },
|
|
27
|
+
{ name: 'one - 6', branches: 'two - 6', prs: 'three - 6', workspaces: 'four - 6', lastCommit: 'five - 6' }
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
const cols = {
|
|
31
|
+
name: 'Repositories',
|
|
32
|
+
branches: 'Branches',
|
|
33
|
+
prs: 'Pull requests',
|
|
34
|
+
workspaces: 'Workspaces',
|
|
35
|
+
lastCommit: 'Last commit'
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const ouiaId = 'LayoutExample';
|
|
39
|
+
|
|
40
|
+
export const BasicExample: React.FunctionComponent = () => {
|
|
41
|
+
const pagination = useDataViewPagination({ perPage: 5 });
|
|
42
|
+
const { page, perPage } = pagination;
|
|
43
|
+
|
|
44
|
+
const data = useMemo(() => repositories.slice((page - 1) * perPage, ((page - 1) * perPage) + perPage), [ page, perPage ]);
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<DataView>
|
|
48
|
+
<DataViewToolbar pagination={<Pagination ouiaId={`${ouiaId}Header-pagination`} perPageOptions={perPageOptions} itemCount={repositories.length} {...pagination} />} />
|
|
49
|
+
<Table aria-label="Repositories table" ouiaId={ouiaId}>
|
|
50
|
+
<Thead data-ouia-component-id={`${ouiaId}-thead`}>
|
|
51
|
+
<Tr ouiaId={`${ouiaId}-tr-head`}>
|
|
52
|
+
{Object.values(cols).map((column, index) => <Th key={index} data-ouia-component-id={`${ouiaId}-th-${index}`}>{column}</Th>)}
|
|
53
|
+
</Tr>
|
|
54
|
+
</Thead>
|
|
55
|
+
<Tbody>
|
|
56
|
+
{data.map((repo, rowIndex) => (
|
|
57
|
+
<Tr key={repo.name} ouiaId={`${ouiaId}-tr-${rowIndex}`}>
|
|
58
|
+
{Object.keys(cols).map((column, colIndex) => <Td key={colIndex} data-ouia-component-id={`${ouiaId}-td-${rowIndex}-${colIndex}`}>{repo[column]}</Td>)}
|
|
59
|
+
</Tr>
|
|
60
|
+
))}
|
|
61
|
+
</Tbody>
|
|
62
|
+
</Table>
|
|
63
|
+
<DataViewToolbar pagination={<Pagination isCompact ouiaId={`${ouiaId}Footer-pagination`} perPageOptions={perPageOptions} itemCount={repositories.length} {...pagination} />} />
|
|
64
|
+
</DataView>
|
|
65
|
+
)}
|
|
@@ -17,7 +17,4 @@ Data view hooks provide a predefined solution to manage state of the data view.
|
|
|
17
17
|
|
|
18
18
|
### useDataViewPagination()
|
|
19
19
|
|
|
20
|
-
The `useDataViewPagination` hook manages the pagination state of the data view. It retrieves the current `page` and `perPage` values together with functions to set them (`
|
|
21
|
-
|
|
22
|
-
Coming soon...
|
|
23
|
-
|
|
20
|
+
The `useDataViewPagination` hook manages the pagination state of the data view. It retrieves the current `page` and `perPage` values together with functions to set them (`onSetPage`, `onPerPageSelect`). You can easily spread the retrieved values to the PatternFly [pagination](/components/pagination) component and make it live.
|
package/src/Hooks/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './pagination';
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
2
|
+
import { renderHook, act } from '@testing-library/react';
|
|
3
|
+
import { useDataViewPagination } from './pagination';
|
|
4
|
+
|
|
5
|
+
describe('useDataViewPagination', () => {
|
|
6
|
+
|
|
7
|
+
it('should get initial state correctly - no page', () => {
|
|
8
|
+
const { result } = renderHook(() => useDataViewPagination({ perPage: 7 }))
|
|
9
|
+
expect(result.current).toEqual({
|
|
10
|
+
onPerPageSelect: expect.any(Function),
|
|
11
|
+
onSetPage: expect.any(Function),
|
|
12
|
+
page: 1,
|
|
13
|
+
perPage: 7
|
|
14
|
+
})
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('should get initial state correctly - page set', () => {
|
|
18
|
+
const { result } = renderHook(() => useDataViewPagination({ page: 3, perPage: 5 }))
|
|
19
|
+
expect(result.current).toEqual({
|
|
20
|
+
onPerPageSelect: expect.any(Function),
|
|
21
|
+
onSetPage: expect.any(Function),
|
|
22
|
+
page: 3,
|
|
23
|
+
perPage: 5
|
|
24
|
+
})
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('should set page correctly', () => {
|
|
28
|
+
const { result } = renderHook(() => useDataViewPagination({ page: 3, perPage: 5 }))
|
|
29
|
+
|
|
30
|
+
act(() => {
|
|
31
|
+
result.current.onSetPage(undefined, 8);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
expect(result.current).toEqual({
|
|
35
|
+
onPerPageSelect: expect.any(Function),
|
|
36
|
+
onSetPage: expect.any(Function),
|
|
37
|
+
page: 8,
|
|
38
|
+
perPage: 5
|
|
39
|
+
})
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('should set perPage correctly', () => {
|
|
43
|
+
const { result } = renderHook(() => useDataViewPagination({ page: 3, perPage: 5 }))
|
|
44
|
+
|
|
45
|
+
act(() => {
|
|
46
|
+
result.current.onPerPageSelect(undefined, 50);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
expect(result.current).toEqual({
|
|
50
|
+
onPerPageSelect: expect.any(Function),
|
|
51
|
+
onSetPage: expect.any(Function),
|
|
52
|
+
page: 3,
|
|
53
|
+
perPage: 50
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
|
|
3
|
+
export interface UseDataViewPaginationProps {
|
|
4
|
+
page?: number;
|
|
5
|
+
perPage: number;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface DataViewPaginationProps extends UseDataViewPaginationProps {
|
|
9
|
+
page: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const useDataViewPagination = ({ page = 1, perPage }: UseDataViewPaginationProps) => {
|
|
13
|
+
const [ state, setState ] = useState({ page, perPage });
|
|
14
|
+
|
|
15
|
+
const onPerPageSelect = (_event: React.MouseEvent | React.KeyboardEvent | MouseEvent | undefined, newPerPage: number) => {
|
|
16
|
+
setState(prev => ({ ...prev, perPage: newPerPage }));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const onSetPage = (_event: React.MouseEvent | React.KeyboardEvent | MouseEvent | undefined, newPage: number) => {
|
|
20
|
+
setState(prev => ({ ...prev, page: newPage }));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
...state,
|
|
25
|
+
onPerPageSelect,
|
|
26
|
+
onSetPage
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const react_1 = __importDefault(require("react"));
|
|
7
|
-
const react_2 = require("@testing-library/react");
|
|
8
|
-
require("@testing-library/jest-dom");
|
|
9
|
-
const DataView_1 = __importDefault(require("./DataView"));
|
|
10
|
-
describe('DataView', () => {
|
|
11
|
-
it('should render data view', () => {
|
|
12
|
-
(0, react_2.render)(react_1.default.createElement(DataView_1.default, null,
|
|
13
|
-
react_1.default.createElement(react_1.default.Fragment, null, "Data view content")));
|
|
14
|
-
expect(react_2.screen.getByText('Data view content')).toBeInTheDocument();
|
|
15
|
-
});
|
|
16
|
-
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render, screen } from '@testing-library/react';
|
|
3
|
-
import '@testing-library/jest-dom';
|
|
4
|
-
import DataView from './DataView';
|
|
5
|
-
describe('DataView', () => {
|
|
6
|
-
it('should render data view', () => {
|
|
7
|
-
render(React.createElement(DataView, null,
|
|
8
|
-
React.createElement(React.Fragment, null, "Data view content")));
|
|
9
|
-
expect(screen.getByText('Data view content')).toBeInTheDocument();
|
|
10
|
-
});
|
|
11
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render, screen } from '@testing-library/react';
|
|
3
|
-
import '@testing-library/jest-dom'
|
|
4
|
-
import DataView from './DataView';
|
|
5
|
-
|
|
6
|
-
describe('DataView', () => {
|
|
7
|
-
|
|
8
|
-
it('should render data view', () => {
|
|
9
|
-
render(<DataView><>Data view content</></DataView>);
|
|
10
|
-
expect(screen.getByText('Data view content')).toBeInTheDocument();
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
});
|
|
File without changes
|
|
File without changes
|