@truedat/dd 4.48.7 → 4.48.10

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.
Files changed (30) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/package.json +5 -5
  3. package/src/components/StructureChildrenRelations.js +6 -14
  4. package/src/components/StructureCrumbs.js +43 -25
  5. package/src/components/StructureFieldRow.js +12 -10
  6. package/src/components/StructureFields.js +7 -7
  7. package/src/components/StructureItem.js +2 -2
  8. package/src/components/StructureSummary.js +4 -6
  9. package/src/components/StructuresSearchResults.js +34 -29
  10. package/src/components/StructuresView.js +36 -14
  11. package/src/components/__tests__/StructureFieldRow.spec.js +37 -33
  12. package/src/components/__tests__/StructureFields.spec.js +26 -27
  13. package/src/components/__tests__/StructureItem.spec.js +1 -1
  14. package/src/components/__tests__/StructureItems.spec.js +1 -3
  15. package/src/components/__tests__/StructureSummary.spec.js +1 -4
  16. package/src/components/__tests__/__snapshots__/StructureFieldRow.spec.js.snap +71 -74
  17. package/src/components/__tests__/__snapshots__/StructureFields.spec.js.snap +132 -160
  18. package/src/components/__tests__/__snapshots__/StructuresSearchResults.spec.js.snap +7 -7
  19. package/src/components/__tests__/__snapshots__/StructuresView.spec.js.snap +37 -6
  20. package/src/messages/en.js +7 -6
  21. package/src/messages/es.js +7 -6
  22. package/src/reducers/structure.js +5 -5
  23. package/src/reducers/structures.js +2 -2
  24. package/src/reducers/structuresLoading.js +1 -3
  25. package/src/selectors/__tests__/getSortedFields.spec.js +11 -11
  26. package/src/selectors/__tests__/getStructureParent.spec.js +10 -10
  27. package/src/selectors/getStructureFieldColumns.js +29 -39
  28. package/src/selectors/getStructureParent.js +2 -7
  29. package/src/selectors/getStructureSortingCriteria.js +7 -5
  30. package/src/selectors/structureColumnsSelector.js +2 -6
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.48.10] 2022-07-19
4
+
5
+ ### Changed
6
+
7
+ - [TD-4975] StructuresView can be used as embedded without header
8
+
9
+ ## [4.48.8] 2022-07-18
10
+
11
+ ### Changed
12
+
13
+ - [TD-5001] Display structure alias instead of technical name
14
+
3
15
  ## [4.48.2] 2022-07-08
4
16
 
5
17
  ### Changed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/dd",
3
- "version": "4.48.7",
3
+ "version": "4.48.10",
4
4
  "description": "Truedat Web Data Dictionary",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -88,9 +88,9 @@
88
88
  },
89
89
  "dependencies": {
90
90
  "@apollo/client": "^3.6.4",
91
- "@truedat/auth": "4.48.7",
92
- "@truedat/core": "4.48.7",
93
- "@truedat/df": "4.48.7",
91
+ "@truedat/auth": "4.48.10",
92
+ "@truedat/core": "4.48.10",
93
+ "@truedat/df": "4.48.10",
94
94
  "lodash": "^4.17.21",
95
95
  "path-to-regexp": "^1.7.0",
96
96
  "prop-types": "^15.8.1",
@@ -112,5 +112,5 @@
112
112
  "react-dom": ">= 16.8.6 < 17",
113
113
  "semantic-ui-react": ">= 0.88.2 < 2.1"
114
114
  },
115
- "gitHead": "f4a20ecf51eb101c2c25facfec48ee8cd0e621a3"
115
+ "gitHead": "9f5085bc64845d8eb2605c7c9d624feae44052f5"
116
116
  }
@@ -2,23 +2,15 @@ import _ from "lodash/fp";
2
2
  import React from "react";
3
3
  import PropTypes from "prop-types";
4
4
  import { connect } from "react-redux";
5
+ import { columnPredicate } from "@truedat/core/services";
5
6
  import {
6
7
  getChildrenRelationColumns,
7
- getSortedChildrenRelations
8
+ getSortedChildrenRelations,
8
9
  } from "../selectors";
9
10
  import StructureRelations from "./StructureRelations";
10
11
 
