@skyscanner/backpack-web 9.1.0 → 9.2.0-beta.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/bpk-component-graphic-promotion/README.md +11 -11
- package/bpk-component-graphic-promotion/{index.js → index.ts} +0 -1
- package/bpk-component-graphic-promotion/package.json +2 -3
- package/bpk-component-graphic-promotion/src/BpkGraphicPromo-test.tsx +131 -0
- package/bpk-component-graphic-promotion/src/{BpkGraphicPromo.js → BpkGraphicPromo.tsx} +56 -77
- package/bpk-component-graphic-promotion/src/accessibility-test.tsx +147 -0
- package/package.json +1 -1
|
@@ -8,25 +8,25 @@ npm install bpk-component-graphic-promotion --save-dev
|
|
|
8
8
|
|
|
9
9
|
## Usage
|
|
10
10
|
|
|
11
|
-
```
|
|
11
|
+
```tsx
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import BpkGraphicPromo from 'bpk-component-graphic-promotion';
|
|
14
14
|
|
|
15
15
|
export default () => (
|
|
16
16
|
<BpkGraphicPromo
|
|
17
|
+
buttonText="Learn more"
|
|
17
18
|
contentId="graphic-promo-1"
|
|
18
|
-
tagline="Tagline"
|
|
19
19
|
headline="Ride your wave"
|
|
20
|
-
|
|
20
|
+
invertVertically
|
|
21
|
+
onClick={() => redirect("https://www.sponsor-name.com/promotion")}
|
|
21
22
|
sponsor={{
|
|
22
23
|
label: 'Sponsored',
|
|
23
24
|
logo: './path/to/sponsor/logo.png',
|
|
24
25
|
altText: 'Sponsor Name',
|
|
25
26
|
}}
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
subheading="Portugal and 6 more countries have just been added to the UK travel green list"
|
|
28
|
+
tagline="Tagline"
|
|
28
29
|
textAlign={TEXT_ALIGN.start}
|
|
29
|
-
invertVertically
|
|
30
30
|
/>
|
|
31
31
|
);
|
|
32
32
|
```
|
|
@@ -35,17 +35,17 @@ export default () => (
|
|
|
35
35
|
|
|
36
36
|
| Property | PropType | Required | Default Value |
|
|
37
37
|
| ---------------- | ----------------- | -------- | ------------- |
|
|
38
|
-
| contentId | string | false | null |
|
|
39
38
|
| buttonText | string | true | - |
|
|
40
39
|
| headline | string | true | - |
|
|
41
|
-
| invertVertically | bool | true | - |
|
|
42
40
|
| onClick | func | true | - |
|
|
43
41
|
| textAlign | oneOf(TEXT_ALIGN) | true | - |
|
|
44
42
|
| className | string | false | null |
|
|
45
|
-
|
|
|
46
|
-
|
|
|
43
|
+
| contentId | string | false | null |
|
|
44
|
+
| invertVertically | bool | false | false |
|
|
47
45
|
| sponsor | object | false | null |
|
|
46
|
+
| style | object | false | {} |
|
|
48
47
|
| subheading | string | false | null |
|
|
48
|
+
| tagline | string | false | null |
|
|
49
49
|
|
|
50
50
|
### Prop Details
|
|
51
51
|
|
|
@@ -61,7 +61,7 @@ The object consists of the following fields:
|
|
|
61
61
|
|
|
62
62
|
##### Example
|
|
63
63
|
|
|
64
|
-
```
|
|
64
|
+
```ts
|
|
65
65
|
const sponsor = {
|
|
66
66
|
label: 'Sponsored',
|
|
67
67
|
altText: 'Skyscanner',
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"url": "git@github.com:Skyscanner/backpack.git"
|
|
9
9
|
},
|
|
10
10
|
"author": "Backpack Design System <backpack@skyscanner.net>",
|
|
11
|
-
"main": "index.
|
|
11
|
+
"main": "index.ts",
|
|
12
12
|
"publishConfig": {
|
|
13
13
|
"registry": "https://registry.npmjs.org/"
|
|
14
14
|
},
|
|
@@ -16,8 +16,7 @@
|
|
|
16
16
|
"bpk-component-button": "^7.0.1",
|
|
17
17
|
"bpk-component-text": "^8.0.1",
|
|
18
18
|
"bpk-mixins": "^31.4.0",
|
|
19
|
-
"bpk-react-utils": "^7.0.0"
|
|
20
|
-
"prop-types": "^15.5.8"
|
|
19
|
+
"bpk-react-utils": "^7.0.0"
|
|
21
20
|
},
|
|
22
21
|
"peerDependencies": {
|
|
23
22
|
"react": "^17.0.2"
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Backpack - Skyscanner's Design System
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2022 Skyscanner Ltd
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import React from 'react';
|
|
20
|
+
import { fireEvent, render } from '@testing-library/react';
|
|
21
|
+
import { cssModules } from 'bpk-react-utils';
|
|
22
|
+
|
|
23
|
+
import BpkGraphicPromo, { TEXT_ALIGN } from './BpkGraphicPromo';
|
|
24
|
+
import type { Props } from './BpkGraphicPromo';
|
|
25
|
+
import STYLES from './BpkGraphicPromo.module.scss';
|
|
26
|
+
|
|
27
|
+
const getClassName = cssModules(STYLES);
|
|
28
|
+
|
|
29
|
+
const props: Props = {
|
|
30
|
+
buttonText: 'Learn more',
|
|
31
|
+
headline: 'Ride your wave',
|
|
32
|
+
invertVertically: false,
|
|
33
|
+
onClick: jest.fn(),
|
|
34
|
+
sponsor: {
|
|
35
|
+
label: 'Sponsored',
|
|
36
|
+
logo: 'path/to/logo.png',
|
|
37
|
+
altText: 'Airline Name',
|
|
38
|
+
},
|
|
39
|
+
subheading:
|
|
40
|
+
'Portugal and 6 more countries have just been added to the UK travel green list',
|
|
41
|
+
tagline: 'Tagline',
|
|
42
|
+
textAlign: TEXT_ALIGN.start,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
describe('BpkGraphicPromo', () => {
|
|
46
|
+
beforeEach(() => {
|
|
47
|
+
(props.onClick as jest.MockedFunction<Props['onClick']>).mockReset();
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('should render correctly with all properties set', () => {
|
|
51
|
+
const { asFragment } = render(<BpkGraphicPromo {...props} />);
|
|
52
|
+
|
|
53
|
+
expect(asFragment()).toMatchSnapshot();
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('should support custom class names', () => {
|
|
57
|
+
const { asFragment } = render(
|
|
58
|
+
<BpkGraphicPromo className="custom-classname" {...props} />,
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
expect(asFragment()).toMatchSnapshot();
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('should render correctly when centre aligned', () => {
|
|
65
|
+
const customProps = { ...props, textAlign: TEXT_ALIGN.center };
|
|
66
|
+
const { asFragment } = render(<BpkGraphicPromo {...customProps} />);
|
|
67
|
+
|
|
68
|
+
expect(asFragment()).toMatchSnapshot();
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('should render correctly when right aligned', () => {
|
|
72
|
+
const customProps = { ...props, textAlign: TEXT_ALIGN.end };
|
|
73
|
+
const { asFragment } = render(<BpkGraphicPromo {...customProps} />);
|
|
74
|
+
|
|
75
|
+
expect(asFragment()).toMatchSnapshot();
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it('should render correctly when inverted portrait', () => {
|
|
79
|
+
const customProps = { ...props, invertVertically: true };
|
|
80
|
+
const { asFragment } = render(<BpkGraphicPromo {...customProps} />);
|
|
81
|
+
|
|
82
|
+
expect(asFragment()).toMatchSnapshot();
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it('should not display tagline or subheading when not provided', () => {
|
|
86
|
+
const customProps = { ...props };
|
|
87
|
+
delete customProps.tagline;
|
|
88
|
+
delete customProps.subheading;
|
|
89
|
+
const { asFragment } = render(<BpkGraphicPromo {...customProps} />);
|
|
90
|
+
|
|
91
|
+
expect(asFragment()).toMatchSnapshot();
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it('should display the tagline and no sponsor for non-sponsored ad', () => {
|
|
95
|
+
const customProps = { ...props };
|
|
96
|
+
delete customProps.sponsor;
|
|
97
|
+
const { asFragment } = render(<BpkGraphicPromo {...customProps} />);
|
|
98
|
+
|
|
99
|
+
expect(asFragment()).toMatchSnapshot();
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it('should redirect us to link when card is clicked', () => {
|
|
103
|
+
render(<BpkGraphicPromo {...props} />);
|
|
104
|
+
|
|
105
|
+
const graphicPromo = document.getElementsByClassName(
|
|
106
|
+
getClassName('bpk-graphic-promo'),
|
|
107
|
+
)[0];
|
|
108
|
+
fireEvent.click(graphicPromo);
|
|
109
|
+
|
|
110
|
+
expect(props.onClick).toHaveBeenCalledTimes(1);
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
it('should redirect us to link when button is clicked', () => {
|
|
114
|
+
render(<BpkGraphicPromo {...props} />);
|
|
115
|
+
|
|
116
|
+
const graphicPromoCTA = document.getElementsByClassName(
|
|
117
|
+
getClassName('bpk-graphic-promo__cta'),
|
|
118
|
+
)[0];
|
|
119
|
+
fireEvent.click(graphicPromoCTA);
|
|
120
|
+
|
|
121
|
+
expect(props.onClick).toHaveBeenCalledTimes(1);
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
it('should render correctly with a content ID', () => {
|
|
125
|
+
const { asFragment } = render(
|
|
126
|
+
<BpkGraphicPromo contentId="content-id" {...props} />,
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
expect(asFragment()).toMatchSnapshot();
|
|
130
|
+
});
|
|
131
|
+
});
|
|
@@ -15,14 +15,11 @@
|
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
|
-
/* @flow strict */
|
|
19
18
|
|
|
20
|
-
import PropTypes from 'prop-types';
|
|
21
19
|
import React from 'react';
|
|
22
|
-
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import BpkButton from '../../bpk-component-button';
|
|
20
|
+
import { cssModules } from 'bpk-react-utils';
|
|
21
|
+
import BpkText from 'bpk-component-text';
|
|
22
|
+
import BpkButton from 'bpk-component-button';
|
|
26
23
|
|
|
27
24
|
import STYLES from './BpkGraphicPromo.module.scss';
|
|
28
25
|
|
|
@@ -41,64 +38,66 @@ export const TEXT_ALIGN = {
|
|
|
41
38
|
start: 'start',
|
|
42
39
|
center: 'center',
|
|
43
40
|
end: 'end',
|
|
44
|
-
};
|
|
41
|
+
} as const;
|
|
45
42
|
|
|
46
43
|
export type Props = {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
headline: string
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
44
|
+
buttonText: string;
|
|
45
|
+
className?: string | null;
|
|
46
|
+
contentId?: string | null;
|
|
47
|
+
headline: string;
|
|
48
|
+
invertVertically?: boolean;
|
|
49
|
+
onClick: () => void;
|
|
50
|
+
sponsor?: {
|
|
51
|
+
label: string;
|
|
52
|
+
logo: string;
|
|
53
|
+
altText: string;
|
|
54
|
+
} | null;
|
|
55
|
+
style?: {};
|
|
56
|
+
subheading?: string | null;
|
|
57
|
+
tagline?: string | null;
|
|
58
|
+
textAlign: typeof TEXT_ALIGN[keyof typeof TEXT_ALIGN];
|
|
62
59
|
};
|
|
63
60
|
|
|
64
|
-
const constructAriaLabel = (
|
|
65
|
-
buttonText,
|
|
66
|
-
headline,
|
|
67
|
-
sponsor,
|
|
68
|
-
subheading,
|
|
69
|
-
tagline,
|
|
70
|
-
|
|
71
|
-
const text = [];
|
|
72
|
-
const addText = (value) => value && text.push(value);
|
|
61
|
+
const constructAriaLabel = (
|
|
62
|
+
buttonText: Props['buttonText'],
|
|
63
|
+
headline: Props['headline'],
|
|
64
|
+
sponsor: Props['sponsor'],
|
|
65
|
+
subheading: Props['subheading'],
|
|
66
|
+
tagline: Props['tagline'],
|
|
67
|
+
) => {
|
|
68
|
+
const text: string[] = [];
|
|
69
|
+
const addText = (value: string) => value && text.push(value);
|
|
73
70
|
|
|
74
71
|
if (sponsor) {
|
|
75
72
|
addText(sponsor.label);
|
|
76
73
|
addText(sponsor.altText);
|
|
77
|
-
} else {
|
|
74
|
+
} else if (tagline) {
|
|
78
75
|
addText(tagline);
|
|
79
76
|
}
|
|
77
|
+
|
|
78
|
+
if (subheading) {
|
|
79
|
+
addText(subheading);
|
|
80
|
+
}
|
|
81
|
+
|
|
80
82
|
addText(headline);
|
|
81
|
-
addText(subheading);
|
|
82
83
|
addText(buttonText);
|
|
83
84
|
|
|
84
85
|
return text.join('. ');
|
|
85
86
|
};
|
|
86
87
|
|
|
87
|
-
const BpkGraphicPromo = (
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
} = props;
|
|
101
|
-
|
|
88
|
+
const BpkGraphicPromo = ({
|
|
89
|
+
buttonText,
|
|
90
|
+
className = null,
|
|
91
|
+
contentId,
|
|
92
|
+
headline,
|
|
93
|
+
invertVertically = false,
|
|
94
|
+
onClick,
|
|
95
|
+
sponsor = null,
|
|
96
|
+
style = {},
|
|
97
|
+
subheading = null,
|
|
98
|
+
tagline = null,
|
|
99
|
+
textAlign,
|
|
100
|
+
}: Props) => {
|
|
102
101
|
// FIXME: Use useCallback() here when React is updated.
|
|
103
102
|
const onClickWrapper = (event: React.MouseEvent<HTMLElement>) => {
|
|
104
103
|
event.stopPropagation();
|
|
@@ -122,17 +121,23 @@ const BpkGraphicPromo = (props: Props) => {
|
|
|
122
121
|
// clicks and key presses (Enter/Space) for the whole component, as described here:
|
|
123
122
|
// https://developer.mozilla.org/en-US/docs/Web/Accessibility/Keyboard-navigable_JavaScript_widgets
|
|
124
123
|
<div
|
|
125
|
-
id={contentId}
|
|
124
|
+
id={contentId || ''}
|
|
126
125
|
className={cardClasses}
|
|
127
126
|
style={style}
|
|
128
127
|
role="link"
|
|
129
|
-
aria-label={constructAriaLabel(
|
|
128
|
+
aria-label={constructAriaLabel(
|
|
129
|
+
buttonText,
|
|
130
|
+
headline,
|
|
131
|
+
sponsor,
|
|
132
|
+
subheading,
|
|
133
|
+
tagline,
|
|
134
|
+
)}
|
|
130
135
|
tabIndex={0}
|
|
131
136
|
onClick={onClickWrapper}
|
|
132
137
|
onKeyDown={onKeyWrapper}
|
|
133
138
|
>
|
|
134
139
|
<div
|
|
135
|
-
id={contentId && `${contentId}__content`}
|
|
140
|
+
id={(contentId && `${contentId}__content`) || ''}
|
|
136
141
|
className={containerClasses}
|
|
137
142
|
aria-hidden
|
|
138
143
|
>
|
|
@@ -190,30 +195,4 @@ const BpkGraphicPromo = (props: Props) => {
|
|
|
190
195
|
);
|
|
191
196
|
};
|
|
192
197
|
|
|
193
|
-
BpkGraphicPromo.propTypes = {
|
|
194
|
-
className: PropTypes.string,
|
|
195
|
-
tagline: PropTypes.string,
|
|
196
|
-
headline: PropTypes.string.isRequired,
|
|
197
|
-
subheading: PropTypes.string,
|
|
198
|
-
sponsor: PropTypes.shape({
|
|
199
|
-
label: PropTypes.string,
|
|
200
|
-
logo: PropTypes.string,
|
|
201
|
-
altText: PropTypes.string,
|
|
202
|
-
}),
|
|
203
|
-
buttonText: PropTypes.string.isRequired,
|
|
204
|
-
onClick: PropTypes.func.isRequired,
|
|
205
|
-
invertVertically: PropTypes.bool,
|
|
206
|
-
textAlign: PropTypes.oneOf(Object.values(TEXT_ALIGN)).isRequired,
|
|
207
|
-
style: PropTypes.shape({ [PropTypes.string]: PropTypes.string }),
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
BpkGraphicPromo.defaultProps = {
|
|
211
|
-
className: null,
|
|
212
|
-
tagline: null,
|
|
213
|
-
subheading: null,
|
|
214
|
-
sponsor: null,
|
|
215
|
-
invertVertically: false,
|
|
216
|
-
style: {},
|
|
217
|
-
};
|
|
218
|
-
|
|
219
198
|
export default BpkGraphicPromo;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Backpack - Skyscanner's Design System
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2022 Skyscanner Ltd
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
import React from 'react';
|
|
19
|
+
import { render } from '@testing-library/react';
|
|
20
|
+
import { axe } from 'jest-axe';
|
|
21
|
+
|
|
22
|
+
import BpkGraphicPromo, { TEXT_ALIGN } from './BpkGraphicPromo';
|
|
23
|
+
|
|
24
|
+
const sponsor = {
|
|
25
|
+
label: 'Sponsored',
|
|
26
|
+
logo: 'path/to/logo.png',
|
|
27
|
+
altText: 'Airline Name',
|
|
28
|
+
};
|
|
29
|
+
const buttonText = 'Learn more';
|
|
30
|
+
const onClick = () => {
|
|
31
|
+
window.location.href = 'https://www.skyscanner.net';
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const tagline = 'Tagline';
|
|
35
|
+
const headline = 'Ride your wave';
|
|
36
|
+
const subheading =
|
|
37
|
+
'Portugal and 6 more countries have just been added to the UK travel green list';
|
|
38
|
+
|
|
39
|
+
describe('BpkGraphicPromo accessibility tests', () => {
|
|
40
|
+
// TODO: Temporarily disabling tests due to a newer version of jest-axe which causes tests to fail when using nested interactive elements
|
|
41
|
+
|
|
42
|
+
it('should not have programmatically-detectable accessibility issues', async () => {
|
|
43
|
+
const { container } = render(
|
|
44
|
+
<BpkGraphicPromo
|
|
45
|
+
buttonText={buttonText}
|
|
46
|
+
className="test"
|
|
47
|
+
headline={headline}
|
|
48
|
+
invertVertically={false}
|
|
49
|
+
onClick={onClick}
|
|
50
|
+
sponsor={sponsor}
|
|
51
|
+
subheading={subheading}
|
|
52
|
+
tagline={tagline}
|
|
53
|
+
textAlign={TEXT_ALIGN.start}
|
|
54
|
+
/>,
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
const results = await axe(container);
|
|
58
|
+
expect(results).toHaveNoViolations();
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it('should not have programmatically-detectable accessibility issues in centre aligned', async () => {
|
|
62
|
+
const { container } = render(
|
|
63
|
+
<BpkGraphicPromo
|
|
64
|
+
buttonText={buttonText}
|
|
65
|
+
headline={headline}
|
|
66
|
+
invertVertically={false}
|
|
67
|
+
onClick={onClick}
|
|
68
|
+
sponsor={sponsor}
|
|
69
|
+
subheading={subheading}
|
|
70
|
+
tagline={tagline}
|
|
71
|
+
textAlign={TEXT_ALIGN.center}
|
|
72
|
+
/>,
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
const results = await axe(container);
|
|
76
|
+
expect(results).toHaveNoViolations();
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it('should not have programmatically-detectable accessibility issues in right aligned', async () => {
|
|
80
|
+
const { container } = render(
|
|
81
|
+
<BpkGraphicPromo
|
|
82
|
+
buttonText={buttonText}
|
|
83
|
+
headline={headline}
|
|
84
|
+
invertVertically={false}
|
|
85
|
+
onClick={onClick}
|
|
86
|
+
sponsor={sponsor}
|
|
87
|
+
subheading={subheading}
|
|
88
|
+
tagline={tagline}
|
|
89
|
+
textAlign={TEXT_ALIGN.end}
|
|
90
|
+
/>,
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
const results = await axe(container);
|
|
94
|
+
expect(results).toHaveNoViolations();
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it('should not have programmatically-detectable accessibility issues in inverted portrait', async () => {
|
|
98
|
+
const { container } = render(
|
|
99
|
+
<BpkGraphicPromo
|
|
100
|
+
buttonText={buttonText}
|
|
101
|
+
headline={headline}
|
|
102
|
+
invertVertically
|
|
103
|
+
onClick={onClick}
|
|
104
|
+
sponsor={sponsor}
|
|
105
|
+
subheading={subheading}
|
|
106
|
+
tagline={tagline}
|
|
107
|
+
textAlign={TEXT_ALIGN.start}
|
|
108
|
+
/>,
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
const results = await axe(container);
|
|
112
|
+
expect(results).toHaveNoViolations();
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
it('should not have programmatically-detectable accessibility issues when optional text is missing', async () => {
|
|
116
|
+
const { container } = render(
|
|
117
|
+
<BpkGraphicPromo
|
|
118
|
+
buttonText={buttonText}
|
|
119
|
+
headline={headline}
|
|
120
|
+
invertVertically={false}
|
|
121
|
+
onClick={onClick}
|
|
122
|
+
sponsor={sponsor}
|
|
123
|
+
textAlign={TEXT_ALIGN.start}
|
|
124
|
+
/>,
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
const results = await axe(container);
|
|
128
|
+
expect(results).toHaveNoViolations();
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
it('should not have programmatically-detectable accessibility issues in non-sponsored', async () => {
|
|
132
|
+
const { container } = render(
|
|
133
|
+
<BpkGraphicPromo
|
|
134
|
+
buttonText={buttonText}
|
|
135
|
+
headline={headline}
|
|
136
|
+
invertVertically={false}
|
|
137
|
+
onClick={onClick}
|
|
138
|
+
subheading={subheading}
|
|
139
|
+
tagline={tagline}
|
|
140
|
+
textAlign={TEXT_ALIGN.start}
|
|
141
|
+
/>,
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
const results = await axe(container);
|
|
145
|
+
expect(results).toHaveNoViolations();
|
|
146
|
+
});
|
|
147
|
+
});
|