@reltio/sources 1.4.1585 → 1.4.1586-mui5
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/index.ts +1 -0
- package/package.json +38 -21
- package/public/bundle.js +205 -0
- package/public/bundle.js.LICENSE.txt +79 -0
- package/public/package.json +22 -0
- package/scripts/build/index.js +20 -0
- package/src/components/CrosswalkTreeView/CrosswalkTreeView.tsx +47 -0
- package/src/components/CrosswalkTreeView/__tests__/CrosswalkTreeView.spec.tsx +72 -0
- package/src/components/CrosswalkTreeView/__tests__/helpers.spec.ts +961 -0
- package/src/components/CrosswalkTreeView/helpers.ts +91 -0
- package/src/components/CrosswalkTreeView/styles.ts +10 -0
- package/src/components/EmptyState/EmptyState.tsx +20 -0
- package/src/components/EmptyState/__tests__/EmptyState.test.tsx +13 -0
- package/src/components/EmptyState/icons/EmptySources.svg +43 -0
- package/src/components/EmptyState/styles.ts +19 -0
- package/src/components/LegendTable/LegendTable.tsx +124 -0
- package/src/components/LegendTable/LegendTableRow/ContributorRow/ContributorRow.tsx +46 -0
- package/src/components/LegendTable/LegendTableRow/ContributorRow/__tests__/ContributorRow.test.tsx +103 -0
- package/src/components/LegendTable/LegendTableRow/ContributorRow/styles.ts +31 -0
- package/src/components/LegendTable/LegendTableRow/LegendTableRow.tsx +179 -0
- package/src/components/LegendTable/LegendTableRow/__tests__/LegendTableRow.test.tsx +371 -0
- package/src/components/LegendTable/LegendTableRow/styles.ts +31 -0
- package/src/components/LegendTable/__tests__/LegendTable.test.tsx +273 -0
- package/src/components/LegendTable/__tests__/helpers.test.ts +541 -0
- package/src/components/LegendTable/helpers.ts +64 -0
- package/src/components/LegendTable/styles.ts +17 -0
- package/src/components/LegendView/LegendView.tsx +201 -0
- package/src/components/LegendView/__tests__/LegendView.test.tsx +307 -0
- package/src/components/LegendView/styles.ts +51 -0
- package/src/components/RightSidePanel/RightSidePanel.tsx +25 -0
- package/src/components/RightSidePanel/__tests__/RightSidePanel.test.tsx +28 -0
- package/src/components/RightSidePanel/styles.ts +14 -0
- package/src/components/RulesestsSelector/RulesestsSelector.tsx +31 -0
- package/src/components/RulesestsSelector/RulesetOption/RulesetOption.tsx +25 -0
- package/src/components/RulesestsSelector/RulesetOption/__tests__/RulesetOption.test.tsx +25 -0
- package/src/components/RulesestsSelector/RulesetOption/styles.ts +27 -0
- package/src/components/RulesestsSelector/RulesetsMenuList/RulesetsMenuList.tsx +14 -0
- package/src/components/RulesestsSelector/__tests__/RulesetsSelector.test.tsx +91 -0
- package/src/components/RulesestsSelector/styles.ts +7 -0
- package/src/components/SankeyChart/Link.tsx +31 -0
- package/src/components/SankeyChart/MergeTooltip.tsx +37 -0
- package/src/components/SankeyChart/Node.tsx +137 -0
- package/src/components/SankeyChart/SankeyChart.tsx +103 -0
- package/src/components/SankeyChart/__tests__/Link.spec.tsx +127 -0
- package/src/components/SankeyChart/__tests__/MergeTooltip.spec.tsx +22 -0
- package/src/components/SankeyChart/__tests__/Node.spec.tsx +248 -0
- package/src/components/SankeyChart/__tests__/SankeyChart.spec.tsx +161 -0
- package/src/components/SankeyChart/__tests__/__snapshots__/SankeyChart.spec.tsx.snap +183 -0
- package/src/components/SankeyChart/sankey.ts +322 -0
- package/src/components/SankeyChart/styles.ts +41 -0
- package/src/components/SankeyChart/useSankey.tsx +44 -0
- package/src/components/SelectableTree/SelectableTree.tsx +46 -0
- package/src/components/SelectableTree/__tests__/SelectableTree.test.tsx +28 -0
- package/src/components/SelectableTree/__tests__/__snapshots__/SelectableTree.test.tsx.snap +59 -0
- package/src/components/SelectableTree/styles.ts +42 -0
- package/src/components/SourcesView/SourcesView.tsx +318 -0
- package/src/components/SourcesView/__tests__/IntegrationSourcesView.spec.tsx +199 -0
- package/src/components/SourcesView/__tests__/SourcesView.spec.tsx +903 -0
- package/src/components/SourcesView/__tests__/data/metadata.data.ts +27 -0
- package/src/components/SourcesView/__tests__/data/store.data.ts +65 -0
- package/src/components/SourcesView/icons/LegendIcon.svg +8 -0
- package/src/components/SourcesView/index.tsx +57 -0
- package/src/components/SourcesView/styles.ts +44 -0
- package/src/components/TreeActionSnackbar/TreeActionSnackbar.tsx +38 -0
- package/src/components/TreeActionSnackbar/__tests__/TreeActionSnackbar.test.tsx +38 -0
- package/src/components/TreeActionSnackbar/styles.ts +11 -0
- package/src/components/UnmergeDialog/UnmergeDialog.tsx +78 -0
- package/src/components/UnmergeDialog/__tests__/UnmergeDialog.test.tsx +124 -0
- package/src/components/UnmergeDialog/__tests__/testData.data.ts +271 -0
- package/src/components/UnmergeDialog/styles.ts +34 -0
- package/src/components/UnsubscribeDialog/UnsubscribeDialog.tsx +64 -0
- package/src/components/UnsubscribeDialog/__tests__/UnsubscribeDialog.test.tsx +59 -0
- package/src/components/UnsubscribeDialog/styles.ts +31 -0
- package/src/hooks/__tests__/useCrosswalkTree.specs.tsx +68 -0
- package/src/hooks/__tests__/useCrosswalkTreeActions.specs.ts +110 -0
- package/src/hooks/__tests__/useCrosswalksDisplay.specs.tsx +213 -0
- package/src/hooks/__tests__/useEntityWithSurvivorshipGroups.specs.ts +160 -0
- package/src/hooks/useCrosswalkTree.ts +38 -0
- package/src/hooks/useCrosswalkTreeActions.ts +83 -0
- package/src/hooks/useCrosswalksDisplay.ts +110 -0
- package/src/hooks/useEntityWithSurvivorshipGroups.tsx +51 -0
- package/src/icons/notMatch.svg +14 -0
- package/src/index.ts +1 -0
- package/src/services/errors.ts +11 -0
- package/src/types/LegendMode.ts +5 -0
- package/src/types/SankeyChartData.ts +31 -0
- package/src/types/SourcesSavedState.ts +3 -0
- package/src/types/UnmergeContributorEvent.ts +7 -0
- package/src/types/UnsubscribeContributorEvent.ts +6 -0
- package/src/types/index.ts +4 -0
- package/tsconfig.json +4 -0
- package/webpack.config.js +10 -0
- package/bundle.js +0 -2
- package/bundle.js.LICENSE.txt +0 -42
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {render, screen} from '@testing-library/react';
|
|
3
|
+
import userEvent from '@testing-library/user-event';
|
|
4
|
+
import {Node} from '../Node';
|
|
5
|
+
import * as reltioComponents from '@reltio/components';
|
|
6
|
+
|
|
7
|
+
jest.mock('@reltio/components', () => ({
|
|
8
|
+
...jest.requireActual<Record<string, unknown>>('@reltio/components'),
|
|
9
|
+
useCrosswalkColor: jest.fn(),
|
|
10
|
+
useCrosswalkHighlight: jest.fn()
|
|
11
|
+
}));
|
|
12
|
+
|
|
13
|
+
describe('Sankey node', () => {
|
|
14
|
+
const highlightCrosswalk = jest.fn();
|
|
15
|
+
const removeHighlight = jest.fn();
|
|
16
|
+
let user;
|
|
17
|
+
beforeAll(() => {
|
|
18
|
+
jest.spyOn(reltioComponents, 'useCrosswalkColor').mockReturnValue('#FF0000');
|
|
19
|
+
jest.spyOn(reltioComponents, 'useCrosswalkHighlight').mockReturnValue({
|
|
20
|
+
isHighlighted: false,
|
|
21
|
+
isDimmed: false,
|
|
22
|
+
highlightCrosswalk,
|
|
23
|
+
removeHighlight
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
beforeEach(() => {
|
|
27
|
+
user = userEvent.setup({delay: null});
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const rootNodeProps = {
|
|
31
|
+
nodeWidth: 14,
|
|
32
|
+
node: {
|
|
33
|
+
x: 10,
|
|
34
|
+
y: 11,
|
|
35
|
+
label: 'testLabel',
|
|
36
|
+
entity: {uri: 'test1Uri', crosswalks: [], merges: []},
|
|
37
|
+
name: 'ROOT',
|
|
38
|
+
time: 1234
|
|
39
|
+
},
|
|
40
|
+
highlightEnabled: false,
|
|
41
|
+
isColored: false,
|
|
42
|
+
disableUnmerge: false,
|
|
43
|
+
isDragging: false,
|
|
44
|
+
onUnmerge: jest.fn()
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const nodeProps = {
|
|
48
|
+
nodeWidth: 14,
|
|
49
|
+
node: {
|
|
50
|
+
x: 10,
|
|
51
|
+
y: 11,
|
|
52
|
+
label: 'testLabel',
|
|
53
|
+
entity: {uri: 'test1Uri', crosswalks: [], merges: []},
|
|
54
|
+
name: 'testNode',
|
|
55
|
+
time: 1234
|
|
56
|
+
},
|
|
57
|
+
highlightEnabled: false,
|
|
58
|
+
isColored: false,
|
|
59
|
+
disableUnmerge: false,
|
|
60
|
+
isDragging: false,
|
|
61
|
+
onUnmerge: jest.fn()
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const nodeWithTargetProps = {
|
|
65
|
+
nodeWidth: 14,
|
|
66
|
+
node: {
|
|
67
|
+
x: 10,
|
|
68
|
+
y: 11,
|
|
69
|
+
label: 'testLabel',
|
|
70
|
+
entity: {uri: 'test1Uri', crosswalks: [], merges: [{user: 'testUser', time: 1234}]},
|
|
71
|
+
name: 'testNode',
|
|
72
|
+
time: 1234,
|
|
73
|
+
targetLinks: [
|
|
74
|
+
{
|
|
75
|
+
source: {
|
|
76
|
+
entity: {uri: 'test1Uri', crosswalks: [], merges: []},
|
|
77
|
+
name: 'testNode1',
|
|
78
|
+
time: 1234,
|
|
79
|
+
sourceLinks: [
|
|
80
|
+
{
|
|
81
|
+
ty: 0,
|
|
82
|
+
dy: 10,
|
|
83
|
+
value: 10,
|
|
84
|
+
source: {
|
|
85
|
+
entity: {uri: 'testUri', crosswalks: [], merges: []},
|
|
86
|
+
name: 'testNode',
|
|
87
|
+
time: 1234
|
|
88
|
+
},
|
|
89
|
+
target: {
|
|
90
|
+
entity: {uri: 'test1Uri', crosswalks: [], merges: []},
|
|
91
|
+
name: 'testNode1',
|
|
92
|
+
time: 1234
|
|
93
|
+
},
|
|
94
|
+
color: '#FF0000',
|
|
95
|
+
crosswalk: {
|
|
96
|
+
type: 'test',
|
|
97
|
+
uri: 'uri',
|
|
98
|
+
value: 'value'
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
},
|
|
103
|
+
value: 10,
|
|
104
|
+
target: {
|
|
105
|
+
entity: {uri: 'testUri', crosswalks: [], merges: []},
|
|
106
|
+
name: 'testNode',
|
|
107
|
+
time: 1234
|
|
108
|
+
},
|
|
109
|
+
color: '#FF0000',
|
|
110
|
+
crosswalk: {
|
|
111
|
+
type: 'test',
|
|
112
|
+
uri: 'uri',
|
|
113
|
+
value: 'value'
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
]
|
|
117
|
+
},
|
|
118
|
+
highlightEnabled: false,
|
|
119
|
+
isColored: false,
|
|
120
|
+
disableUnmerge: false,
|
|
121
|
+
isDragging: false,
|
|
122
|
+
onUnmerge: jest.fn()
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
it('should render node for ROOT node', () => {
|
|
126
|
+
const {asFragment} = render(<Node {...rootNodeProps} />);
|
|
127
|
+
expect(asFragment()).toMatchInlineSnapshot(`
|
|
128
|
+
<DocumentFragment>
|
|
129
|
+
<g
|
|
130
|
+
transform="translate(10,11)"
|
|
131
|
+
>
|
|
132
|
+
<text
|
|
133
|
+
class="rootNode"
|
|
134
|
+
dx="0"
|
|
135
|
+
dy="-5"
|
|
136
|
+
>
|
|
137
|
+
testLabel
|
|
138
|
+
</text>
|
|
139
|
+
</g>
|
|
140
|
+
</DocumentFragment>
|
|
141
|
+
`);
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
it('should render node without targetLinks', async () => {
|
|
145
|
+
const {asFragment} = render(<Node {...nodeProps} />);
|
|
146
|
+
expect(asFragment()).toMatchInlineSnapshot(`
|
|
147
|
+
<DocumentFragment>
|
|
148
|
+
<g
|
|
149
|
+
transform="translate(10,11)"
|
|
150
|
+
>
|
|
151
|
+
<rect
|
|
152
|
+
class="node"
|
|
153
|
+
cursor="pointer"
|
|
154
|
+
data-reltio-id="reltio-sankey-chart-node"
|
|
155
|
+
fill="#F0F0F0"
|
|
156
|
+
height="0"
|
|
157
|
+
opacity="1"
|
|
158
|
+
width="14"
|
|
159
|
+
/>
|
|
160
|
+
</g>
|
|
161
|
+
</DocumentFragment>
|
|
162
|
+
`);
|
|
163
|
+
|
|
164
|
+
const rect = screen.getByTestId('reltio-sankey-chart-node');
|
|
165
|
+
await user.hover(rect);
|
|
166
|
+
expect(highlightCrosswalk).toBeCalledTimes(0);
|
|
167
|
+
await user.unhover(rect);
|
|
168
|
+
expect(removeHighlight).toBeCalledTimes(0);
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
it('should render node with targetLinks', async () => {
|
|
172
|
+
const {container, asFragment} = render(<Node {...nodeWithTargetProps} />);
|
|
173
|
+
expect(asFragment()).toMatchInlineSnapshot(`
|
|
174
|
+
<DocumentFragment>
|
|
175
|
+
<g
|
|
176
|
+
transform="translate(10,11)"
|
|
177
|
+
>
|
|
178
|
+
<rect
|
|
179
|
+
class="node"
|
|
180
|
+
cursor="pointer"
|
|
181
|
+
data-reltio-id="reltio-sankey-chart-node"
|
|
182
|
+
fill="#F0F0F0"
|
|
183
|
+
height="0"
|
|
184
|
+
opacity="1"
|
|
185
|
+
width="14"
|
|
186
|
+
/>
|
|
187
|
+
<rect
|
|
188
|
+
class="node"
|
|
189
|
+
data-mui-internal-clone-element="true"
|
|
190
|
+
fill="#F0F0F0"
|
|
191
|
+
fill-opacity="0.54"
|
|
192
|
+
height="10"
|
|
193
|
+
opacity="1"
|
|
194
|
+
transform="translate(0,0)"
|
|
195
|
+
width="14"
|
|
196
|
+
/>
|
|
197
|
+
</g>
|
|
198
|
+
</DocumentFragment>
|
|
199
|
+
`);
|
|
200
|
+
const rect = container.getElementsByTagName('rect')[1];
|
|
201
|
+
await user.hover(rect);
|
|
202
|
+
await screen.findByRole('tooltip');
|
|
203
|
+
expect(screen.getByText('testUser')).toBeInTheDocument();
|
|
204
|
+
expect(screen.getByText('Merge details')).toBeInTheDocument();
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
it('should render nodes when highlightEnabled=true and isDimmed', async () => {
|
|
208
|
+
jest.spyOn(reltioComponents, 'useCrosswalkHighlight').mockReturnValue({
|
|
209
|
+
isHighlighted: false,
|
|
210
|
+
isDimmed: true,
|
|
211
|
+
highlightCrosswalk,
|
|
212
|
+
removeHighlight
|
|
213
|
+
});
|
|
214
|
+
const {asFragment} = render(<Node {...nodeWithTargetProps} highlightEnabled={true} />);
|
|
215
|
+
expect(asFragment()).toMatchInlineSnapshot(`
|
|
216
|
+
<DocumentFragment>
|
|
217
|
+
<g
|
|
218
|
+
transform="translate(10,11)"
|
|
219
|
+
>
|
|
220
|
+
<rect
|
|
221
|
+
class="node"
|
|
222
|
+
cursor="pointer"
|
|
223
|
+
data-reltio-id="reltio-sankey-chart-node"
|
|
224
|
+
fill="#F0F0F0"
|
|
225
|
+
height="0"
|
|
226
|
+
opacity="0.19"
|
|
227
|
+
width="14"
|
|
228
|
+
/>
|
|
229
|
+
<rect
|
|
230
|
+
class="node"
|
|
231
|
+
data-mui-internal-clone-element="true"
|
|
232
|
+
fill="#F0F0F0"
|
|
233
|
+
fill-opacity="0.54"
|
|
234
|
+
height="10"
|
|
235
|
+
opacity="0.38"
|
|
236
|
+
transform="translate(0,0)"
|
|
237
|
+
width="14"
|
|
238
|
+
/>
|
|
239
|
+
</g>
|
|
240
|
+
</DocumentFragment>
|
|
241
|
+
`);
|
|
242
|
+
const rect = screen.getByTestId('reltio-sankey-chart-node');
|
|
243
|
+
await user.hover(rect);
|
|
244
|
+
expect(highlightCrosswalk).toBeCalledTimes(1);
|
|
245
|
+
await user.unhover(rect);
|
|
246
|
+
expect(removeHighlight).toBeCalledTimes(1);
|
|
247
|
+
});
|
|
248
|
+
});
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {render} from '@testing-library/react';
|
|
3
|
+
import {deepFreeze} from '../../../../../../__mocks__/test-utils';
|
|
4
|
+
import SankeyChart from '../SankeyChart';
|
|
5
|
+
|
|
6
|
+
describe('SankeyChart', () => {
|
|
7
|
+
const crosswalks = [
|
|
8
|
+
{
|
|
9
|
+
uri: 'entities/1O8x1gO0/crosswalks/2rinpYq8x',
|
|
10
|
+
type: 'configuration/sources/Reltio',
|
|
11
|
+
ownerType: 'entity',
|
|
12
|
+
value: '1u04ksx9',
|
|
13
|
+
uuid: 2
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
uri: 'entities/1O8x1gO0/crosswalks/2gghyKRrU',
|
|
17
|
+
type: 'configuration/sources/Reltio',
|
|
18
|
+
ownerType: 'entity',
|
|
19
|
+
value: '1O8x1gO0',
|
|
20
|
+
uuid: 1
|
|
21
|
+
}
|
|
22
|
+
];
|
|
23
|
+
const nodes = [
|
|
24
|
+
{
|
|
25
|
+
entity: {
|
|
26
|
+
uri: 'ROOT',
|
|
27
|
+
label: 'FirdtName IO error 2',
|
|
28
|
+
crosswalks: [],
|
|
29
|
+
merges: [
|
|
30
|
+
{
|
|
31
|
+
time: 0,
|
|
32
|
+
losers: [
|
|
33
|
+
{
|
|
34
|
+
merges: [
|
|
35
|
+
{
|
|
36
|
+
time: 1619116318362,
|
|
37
|
+
mergeReason: 'Merge by hand',
|
|
38
|
+
mergeRules: '',
|
|
39
|
+
user: 'carina.alabanza@reltio.com',
|
|
40
|
+
losers: [
|
|
41
|
+
{
|
|
42
|
+
uri: 'entities/1u04ksx9',
|
|
43
|
+
crosswalks: [crosswalks[0]]
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
uri: 'entities/1O8x1gO0',
|
|
49
|
+
crosswalks: [crosswalks[1]]
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
name: 'ROOT',
|
|
56
|
+
time: 1629801843217,
|
|
57
|
+
label: 'FirdtName IO error 2'
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
entity: {
|
|
61
|
+
merges: [
|
|
62
|
+
{
|
|
63
|
+
time: 1619116318362,
|
|
64
|
+
mergeReason: 'Merge by hand',
|
|
65
|
+
mergeRules: '',
|
|
66
|
+
user: 'carina.alabanza@reltio.com',
|
|
67
|
+
losers: [
|
|
68
|
+
{
|
|
69
|
+
uri: 'entities/1u04ksx9',
|
|
70
|
+
crosswalks: [crosswalks[0]]
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
uri: 'entities/1O8x1gO0',
|
|
76
|
+
crosswalks: [crosswalks[1]]
|
|
77
|
+
},
|
|
78
|
+
name: 'entities/1O8x1gO0',
|
|
79
|
+
time: 0
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
entity: {
|
|
83
|
+
uri: 'entities/1u04ksx9',
|
|
84
|
+
crosswalks: [crosswalks[2]]
|
|
85
|
+
},
|
|
86
|
+
name: 'entities/1u04ksx9',
|
|
87
|
+
time: 1619116318362
|
|
88
|
+
}
|
|
89
|
+
];
|
|
90
|
+
|
|
91
|
+
const links = [
|
|
92
|
+
{
|
|
93
|
+
source: nodes[2],
|
|
94
|
+
target: nodes[1],
|
|
95
|
+
value: 10,
|
|
96
|
+
crosswalk: crosswalks[0],
|
|
97
|
+
color: '#e996e3'
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
source: nodes[1],
|
|
101
|
+
target: nodes[0],
|
|
102
|
+
value: 10,
|
|
103
|
+
crosswalk: crosswalks[1],
|
|
104
|
+
color: '#e9d896'
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
source: nodes[1],
|
|
108
|
+
target: nodes[0],
|
|
109
|
+
value: 10,
|
|
110
|
+
crosswalk: crosswalks[0],
|
|
111
|
+
color: '#e996e3'
|
|
112
|
+
}
|
|
113
|
+
];
|
|
114
|
+
|
|
115
|
+
const data = {
|
|
116
|
+
nodes,
|
|
117
|
+
links
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
const props = {
|
|
121
|
+
data,
|
|
122
|
+
width: 600,
|
|
123
|
+
height: 300,
|
|
124
|
+
accentContributors: false,
|
|
125
|
+
disableUnmerge: false,
|
|
126
|
+
onUnmerge: jest.fn()
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
deepFreeze(data);
|
|
130
|
+
|
|
131
|
+
it('should render SankeyChart', () => {
|
|
132
|
+
const {asFragment} = render(<SankeyChart {...props} />);
|
|
133
|
+
expect(asFragment()).toMatchSnapshot();
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
it('should color nodes when accentContributors = true', () => {
|
|
137
|
+
const {asFragment} = render(<SankeyChart {...props} accentContributors={true} />);
|
|
138
|
+
expect(asFragment()).toMatchSnapshot();
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
it('should not render SankeyChart if data is empty', () => {
|
|
142
|
+
const {asFragment} = render(<SankeyChart {...props} data={{nodes: [], links: []}} />);
|
|
143
|
+
expect(asFragment()).toMatchInlineSnapshot(`
|
|
144
|
+
<DocumentFragment>
|
|
145
|
+
<svg
|
|
146
|
+
cursor="auto"
|
|
147
|
+
height="300"
|
|
148
|
+
width="600"
|
|
149
|
+
>
|
|
150
|
+
<g
|
|
151
|
+
pointer-events="auto"
|
|
152
|
+
transform="translate(0,299) rotate(-90)"
|
|
153
|
+
>
|
|
154
|
+
<g />
|
|
155
|
+
<g />
|
|
156
|
+
</g>
|
|
157
|
+
</svg>
|
|
158
|
+
</DocumentFragment>
|
|
159
|
+
`);
|
|
160
|
+
});
|
|
161
|
+
});
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`SankeyChart should color nodes when accentContributors = true 1`] = `
|
|
4
|
+
<DocumentFragment>
|
|
5
|
+
<svg
|
|
6
|
+
cursor="auto"
|
|
7
|
+
height="300"
|
|
8
|
+
width="600"
|
|
9
|
+
>
|
|
10
|
+
<g
|
|
11
|
+
pointer-events="auto"
|
|
12
|
+
transform="translate(0,299) rotate(-90)"
|
|
13
|
+
>
|
|
14
|
+
<g>
|
|
15
|
+
<path
|
|
16
|
+
d="M14,298.87
|
|
17
|
+
L248,298.87L262,298.87 L262,314.13
|
|
18
|
+
L248,314.13
|
|
19
|
+
L14,314.13 Z"
|
|
20
|
+
fill="#F0F0F0"
|
|
21
|
+
opacity="1"
|
|
22
|
+
/>
|
|
23
|
+
<path
|
|
24
|
+
d="M262,283.87
|
|
25
|
+
L284,283.87
|
|
26
|
+
L284,299.13
|
|
27
|
+
L262,299.13 Z"
|
|
28
|
+
fill="#F0F0F0"
|
|
29
|
+
opacity="1"
|
|
30
|
+
/>
|
|
31
|
+
<path
|
|
32
|
+
d="M262,298.87
|
|
33
|
+
L284,298.87
|
|
34
|
+
L284,314.13
|
|
35
|
+
L262,314.13 Z"
|
|
36
|
+
fill="#F0F0F0"
|
|
37
|
+
opacity="1"
|
|
38
|
+
/>
|
|
39
|
+
</g>
|
|
40
|
+
<g>
|
|
41
|
+
<g
|
|
42
|
+
transform="translate(284,284)"
|
|
43
|
+
>
|
|
44
|
+
<text
|
|
45
|
+
class="rootNode"
|
|
46
|
+
dx="0"
|
|
47
|
+
dy="-5"
|
|
48
|
+
>
|
|
49
|
+
FirdtName IO error 2
|
|
50
|
+
</text>
|
|
51
|
+
</g>
|
|
52
|
+
<g
|
|
53
|
+
transform="translate(248,284)"
|
|
54
|
+
>
|
|
55
|
+
<rect
|
|
56
|
+
class="node"
|
|
57
|
+
cursor="pointer"
|
|
58
|
+
data-reltio-id="reltio-sankey-chart-node"
|
|
59
|
+
fill="hsl(34, 66%, 81%)"
|
|
60
|
+
height="15"
|
|
61
|
+
opacity="1"
|
|
62
|
+
width="14"
|
|
63
|
+
/>
|
|
64
|
+
<rect
|
|
65
|
+
class="node"
|
|
66
|
+
data-mui-internal-clone-element="true"
|
|
67
|
+
fill="#F0F0F0"
|
|
68
|
+
fill-opacity="0.54"
|
|
69
|
+
height="15"
|
|
70
|
+
opacity="1"
|
|
71
|
+
transform="translate(0,15)"
|
|
72
|
+
width="14"
|
|
73
|
+
/>
|
|
74
|
+
</g>
|
|
75
|
+
<g
|
|
76
|
+
transform="translate(0,299)"
|
|
77
|
+
>
|
|
78
|
+
<rect
|
|
79
|
+
class="node"
|
|
80
|
+
cursor="pointer"
|
|
81
|
+
data-reltio-id="reltio-sankey-chart-node"
|
|
82
|
+
fill=""
|
|
83
|
+
height="15"
|
|
84
|
+
opacity="1"
|
|
85
|
+
width="14"
|
|
86
|
+
/>
|
|
87
|
+
</g>
|
|
88
|
+
</g>
|
|
89
|
+
</g>
|
|
90
|
+
</svg>
|
|
91
|
+
</DocumentFragment>
|
|
92
|
+
`;
|
|
93
|
+
|
|
94
|
+
exports[`SankeyChart should render SankeyChart 1`] = `
|
|
95
|
+
<DocumentFragment>
|
|
96
|
+
<svg
|
|
97
|
+
cursor="auto"
|
|
98
|
+
height="300"
|
|
99
|
+
width="600"
|
|
100
|
+
>
|
|
101
|
+
<g
|
|
102
|
+
pointer-events="auto"
|
|
103
|
+
transform="translate(0,299) rotate(-90)"
|
|
104
|
+
>
|
|
105
|
+
<g>
|
|
106
|
+
<path
|
|
107
|
+
d="M14,298.87
|
|
108
|
+
L248,298.87L262,298.87 L262,314.13
|
|
109
|
+
L248,314.13
|
|
110
|
+
L14,314.13 Z"
|
|
111
|
+
fill="hsl(142, 50%, 63%)"
|
|
112
|
+
opacity="1"
|
|
113
|
+
/>
|
|
114
|
+
<path
|
|
115
|
+
d="M262,283.87
|
|
116
|
+
L284,283.87
|
|
117
|
+
L284,299.13
|
|
118
|
+
L262,299.13 Z"
|
|
119
|
+
fill="hsl(34, 66%, 81%)"
|
|
120
|
+
opacity="1"
|
|
121
|
+
/>
|
|
122
|
+
<path
|
|
123
|
+
d="M262,298.87
|
|
124
|
+
L284,298.87
|
|
125
|
+
L284,314.13
|
|
126
|
+
L262,314.13 Z"
|
|
127
|
+
fill="hsl(142, 50%, 63%)"
|
|
128
|
+
opacity="1"
|
|
129
|
+
/>
|
|
130
|
+
</g>
|
|
131
|
+
<g>
|
|
132
|
+
<g
|
|
133
|
+
transform="translate(284,284)"
|
|
134
|
+
>
|
|
135
|
+
<text
|
|
136
|
+
class="rootNode"
|
|
137
|
+
dx="0"
|
|
138
|
+
dy="-5"
|
|
139
|
+
>
|
|
140
|
+
FirdtName IO error 2
|
|
141
|
+
</text>
|
|
142
|
+
</g>
|
|
143
|
+
<g
|
|
144
|
+
transform="translate(248,284)"
|
|
145
|
+
>
|
|
146
|
+
<rect
|
|
147
|
+
class="node"
|
|
148
|
+
cursor="pointer"
|
|
149
|
+
data-reltio-id="reltio-sankey-chart-node"
|
|
150
|
+
fill="#F0F0F0"
|
|
151
|
+
height="15"
|
|
152
|
+
opacity="1"
|
|
153
|
+
width="14"
|
|
154
|
+
/>
|
|
155
|
+
<rect
|
|
156
|
+
class="node"
|
|
157
|
+
data-mui-internal-clone-element="true"
|
|
158
|
+
fill="#F0F0F0"
|
|
159
|
+
fill-opacity="0.54"
|
|
160
|
+
height="15"
|
|
161
|
+
opacity="1"
|
|
162
|
+
transform="translate(0,15)"
|
|
163
|
+
width="14"
|
|
164
|
+
/>
|
|
165
|
+
</g>
|
|
166
|
+
<g
|
|
167
|
+
transform="translate(0,299)"
|
|
168
|
+
>
|
|
169
|
+
<rect
|
|
170
|
+
class="node"
|
|
171
|
+
cursor="pointer"
|
|
172
|
+
data-reltio-id="reltio-sankey-chart-node"
|
|
173
|
+
fill="#F0F0F0"
|
|
174
|
+
height="15"
|
|
175
|
+
opacity="1"
|
|
176
|
+
width="14"
|
|
177
|
+
/>
|
|
178
|
+
</g>
|
|
179
|
+
</g>
|
|
180
|
+
</g>
|
|
181
|
+
</svg>
|
|
182
|
+
</DocumentFragment>
|
|
183
|
+
`;
|