@availity/page-header 11.0.9 → 11.0.13-link.1
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/CHANGELOG.md +24 -0
- package/index.d.ts +2 -3
- package/index.js +1 -3
- package/package.json +13 -16
- package/{PageHeader.js → src/PageHeader.js} +5 -25
- package/tsconfig.json +26 -26
- package/{PageHeader.d.ts → types/PageHeader.d.ts} +3 -6
- package/tests/PageHeader.test.js +0 -356
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,30 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [11.0.12](https://github.com/Availity/availity-react/compare/@availity/page-header@11.0.11...@availity/page-header@11.0.12) (2021-10-01)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @availity/page-header
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [11.0.11](https://github.com/Availity/availity-react/compare/@availity/page-header@11.0.10...@availity/page-header@11.0.11) (2021-09-28)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @availity/page-header
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [11.0.10](https://github.com/Availity/availity-react/compare/@availity/page-header@11.0.9...@availity/page-header@11.0.10) (2021-09-27)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @availity/page-header
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
6
30
|
## [11.0.9](https://github.com/Availity/availity-react/compare/@availity/page-header@11.0.8...@availity/page-header@11.0.9) (2021-09-23)
|
|
7
31
|
|
|
8
32
|
**Note:** Version bump only for package @availity/page-header
|
package/index.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export default PageHeader;
|
|
1
|
+
export { default } from './types/PageHeader';
|
|
2
|
+
export * from './types/PageHeader';
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@availity/page-header",
|
|
3
|
-
"version": "11.0.
|
|
3
|
+
"version": "11.0.13-link.1+0da033cc",
|
|
4
4
|
"author": "Evan Sharp <evan.sharp@availity.com>",
|
|
5
5
|
"description": "The standard page header for Availity Portal Applications",
|
|
6
6
|
"main": "index.js",
|
|
7
|
+
"types": "index.d.ts",
|
|
7
8
|
"keywords": [
|
|
8
9
|
"react",
|
|
9
10
|
"availity"
|
|
@@ -20,19 +21,17 @@
|
|
|
20
21
|
"access": "public"
|
|
21
22
|
},
|
|
22
23
|
"dependencies": {
|
|
23
|
-
"@availity/app-icon": "^1.3.
|
|
24
|
-
"@availity/breadcrumbs": "^3.1.
|
|
25
|
-
"@availity/feedback": "^6.0.
|
|
26
|
-
"@availity/payer-logo": "^5.0.
|
|
27
|
-
"@availity/training-link": "^1.3.0",
|
|
24
|
+
"@availity/app-icon": "^1.3.24",
|
|
25
|
+
"@availity/breadcrumbs": "^3.1.25",
|
|
26
|
+
"@availity/feedback": "^6.0.8",
|
|
27
|
+
"@availity/payer-logo": "^5.0.2",
|
|
28
28
|
"classnames": "^2.3.1",
|
|
29
29
|
"prop-types": "^15.7.2"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@availity/api-axios": "^
|
|
33
|
-
"@availity/
|
|
34
|
-
"@availity/
|
|
35
|
-
"@availity/spaces": "^5.0.1",
|
|
32
|
+
"@availity/api-axios": "^6.0.0",
|
|
33
|
+
"@availity/spaces": "^5.0.4-link.1+0da033cc",
|
|
34
|
+
"@availity/training-link": "^1.3.1",
|
|
36
35
|
"axios": "^0.21.1",
|
|
37
36
|
"formik": "^2.2.8",
|
|
38
37
|
"react": "^17.0.2",
|
|
@@ -40,15 +39,13 @@
|
|
|
40
39
|
"yup": "^0.30.0"
|
|
41
40
|
},
|
|
42
41
|
"peerDependencies": {
|
|
43
|
-
"@availity/api-axios": "^
|
|
44
|
-
"@availity/
|
|
45
|
-
"
|
|
46
|
-
"@availity/spaces": "^4.0.1",
|
|
47
|
-
"axios": "^0.19.0",
|
|
42
|
+
"@availity/api-axios": "^6.0.0",
|
|
43
|
+
"@availity/spaces": "^4.0.1 || ^5.0.0",
|
|
44
|
+
"axios": "^0.21.1",
|
|
48
45
|
"formik": "^2.0.1",
|
|
49
46
|
"react": ">=16.11.0",
|
|
50
47
|
"react-dom": ">=16.11.0",
|
|
51
48
|
"yup": "^0.27.0"
|
|
52
49
|
},
|
|
53
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "0da033cc85718b26fe6915370269c10f11b7b925"
|
|
54
51
|
}
|
|
@@ -4,11 +4,7 @@ import classNames from 'classnames';
|
|
|
4
4
|
import Breadcrumbs from '@availity/breadcrumbs';
|
|
5
5
|
import AppIcon from '@availity/app-icon';
|
|
6
6
|
import Feedback from '@availity/feedback';
|
|
7
|
-
import Spaces, {
|
|
8
|
-
SpacesLogo,
|
|
9
|
-
useSpaces,
|
|
10
|
-
useSpacesContext,
|
|
11
|
-
} from '@availity/spaces';
|
|
7
|
+
import Spaces, { SpacesLogo, useSpaces, useSpacesContext } from '@availity/spaces';
|
|
12
8
|
|
|
13
9
|
const PageHeader = ({
|
|
14
10
|
payerId,
|
|
@@ -57,11 +53,7 @@ const PageHeader = ({
|
|
|
57
53
|
spaceForPayerID || (logo && spaceForSpaceID) || spacesIsLoading ? (
|
|
58
54
|
<SpacesLogo {...logoAttrs} />
|
|
59
55
|
) : (
|
|
60
|
-
<Spaces
|
|
61
|
-
spaceIds={spaceId ? [spaceId] : undefined}
|
|
62
|
-
payerIds={[payerId]}
|
|
63
|
-
clientId={clientId}
|
|
64
|
-
>
|
|
56
|
+
<Spaces spaceIds={spaceId ? [spaceId] : undefined} payerIds={[payerId]} clientId={clientId}>
|
|
65
57
|
<SpacesLogo {...logoAttrs} />
|
|
66
58
|
</Spaces>
|
|
67
59
|
);
|
|
@@ -95,12 +87,7 @@ const PageHeader = ({
|
|
|
95
87
|
{React.isValidElement(crumbs) ? (
|
|
96
88
|
crumbs
|
|
97
89
|
) : (
|
|
98
|
-
<Breadcrumbs
|
|
99
|
-
crumbs={crumbs}
|
|
100
|
-
active={appName || children}
|
|
101
|
-
homeUrl={homeUrl}
|
|
102
|
-
linkTag={linkTag}
|
|
103
|
-
/>
|
|
90
|
+
<Breadcrumbs crumbs={crumbs} active={appName || children} homeUrl={homeUrl} linkTag={linkTag} />
|
|
104
91
|
)}
|
|
105
92
|
</>
|
|
106
93
|
) : null}
|
|
@@ -115,10 +102,7 @@ const PageHeader = ({
|
|
|
115
102
|
{...props}
|
|
116
103
|
>
|
|
117
104
|
<Tag
|
|
118
|
-
className={classNames(
|
|
119
|
-
'page-header-title page-header-left d-flex align-items-center mb-0',
|
|
120
|
-
titleClassName
|
|
121
|
-
)}
|
|
105
|
+
className={classNames('page-header-title page-header-left d-flex align-items-center mb-0', titleClassName)}
|
|
122
106
|
data-testid="page-header-title"
|
|
123
107
|
{...restTitleProps}
|
|
124
108
|
>
|
|
@@ -143,11 +127,7 @@ const PageHeader = ({
|
|
|
143
127
|
{payerLogo}
|
|
144
128
|
</div>
|
|
145
129
|
) : (
|
|
146
|
-
<RenderRightContent
|
|
147
|
-
className={renderRightClassName}
|
|
148
|
-
payerLogo={payerLogo}
|
|
149
|
-
feedback={feedback}
|
|
150
|
-
/>
|
|
130
|
+
<RenderRightContent className={renderRightClassName} payerLogo={payerLogo} feedback={feedback} />
|
|
151
131
|
)}
|
|
152
132
|
</div>
|
|
153
133
|
</>
|
package/tsconfig.json
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"outDir": "build/lib",
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"target": "es5",
|
|
6
|
+
"lib": ["es5", "es6", "es7", "es2017", "dom"],
|
|
7
|
+
"sourceMap": true,
|
|
8
|
+
"allowJs": false,
|
|
9
|
+
"jsx": "react",
|
|
10
|
+
"moduleResolution": "node",
|
|
11
|
+
"rootDirs": ["./"],
|
|
12
|
+
"baseUrl": "",
|
|
13
|
+
"forceConsistentCasingInFileNames": true,
|
|
14
|
+
"noImplicitReturns": true,
|
|
15
|
+
"noImplicitThis": true,
|
|
16
|
+
"noImplicitAny": true,
|
|
17
|
+
"strictNullChecks": true,
|
|
18
|
+
"suppressImplicitAnyIndexErrors": true,
|
|
19
|
+
"noUnusedLocals": true,
|
|
20
|
+
"declaration": true,
|
|
21
|
+
"allowSyntheticDefaultImports": true,
|
|
22
|
+
"experimentalDecorators": true,
|
|
23
|
+
"emitDecoratorMetadata": true
|
|
24
|
+
},
|
|
25
|
+
"include": ["**/*"],
|
|
26
|
+
"exclude": ["node_modules", "build", "scripts"]
|
|
27
|
+
}
|
|
@@ -20,12 +20,9 @@ export interface PageHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
20
20
|
feedback?: boolean;
|
|
21
21
|
feedbackProps?: any;
|
|
22
22
|
logo?: boolean;
|
|
23
|
-
linkTag?:
|
|
24
|
-
| React.ComponentType<React.HTMLAttributes<HTMLAnchorElement>>
|
|
25
|
-
| string;
|
|
23
|
+
linkTag?: React.ComponentType<React.HTMLAttributes<HTMLAnchorElement>> | string;
|
|
26
24
|
titleProps?: React.HTMLAttributes<HTMLDivElement>;
|
|
27
|
-
renderRightContent?: React.
|
|
28
|
-
children?: React.ReactNode;
|
|
25
|
+
renderRightContent?: React.FC<RightContentProps>;
|
|
29
26
|
crumbs?: CrumbType[] | React.ReactNode;
|
|
30
27
|
iconSrc?: string;
|
|
31
28
|
iconAlt?: string;
|
|
@@ -34,6 +31,6 @@ export interface PageHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
34
31
|
showCrumbs?: boolean;
|
|
35
32
|
}
|
|
36
33
|
|
|
37
|
-
declare const PageHeader: React.
|
|
34
|
+
declare const PageHeader: React.FC<PageHeaderProps>;
|
|
38
35
|
|
|
39
36
|
export default PageHeader;
|
package/tests/PageHeader.test.js
DELETED
|
@@ -1,356 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render, cleanup, waitFor } from '@testing-library/react';
|
|
3
|
-
import TrainingLink from '@availity/training-link';
|
|
4
|
-
import { avWebQLApi } from '@availity/api-axios';
|
|
5
|
-
import { NavLink } from 'reactstrap';
|
|
6
|
-
import Spaces from '@availity/spaces';
|
|
7
|
-
import PageHeader from '..';
|
|
8
|
-
|
|
9
|
-
jest.mock('@availity/api-axios');
|
|
10
|
-
|
|
11
|
-
afterEach(() => {
|
|
12
|
-
jest.clearAllMocks();
|
|
13
|
-
cleanup();
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
describe('PageHeader', () => {
|
|
17
|
-
test('should render', () => {
|
|
18
|
-
const { getByTestId } = render(<PageHeader appName="Payer Space" />);
|
|
19
|
-
|
|
20
|
-
const pageHeaderTitle = getByTestId('page-header-title');
|
|
21
|
-
|
|
22
|
-
expect(pageHeaderTitle.textContent).toEqual('Payer Space');
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
test('should render app icon', () => {
|
|
26
|
-
const { getByText } = render(
|
|
27
|
-
<PageHeader appName="Payer Space" appAbbr="PS" />
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
const icon = getByText('PS');
|
|
31
|
-
expect(icon).toBeDefined();
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
test('should add custom class name', () => {
|
|
35
|
-
const { getByTestId } = render(
|
|
36
|
-
<PageHeader appName="Payer Space" className="custom-classname" />
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
const pageHeader = getByTestId('page-header');
|
|
40
|
-
|
|
41
|
-
expect(pageHeader.className).toContain('custom-classname');
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
test('should render app icon color', () => {
|
|
45
|
-
const { getByTestId } = render(
|
|
46
|
-
<PageHeader appName="Payer Space" appAbbr="PS" iconColor="green" />
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
const appIcon = getByTestId('page-header-app-icon');
|
|
50
|
-
|
|
51
|
-
expect(appIcon.className).toContain('icon-green');
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
test('should render app icon color branded', () => {
|
|
55
|
-
const { getByTestId } = render(
|
|
56
|
-
<PageHeader
|
|
57
|
-
appName="Payer Space"
|
|
58
|
-
appAbbr="PS"
|
|
59
|
-
iconColor="green"
|
|
60
|
-
branded
|
|
61
|
-
/>
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
const appIcon = getByTestId('page-header-app-icon');
|
|
65
|
-
|
|
66
|
-
expect(appIcon.className).toContain('icon-branded');
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
test('should render feedback', () => {
|
|
70
|
-
const { getByTestId } = render(
|
|
71
|
-
<PageHeader appName="Payer Space" feedback />
|
|
72
|
-
);
|
|
73
|
-
|
|
74
|
-
expect(getByTestId('face-options')).toBeDefined();
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
test('should render children', () => {
|
|
78
|
-
const { getByText } = render(
|
|
79
|
-
<PageHeader appName="Payer Space">this is cool</PageHeader>
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
const children = getByText('this is cool');
|
|
83
|
-
expect(children).toBeDefined();
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
test('should render trainingLink', () => {
|
|
87
|
-
const { getByText } = render(
|
|
88
|
-
<PageHeader
|
|
89
|
-
appName="Payer Space"
|
|
90
|
-
component={
|
|
91
|
-
<TrainingLink
|
|
92
|
-
name="Appeals"
|
|
93
|
-
link="https://www.youtube.com/watch?v=GgwE94KZJ7E"
|
|
94
|
-
/>
|
|
95
|
-
}
|
|
96
|
-
>
|
|
97
|
-
<p>this is cool</p>
|
|
98
|
-
</PageHeader>
|
|
99
|
-
);
|
|
100
|
-
|
|
101
|
-
const el = getByText('Watch a demo');
|
|
102
|
-
expect(el).toBeDefined();
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
describe('spaces', () => {
|
|
106
|
-
test('should work with spaceId', async () => {
|
|
107
|
-
avWebQLApi.create.mockResolvedValue({
|
|
108
|
-
data: {
|
|
109
|
-
data: {
|
|
110
|
-
configurationPagination: {
|
|
111
|
-
pageInfo: {
|
|
112
|
-
itemCount: 1,
|
|
113
|
-
perPage: 1,
|
|
114
|
-
page: 1,
|
|
115
|
-
},
|
|
116
|
-
items: [{ id: '1', name: 'My Space' }],
|
|
117
|
-
},
|
|
118
|
-
},
|
|
119
|
-
},
|
|
120
|
-
});
|
|
121
|
-
const { getByText } = render(
|
|
122
|
-
<Spaces spaceIds={['1']} clientId="my-client-id">
|
|
123
|
-
<PageHeader appName="Payer Space" spaceId="1" />
|
|
124
|
-
</Spaces>
|
|
125
|
-
);
|
|
126
|
-
const defaultSpace = await waitFor(() => getByText('My Space'));
|
|
127
|
-
expect(defaultSpace.getAttribute('href')).toEqual('/web/spc/spaces/#/1');
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
test('should work with payerId', async () => {
|
|
131
|
-
avWebQLApi.create.mockResolvedValue({
|
|
132
|
-
data: {
|
|
133
|
-
data: {
|
|
134
|
-
configurationPagination: {
|
|
135
|
-
pageInfo: {
|
|
136
|
-
itemCount: 1,
|
|
137
|
-
perPage: 1,
|
|
138
|
-
page: 1,
|
|
139
|
-
},
|
|
140
|
-
items: [
|
|
141
|
-
{
|
|
142
|
-
id: 'payer1',
|
|
143
|
-
name: 'My Space',
|
|
144
|
-
payerIDs: ['payer1'],
|
|
145
|
-
images: {
|
|
146
|
-
logo: '/static/spaces/payer1/logo.png',
|
|
147
|
-
},
|
|
148
|
-
},
|
|
149
|
-
],
|
|
150
|
-
},
|
|
151
|
-
},
|
|
152
|
-
},
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
const { getByTestId } = render(
|
|
156
|
-
<Spaces payerIds={['payer1']} clientId="my-client-id">
|
|
157
|
-
<PageHeader appName="Payer Space" payerId="payer1" />
|
|
158
|
-
</Spaces>
|
|
159
|
-
);
|
|
160
|
-
|
|
161
|
-
const logo = await waitFor(() => getByTestId('space-images.logo-payer1'));
|
|
162
|
-
expect(logo).toBeDefined();
|
|
163
|
-
});
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
test('should render custom home url', () => {
|
|
167
|
-
const { getByText } = render(
|
|
168
|
-
<PageHeader homeUrl="/go-home" appName="Payer Space" />
|
|
169
|
-
);
|
|
170
|
-
|
|
171
|
-
const homeBtn = getByText('Home');
|
|
172
|
-
|
|
173
|
-
expect(homeBtn.getAttribute('href')).toBe('/go-home');
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
test('should accept custom title props', () => {
|
|
177
|
-
const { getByTestId } = render(
|
|
178
|
-
<PageHeader
|
|
179
|
-
appName="Payer Space"
|
|
180
|
-
titleProps={{
|
|
181
|
-
className: 'mb-0',
|
|
182
|
-
}}
|
|
183
|
-
/>
|
|
184
|
-
);
|
|
185
|
-
|
|
186
|
-
const pageHeaderTitle = getByTestId('page-header-title');
|
|
187
|
-
|
|
188
|
-
expect(pageHeaderTitle.className).toContain('mb-0');
|
|
189
|
-
});
|
|
190
|
-
|
|
191
|
-
test('should render custom right content', () => {
|
|
192
|
-
const { getByText } = render(
|
|
193
|
-
<PageHeader
|
|
194
|
-
appName="Payer Space"
|
|
195
|
-
renderRightContent={({ feedback, ...props }) => (
|
|
196
|
-
<div {...props}>
|
|
197
|
-
Hello World
|
|
198
|
-
{feedback}
|
|
199
|
-
</div>
|
|
200
|
-
)}
|
|
201
|
-
/>
|
|
202
|
-
);
|
|
203
|
-
|
|
204
|
-
const helloWorld = getByText('Hello World');
|
|
205
|
-
const giveFeedback = getByText('Give Feedback');
|
|
206
|
-
expect(helloWorld).toBeDefined();
|
|
207
|
-
expect(giveFeedback).toBeDefined();
|
|
208
|
-
});
|
|
209
|
-
|
|
210
|
-
test('should render custom link tag', () => {
|
|
211
|
-
const { getByText } = render(
|
|
212
|
-
<PageHeader
|
|
213
|
-
appName="Payer Space"
|
|
214
|
-
renderRightContent={({ feedback, ...props }) => (
|
|
215
|
-
<div {...props}>
|
|
216
|
-
Hello World
|
|
217
|
-
{feedback}
|
|
218
|
-
</div>
|
|
219
|
-
)}
|
|
220
|
-
linkTag={NavLink}
|
|
221
|
-
/>
|
|
222
|
-
);
|
|
223
|
-
|
|
224
|
-
const homeBtn = getByText('Home');
|
|
225
|
-
|
|
226
|
-
expect(homeBtn.className).toBe('nav-link');
|
|
227
|
-
});
|
|
228
|
-
|
|
229
|
-
test('should render with url', async () => {
|
|
230
|
-
avWebQLApi.create.mockResolvedValue({
|
|
231
|
-
data: {
|
|
232
|
-
data: {
|
|
233
|
-
configurationPagination: {
|
|
234
|
-
pageInfo: {
|
|
235
|
-
itemCount: 1,
|
|
236
|
-
perPage: 1,
|
|
237
|
-
page: 1,
|
|
238
|
-
},
|
|
239
|
-
items: [
|
|
240
|
-
{ id: '1', name: 'My Space', link: { url: '/custom-link' } },
|
|
241
|
-
],
|
|
242
|
-
},
|
|
243
|
-
},
|
|
244
|
-
},
|
|
245
|
-
});
|
|
246
|
-
const { getByText } = render(
|
|
247
|
-
<Spaces spaceIds={['1']} clientId="my-client-id">
|
|
248
|
-
<PageHeader appName="Payer Space" spaceId="1" />
|
|
249
|
-
</Spaces>
|
|
250
|
-
);
|
|
251
|
-
|
|
252
|
-
const spaceBreadcrumb = await waitFor(() => getByText('My Space'));
|
|
253
|
-
|
|
254
|
-
expect(spaceBreadcrumb.tagName.toLowerCase()).toBe('a');
|
|
255
|
-
|
|
256
|
-
expect(spaceBreadcrumb.getAttribute('href')).toEqual('/custom-link');
|
|
257
|
-
});
|
|
258
|
-
|
|
259
|
-
test('should render custom crumbs', async () => {
|
|
260
|
-
avWebQLApi.create.mockResolvedValue({
|
|
261
|
-
data: {
|
|
262
|
-
data: {
|
|
263
|
-
configurationPagination: {
|
|
264
|
-
pageInfo: {
|
|
265
|
-
itemCount: 1,
|
|
266
|
-
perPage: 1,
|
|
267
|
-
page: 1,
|
|
268
|
-
},
|
|
269
|
-
items: [
|
|
270
|
-
{ id: '1', name: 'My Space', link: { url: '/custom-link' } },
|
|
271
|
-
],
|
|
272
|
-
},
|
|
273
|
-
},
|
|
274
|
-
},
|
|
275
|
-
});
|
|
276
|
-
|
|
277
|
-
const { getByText } = render(
|
|
278
|
-
<Spaces spaceIds={['1']} clientId="my-client-id">
|
|
279
|
-
<PageHeader
|
|
280
|
-
appName="Payer Space"
|
|
281
|
-
spaceId="1"
|
|
282
|
-
crumbs={[{ name: 'Custom Crumb', url: '/my-custom-crumb' }]}
|
|
283
|
-
/>
|
|
284
|
-
</Spaces>
|
|
285
|
-
);
|
|
286
|
-
|
|
287
|
-
const spaceBreadcrumb = await waitFor(() => getByText('Custom Crumb'));
|
|
288
|
-
|
|
289
|
-
expect(spaceBreadcrumb.tagName.toLowerCase()).toBe('a');
|
|
290
|
-
|
|
291
|
-
expect(spaceBreadcrumb.getAttribute('href')).toEqual('/my-custom-crumb');
|
|
292
|
-
});
|
|
293
|
-
|
|
294
|
-
test('should hide crumbs', async () => {
|
|
295
|
-
avWebQLApi.create.mockResolvedValue({
|
|
296
|
-
data: {
|
|
297
|
-
data: {
|
|
298
|
-
configurationPagination: {
|
|
299
|
-
pageInfo: {
|
|
300
|
-
itemCount: 1,
|
|
301
|
-
perPage: 1,
|
|
302
|
-
page: 1,
|
|
303
|
-
},
|
|
304
|
-
items: [
|
|
305
|
-
{ id: '1', name: 'My Space', link: { url: '/custom-link' } },
|
|
306
|
-
],
|
|
307
|
-
},
|
|
308
|
-
},
|
|
309
|
-
},
|
|
310
|
-
});
|
|
311
|
-
|
|
312
|
-
const { queryByText } = render(
|
|
313
|
-
<Spaces spaceIds={['1']} clientId="my-client-id">
|
|
314
|
-
<PageHeader appName="Payer Space" spaceId="1" showCrumbs={false} />
|
|
315
|
-
</Spaces>
|
|
316
|
-
);
|
|
317
|
-
|
|
318
|
-
const spaceBreadcrumb = await waitFor(() => queryByText('My Space'));
|
|
319
|
-
|
|
320
|
-
expect(spaceBreadcrumb).toBeNull();
|
|
321
|
-
});
|
|
322
|
-
|
|
323
|
-
test('should hide crumbs if custom crumbs passed', async () => {
|
|
324
|
-
avWebQLApi.create.mockResolvedValue({
|
|
325
|
-
data: {
|
|
326
|
-
data: {
|
|
327
|
-
configurationPagination: {
|
|
328
|
-
pageInfo: {
|
|
329
|
-
itemCount: 1,
|
|
330
|
-
perPage: 1,
|
|
331
|
-
page: 1,
|
|
332
|
-
},
|
|
333
|
-
items: [
|
|
334
|
-
{ id: '1', name: 'My Space', link: { url: '/custom-link' } },
|
|
335
|
-
],
|
|
336
|
-
},
|
|
337
|
-
},
|
|
338
|
-
},
|
|
339
|
-
});
|
|
340
|
-
|
|
341
|
-
const { queryByText } = render(
|
|
342
|
-
<Spaces spaceIds={['1']} clientId="my-client-id">
|
|
343
|
-
<PageHeader
|
|
344
|
-
appName="Payer Space"
|
|
345
|
-
spaceId="1"
|
|
346
|
-
showCrumbs={false}
|
|
347
|
-
crumbs={[{ name: 'Custom Crumb', url: '/my-custom-crumb' }]}
|
|
348
|
-
/>
|
|
349
|
-
</Spaces>
|
|
350
|
-
);
|
|
351
|
-
|
|
352
|
-
const spaceBreadcrumb = await waitFor(() => queryByText('Custom Crumb'));
|
|
353
|
-
|
|
354
|
-
expect(spaceBreadcrumb).toBeNull();
|
|
355
|
-
});
|
|
356
|
-
});
|