11
- const columnPredicate = column => {
12
- const { fieldSelector, name } = column || {};
13
- const field = _.isFunction(fieldSelector)
14
- ? fieldSelector
15
- : _.path(_.defaultTo(name)(fieldSelector));
16
- return name === "links" ? _.flow(field, _.negate(_.isEmpty)) : field;
17
- };
18
-
19
- const filterColumns = (columns, relations) => {
20
- return _.filter(column => _.any(columnPredicate(column))(relations))(columns);
21
- };
12
+ const filterColumns = (columns, relations) =>
13
+ _.filter((c) => _.any(columnPredicate(c))(relations))(columns);
22
14
 
23
15
  export const StructureChildrenRelations = ({ columns, relations, ...rest }) => (
24
16
  <StructureRelations columns={columns} relations={relations} {...rest} />
@@ -26,7 +18,7 @@ export const StructureChildrenRelations = ({ columns, relations, ...rest }) => (
26
18
 
27
19
  StructureChildrenRelations.propTypes = {
28
20
  columns: PropTypes.array,
29
- relations: PropTypes.array
21
+ relations: PropTypes.array,
30
22
  };
31
23
 
32
24
  const mapStateToProps = (state, ownProps) => ({
@@ -34,7 +26,7 @@ const mapStateToProps = (state, ownProps) => ({
34
26
  columns: filterColumns(
35
27
  _.propOr(getChildrenRelationColumns(state), "columns")(ownProps),
36
28
  state.childrenRelations
37
- )
29
+ ),
38
30
  });
39
31
 
40
32
  export default connect(mapStateToProps)(StructureChildrenRelations);
@@ -16,7 +16,7 @@ export const StructuresCrumb = () => (
16
16
  </>
17
17
  );
18
18
 
19
- export const SystemCrumb = ({ name, id }) => (
19
+ export const SystemCrumb = ({ id, name }) => (
20
20
  <>
21
21
  <Breadcrumb.Section
22
22
  as={Link}
@@ -29,21 +29,28 @@ export const SystemCrumb = ({ name, id }) => (
29
29
  </>
30
30
  );
31
31
 
32
- export const AncestorCrumb = ({ name, id, published_note }) => (
32
+ SystemCrumb.propTypes = {
33
+ id: PropTypes.number,
34
+ name: PropTypes.string,
35
+ };
36
+
37
+ export const AncestorCrumb = ({ name, id }) => (
33
38
  <>
34
39
  <Breadcrumb.Section as={Link} to={linkTo.STRUCTURE({ id })} active={false}>
35
- {_.isEmpty(published_note?.alias) ? name : published_note.alias}
40
+ {name}
36
41
  </Breadcrumb.Section>
37
42
  <Breadcrumb.Divider icon="right angle" />
38
43
  </>
39
44
  );
40
45
 
41
- export const StructureCrumb = ({ name, id, version, published_note }) =>
46
+ AncestorCrumb.propTypes = {
47
+ id: PropTypes.number,
48
+ name: PropTypes.string,
49
+ };
50
+
51
+ export const StructureCrumb = ({ name, id, version }) =>
42
52
  _.isNil(version) ? (
43
- <Breadcrumb.Section
44
- active
45
- content={_.isEmpty(published_note?.alias) ? name : published_note.alias}
46
- />
53
+ <Breadcrumb.Section active content={name} />
47
54
  ) : (
48
55
  <>
49
56
  <Breadcrumb.Section
@@ -51,46 +58,56 @@ export const StructureCrumb = ({ name, id, version, published_note }) =>
51
58
  to={linkTo.STRUCTURE({ id })}
52
59
  active={false}
53
60
  >
54
- {_.isEmpty(published_note?.alias) ? name : published_note.alias}
61
+ {name}
55
62
  </Breadcrumb.Section>
56
63
  <Breadcrumb.Divider icon="right angle" />
57
64
  </>
58
65
  );
59
66
 
67
+ StructureCrumb.propTypes = {
68
+ id: PropTypes.number,
69
+ alias: PropTypes.string,
70
+ name: PropTypes.string,
71
+ version: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
72
+ };
73
+
60
74
  export const VersionCrumb = ({ version }) => (
61
75
  <Breadcrumb.Section active>
62
76
  <FormattedMessage id="structure.crumbs.version" values={{ version }} />
63
77
  </Breadcrumb.Section>
64
78
  );
65
79
 
80
+ VersionCrumb.propTypes = {
81
+ version: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
82
+ };
83
+
66
84
  export const StructureCrumbs = ({
67
85
  id,
68
86
  system,
69
87
  ancestry,
88
+ alias,
70
89
  name,
71
90
  version,
72
- published_note,
73
91
  }) =>
74
92
  name ? (
75
93
  <Breadcrumb>
76
94
  <StructuresCrumb />
77
- {!_.isEmpty(system) && <SystemCrumb {...system} />}
78
- {!_.isEmpty(ancestry) &&
79
- _.map(({ data_structure_id, name, published_note }) => (
80
- <AncestorCrumb
81
- key={data_structure_id}
82
- name={name}
83
- id={data_structure_id}
84
- published_note={published_note}
85
- />
86
- ))(ancestry)}
95
+ {_.isEmpty(system) ? null : <SystemCrumb {...system} />}
96
+ {_.isEmpty(ancestry)
97
+ ? null
98
+ : _.map(({ data_structure_id, name }) => (
99
+ <AncestorCrumb
100
+ key={data_structure_id}
101
+ name={name}
102
+ id={data_structure_id}
103
+ />
104
+ ))(ancestry)}
87
105
  <StructureCrumb
88
- name={name}
106
+ name={_.defaultTo(name)(alias)}
89
107
  id={id}
90
108
  version={version}
91
- published_note={published_note}
92
109
  />
93
- {!_.isNil(version) && <VersionCrumb id={id} version={version} />}
110
+ {_.isNil(version) ? null : <VersionCrumb id={id} version={version} />}
94
111
  </Breadcrumb>
95
112
  ) : null;
96
113
 
@@ -98,10 +115,10 @@ StructureCrumbs.propTypes = {
98
115
  ancestry: PropTypes.array,
99
116
  id: PropTypes.number,
100
117
  name: PropTypes.string,
118
+ alias: PropTypes.string,
101
119
  field: PropTypes.object,
102
120
  system: PropTypes.object,
103
- version: PropTypes.string,
104
- published_note: PropTypes.object,
121
+ version: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
105
122
  };
106
123
 
107
124
  const mapStateToProps = ({
@@ -115,4 +132,5 @@ const mapStateToProps = ({
115
132
  system,
116
133
  version,
117
134
  });
135
+
118
136
  export default connect(mapStateToProps)(StructureCrumbs);
@@ -4,20 +4,22 @@ import { Table } from "semantic-ui-react";
4
4
  import { columnDecorator } from "@truedat/core/services";
5
5
 
6
6
  export const StructureFieldRow = ({ field, columns }) => (
7
- <Table.Row key={field.data_structure_id} warning={field.deleted_at && true}>
8
- {columns &&
9
- columns.map((column, key) => (
10
- <Table.Cell
11
- key={key}
12
- textAlign={column.textAlign}
13
- content={columnDecorator(column)(field)}
14
- />
15
- ))}
7
+ <Table.Row key={field.data_structure_id} warning={!!field.deleted_at}>
8
+ {columns
9
+ ? columns.map((column, key) => (
10
+ <Table.Cell
11
+ key={key}
12
+ textAlign={column.textAlign}
13
+ content={columnDecorator(column)(field)}
14
+ />
15
+ ))
16
+ : null}
16
17
  </Table.Row>
17
18
  );
18
19
 
19
20
  StructureFieldRow.propTypes = {
20
- columns: PropTypes.array
21
+ field: PropTypes.object.isRequired,
22
+ columns: PropTypes.array,
21
23
  };
22
24
 
23
25
  export default StructureFieldRow;
@@ -4,15 +4,15 @@ import PropTypes from "prop-types";
4
4
  import { connect } from "react-redux";
5
5
  import { Table } from "semantic-ui-react";
6
6
  import { FormattedMessage } from "react-intl";
7
+ import { columnPredicate } from "@truedat/core/services";
7
8
  import { getSortedFields, getStructureFieldColumns } from "../selectors";
8
9
  import StructureFieldRow from "./StructureFieldRow";
9
10
 
10
- const columnPredicate = c =>
11
- c === "links" ? _.flow(_.prop(c), _.negate(_.isEmpty)) : _.prop(c);
11
+ const columnPred = (c) =>
12
+ c?.name === "degree" ? _.prop("degree") : columnPredicate(c);
12
13
 
13
- const getColumns = (fieldsColumns, fields) => {
14
- return _.filter(p => _.any(columnPredicate(p.name))(fields))(fieldsColumns);
15
- };
14
+ const getColumns = (columns, fields) =>
15
+ _.filter((c) => _.any(columnPred(c))(fields))(columns);
16
16
 
17
17
  export const StructureFields = ({ columns, fields, ...rest }) => (
18
18
  <Table>
@@ -38,7 +38,7 @@ export const StructureFields = ({ columns, fields, ...rest }) => (
38
38
  StructureFields.propTypes = {
39
39
  columns: PropTypes.array,
40
40
  fields: PropTypes.array,
41
- version: PropTypes.string
41
+ version: PropTypes.string,
42
42
  };
43
43
 
44
44
  const mapStateToProps = (state, ownProps) => ({
@@ -48,7 +48,7 @@ const mapStateToProps = (state, ownProps) => ({
48
48
  columns: getColumns(
49
49
  _.propOr(getStructureFieldColumns(state), "columns")(ownProps),
50
50
  state.structureFields
51
- )
51
+ ),
52
52
  });
53
53
 
54
54
  export default connect(mapStateToProps)(StructureFields);
@@ -49,14 +49,14 @@ StructureItem.propTypes = {
49
49
 
50
50
  export const mapStateToProps = (
51
51
  { structure },
52
- { data_structure_id, id: structureId, type, name, published_note }
52
+ { data_structure_id, id: structureId, type, name, alias }
53
53
  ) => {
54
54
  const id = data_structure_id || structureId;
55
55
  return {
56
56
  id: id,
57
57
  active:
58
58
  type !== "system" && _.isFinite(id) && _.propEq("id", id)(structure),
59
- name: _.isEmpty(published_note?.alias) ? name : published_note.alias,
59
+ name: _.defaultTo(name)(alias),
60
60
  };
61
61
  };
62
62
 
@@ -55,7 +55,7 @@ export const StructureSummary = ({
55
55
  class: structureClass,
56
56
  classes: structureClasses,
57
57
  name,
58
- published_note,
58
+ alias,
59
59
  description,
60
60
  userPermissions,
61
61
  updatedAt,
@@ -75,13 +75,11 @@ export const StructureSummary = ({
75
75
  <Dimmer.Dimmable dimmed={linkedStructureTagsLoading}>
76
76
  <Header as="h2">
77
77
  <Header.Content>
78
- {_.isEmpty(published_note?.alias)
79
- ? name
80
- : published_note.alias}
78
+ {_.defaultTo(name)(alias)}
81
79
  {structureClasses?._grantable ? (
82
80
  <StructureGrantButton />
83
81
  ) : null}
84
- {!_.isEmpty(published_note?.alias) && (
82
+ {_.isEmpty(alias) ? null : (
85
83
  <Header.Subheader>{name}</Header.Subheader>
86
84
  )}
87
85
  </Header.Content>
@@ -120,7 +118,7 @@ StructureSummary.propTypes = {
120
118
  class: PropTypes.string,
121
119
  classes: PropTypes.object,
122
120
  name: PropTypes.string,
123
- published_note: PropTypes.object,
121
+ alias: PropTypes.string,
124
122
  description: PropTypes.string,
125
123
  userPermissions: PropTypes.object,
126
124
  updatedAt: PropTypes.string,
@@ -14,34 +14,39 @@ export const StructuresSearchResults = ({
14
14
  onSelect,
15
15
  selectedStructure,
16
16
  structures,
17
- loading
18
- }) =>
19
- !_.isEmpty(structures) || !_.isEmpty(selectedStructure) ? (
20
- <Dimmer.Dimmable dimmed={loading}>
21
- <StructuresLabelResults />
22
- <StructuresTable
23
- columns={columns}
24
- size={size}
25
- selectedStructure={selectedStructure}
26
- structures={structures}
27
- onStructureSelected={onSelect}
28
- />
29
- <StructuresPagination size={size} />
30
- <Dimmer inverted active={loading}>
31
- <Loader size="large" />
32
- </Dimmer>
33
- </Dimmer.Dimmable>
34
- ) : loading ? null : (
35
- <Message icon info>
36
- <Icon name="search" />
37
- <Message.Content>
38
- <Message.Header>
39
- <FormattedMessage id="structures.not_found.header" />
40
- </Message.Header>
41
- <FormattedMessage id="structures.not_found.body" />
42
- </Message.Content>
43
- </Message>
44
- );
17
+ loading,
18
+ }) => (
19
+ <Dimmer.Dimmable dimmed={loading}>
20
+ <Dimmer active={loading} inverted>
21
+ <Loader size="large" />
22
+ </Dimmer>
23
+ {!_.isEmpty(structures) || !_.isEmpty(selectedStructure) ? (
24
+ <>
25
+ <StructuresLabelResults />
26
+ <StructuresTable
27
+ columns={columns}
28
+ size={size}
29
+ selectedStructure={selectedStructure}
30
+ structures={structures}
31
+ onStructureSelected={onSelect}
32
+ />
33
+ <StructuresPagination size={size} />
34
+ </>
35
+ ) : (
36
+ <Message icon info>
37
+ <Icon name="search" />
38
+ <Message.Content>
39
+ <Message.Header>
40
+ <FormattedMessage
41
+ id={`structures.${loading ? "loading" : "not_found"}.header`}
42
+ />
43
+ </Message.Header>
44
+ {loading ? null : <FormattedMessage id="structures.not_found.body" />}
45
+ </Message.Content>
46
+ </Message>
47
+ )}
48
+ </Dimmer.Dimmable>
49
+ );
45
50
 
46
51
  StructuresSearchResults.propTypes = {
47
52
  columns: PropTypes.array,
@@ -49,7 +54,7 @@ StructuresSearchResults.propTypes = {
49
54
  onSelect: PropTypes.func,
50
55
  structures: PropTypes.array,
51
56
  selectedStructure: PropTypes.object,
52
- loading: PropTypes.bool
57
+ loading: PropTypes.bool,
53
58
  };
54
59
 
55
60
  export default StructuresSearchResults;
@@ -26,23 +26,21 @@ export const StructuresHeader = () => (
26
26
  </Header>
27
27
  );
28
28
 
29
- export const StructuresView = ({
29
+ const StructuresViewContent = ({
30
30
  actions = {},
31
31
  loading,
32
32
  structures,
33
33
  hasFilterApplied,
34
- systemsLoading,
34
+ embedded,
35
35
  }) => {
36
36
  const history = useHistory();
37
37
  return (
38
- <Segment loading={systemsLoading}>
39
- <StructuresHeader />
40
- <Divider hidden />
38
+ <>
41
39
  <StructuresOptions hasFilterApplied={hasFilterApplied} {...actions} />
42
40
  <StructuresSearch />
43
41
  <StructureSelectedFilters />
44
42
  <StructureDateFilter />
45
- {hasFilterApplied ? (
43
+ {hasFilterApplied || embedded ? (
46
44
  <StructuresSearchResults
47
45
  structures={structures}
48
46
  loading={loading}
@@ -51,6 +49,27 @@ export const StructuresView = ({
51
49
  ) : (
52
50
  <SystemCards />
53
51
  )}
52
+ </>
53
+ );
54
+ };
55
+
56
+ StructuresViewContent.propTypes = {
57
+ actions: PropTypes.object,
58
+ structures: PropTypes.array,
59
+ loading: PropTypes.bool,
60
+ hasFilterApplied: PropTypes.bool,
61
+ embedded: PropTypes.bool,
62
+ };
63
+
64
+ export const StructuresView = (props) => {
65
+ const { systemsLoading, embedded } = props;
66
+ return embedded ? (
67
+ <StructuresViewContent {...props} />
68
+ ) : (
69
+ <Segment loading={systemsLoading}>
70
+ <StructuresHeader />
71
+ <Divider hidden />
72
+ <StructuresViewContent {...props} />
54
73
  </Segment>
55
74
  );
56
75
  };
@@ -61,6 +80,7 @@ StructuresView.propTypes = {
61
80
  loading: PropTypes.bool,
62
81
  systemsLoading: PropTypes.bool,
63
82
  hasFilterApplied: PropTypes.bool,
83
+ embedded: PropTypes.bool,
64
84
  };
65
85
 
66
86
  const selectedFilters = ({ structureActiveFilters, structureDateFilter }) =>
@@ -71,13 +91,15 @@ const selectedFilters = ({ structureActiveFilters, structureDateFilter }) =>
71
91
 
72
92
  const isEmptyPath = (state, path) => _.flow(_.path(path), _.isEmpty)(state);
73
93
 
74
- const mapStateToProps = (state) => ({
75
- structures: structureRowsSelector(state),
76
- actions: state.structuresActions,
77
- loading: state.structuresLoading,
78
- systemsLoading: state.systemsLoading,
79
- hasFilterApplied:
80
- !isEmptyPath(state, "structureQuery.query") || selectedFilters(state),
81
- });
94
+ const mapStateToProps = (state) => {
95
+ return {
96
+ structures: structureRowsSelector(state),
97
+ actions: state.structuresActions,
98
+ loading: state.structuresLoading,
99
+ systemsLoading: state.systemsLoading,
100
+ hasFilterApplied:
101
+ !isEmptyPath(state, "structureQuery.query") || selectedFilters(state),
102
+ };
103
+ };
82
104
 
83
105
  export default connect(mapStateToProps)(StructuresView);
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { shallowWithIntl } from "@truedat/test/intl-stub";
2
+ import { render } from "@truedat/test/render";
3
3
  import { StructureFieldRow } from "../StructureFieldRow";
4
4
  import { defaultStructureFieldColumns } from "../../selectors/getStructureFieldColumns";
5
5
 
@@ -9,21 +9,30 @@ describe("<StructureFieldRow />", () => {
9
9
  data_structure_id: 1,
10
10
  name: "f1",
11
11
  description: "dd",
12
- type: "tp",
13
12
  structureId: 123,
14
- nullable: true,
15
- precision: "22",
16
13
  version: 12,
17
14
  links: [
18
15
  { business_concept_version_id: 1, name: "foo", resource_id: 1 },
19
- { business_concept_version_id: 2, name: "Bar", resource_id: 2 }
20
- ]
16
+ { business_concept_version_id: 2, name: "Bar", resource_id: 2 },
17
+ ],
18
+ metadata: {
19
+ type: "tp",
20
+ nullable: true,
21
+ precision: "22",
22
+ },
21
23
  };
22
24
 
23
- const wrapper = shallowWithIntl(
24
- <StructureFieldRow field={field} columns={defaultStructureFieldColumns} />
25
+ const { container } = render(
26
+ <table>
27
+ <tbody>
28
+ <StructureFieldRow
29
+ field={field}
30
+ columns={defaultStructureFieldColumns}
31
+ />
32
+ </tbody>
33
+ </table>
25
34
  );
26
- expect(wrapper).toMatchSnapshot();
35
+ expect(container).toMatchSnapshot();
27
36
  });
28
37
 
29
38
  it("row prints column fields", () => {
@@ -31,37 +40,32 @@ describe("<StructureFieldRow />", () => {
31
40
  data_structure_id: 1,
32
41
  name: "f1",
33
42
  description: "dd",
34
- type: "tp",
35
43
  structureId: 123,
36
- nullable: true,
37
- precision: "22",
38
44
  version: 12,
39
45
  links: [
40
46
  { business_concept_version_id: 1, name: "foo", resource_id: 1 },
41
- { business_concept_version_id: 2, name: "Bar", resource_id: 2 }
42
- ]
47
+ { business_concept_version_id: 2, name: "Bar", resource_id: 2 },
48
+ ],
49
+ metadata: {
50
+ nullable: true,
51
+ precision: "22",
52
+ type: "tp",
53
+ },
43
54
  };
44
55
 
45
- const wrapper = shallowWithIntl(
46
- <StructureFieldRow field={field} columns={defaultStructureFieldColumns} />
56
+ const { getAllByRole, getByText } = render(
57
+ <table>
58
+ <tbody>
59
+ <StructureFieldRow
60
+ field={field}
61
+ columns={defaultStructureFieldColumns}
62
+ />
63
+ </tbody>
64
+ </table>
47
65
  );
48
66
 
49
- expect(wrapper.find("TableCell")).toHaveLength(8);
50
-
51
- expect(
52
- wrapper
53
- .find("TableCell")
54
- .at(0)
55
- .dive()
56
- .find("Link")
57
- .props().children
58
- ).toEqual("f1");
59
-
60
- const links = wrapper
61
- .find("TableCell")
62
- .at(7)
63
- .dive()
64
- .find("Link");
65
- expect(links).toHaveLength(2);
67
+ expect(getAllByRole("cell")).toHaveLength(8);
68
+ expect(getByText("f1")).toBeDefined();
69
+ expect(getAllByRole("link")).toHaveLength(3);
66
70
  });
67
71
  });