@skyscanner/backpack-web 9.0.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.
Files changed (85) hide show
  1. package/bpk-animate-height/package.json +3 -3
  2. package/bpk-component-accordion/index.js +0 -2
  3. package/bpk-component-accordion/package.json +7 -7
  4. package/bpk-component-accordion/src/BpkAccordionItem.module.scss +3 -44
  5. package/bpk-component-aria-live/package.json +7 -7
  6. package/bpk-component-autosuggest/package.json +4 -4
  7. package/bpk-component-badge/README.md +7 -7
  8. package/bpk-component-badge/package.json +5 -5
  9. package/bpk-component-badge/src/BpkBadge.js +2 -0
  10. package/bpk-component-badge/src/BpkBadge.module.scss +4 -0
  11. package/bpk-component-banner-alert/package.json +9 -9
  12. package/bpk-component-barchart/package.json +8 -8
  13. package/bpk-component-blockquote/package.json +2 -2
  14. package/bpk-component-breadcrumb/package.json +5 -5
  15. package/bpk-component-breakpoint/package.json +3 -3
  16. package/bpk-component-button/package.json +3 -3
  17. package/bpk-component-calendar/package.json +9 -9
  18. package/bpk-component-card/package.json +4 -4
  19. package/bpk-component-checkbox/package.json +5 -5
  20. package/bpk-component-chip/package.json +5 -5
  21. package/bpk-component-close-button/package.json +4 -4
  22. package/bpk-component-code/package.json +2 -2
  23. package/bpk-component-content-container/package.json +2 -2
  24. package/bpk-component-datatable/package.json +4 -4
  25. package/bpk-component-datepicker/package.json +9 -9
  26. package/bpk-component-description-list/package.json +2 -2
  27. package/bpk-component-dialog/package.json +8 -8
  28. package/bpk-component-drawer/package.json +9 -9
  29. package/bpk-component-fieldset/package.json +12 -12
  30. package/bpk-component-flare/package.json +4 -4
  31. package/bpk-component-flare/src/bpk-flare-bar.module.scss +2 -2
  32. package/bpk-component-floating-notification/package.json +5 -5
  33. package/bpk-component-form-validation/package.json +10 -10
  34. package/bpk-component-graphic-promotion/README.md +11 -11
  35. package/bpk-component-graphic-promotion/{index.js → index.ts} +0 -1
  36. package/bpk-component-graphic-promotion/package.json +6 -7
  37. package/bpk-component-graphic-promotion/src/BpkGraphicPromo-test.tsx +131 -0
  38. package/bpk-component-graphic-promotion/src/{BpkGraphicPromo.js → BpkGraphicPromo.tsx} +60 -76
  39. package/bpk-component-graphic-promotion/src/accessibility-test.tsx +147 -0
  40. package/bpk-component-grid/package.json +2 -2
  41. package/bpk-component-grid-toggle/package.json +3 -3
  42. package/bpk-component-horizontal-nav/package.json +6 -6
  43. package/bpk-component-icon/package.json +7 -7
  44. package/bpk-component-image/package.json +6 -6
  45. package/bpk-component-infinite-scroll/package.json +6 -6
  46. package/bpk-component-input/package.json +6 -6
  47. package/bpk-component-label/package.json +2 -2
  48. package/bpk-component-link/package.json +4 -4
  49. package/bpk-component-list/package.json +2 -2
  50. package/bpk-component-loading-button/package.json +6 -6
  51. package/bpk-component-map/package.json +6 -6
  52. package/bpk-component-mobile-scroll-container/package.json +3 -3
  53. package/bpk-component-modal/package.json +9 -9
  54. package/bpk-component-navigation-bar/package.json +8 -8
  55. package/bpk-component-nudger/package.json +7 -7
  56. package/bpk-component-nudger/src/BpkConfigurableNudger.js +1 -1
  57. package/bpk-component-overlay/package.json +4 -4
  58. package/bpk-component-pagination/package.json +4 -4
  59. package/bpk-component-panel/package.json +2 -2
  60. package/bpk-component-phone-input/package.json +9 -9
  61. package/bpk-component-popover/package.json +8 -8
  62. package/bpk-component-price/package.json +3 -3
  63. package/bpk-component-progress/package.json +5 -5
  64. package/bpk-component-radio/package.json +4 -4
  65. package/bpk-component-rating/package.json +4 -4
  66. package/bpk-component-rtl-toggle/package.json +2 -2
  67. package/bpk-component-scrollable-calendar/package.json +6 -6
  68. package/bpk-component-section-list/package.json +6 -6
  69. package/bpk-component-select/package.json +3 -3
  70. package/bpk-component-skip-link/package.json +2 -2
  71. package/bpk-component-slider/package.json +4 -4
  72. package/bpk-component-spinner/package.json +3 -3
  73. package/bpk-component-split-input/package.json +3 -3
  74. package/bpk-component-star-rating/package.json +5 -5
  75. package/bpk-component-switch/package.json +2 -2
  76. package/bpk-component-table/package.json +2 -2
  77. package/bpk-component-text/package.json +2 -2
  78. package/bpk-component-textarea/package.json +4 -4
  79. package/bpk-component-theme-toggle/package.json +5 -5
  80. package/bpk-component-ticket/package.json +4 -4
  81. package/bpk-component-tooltip/package.json +4 -4
  82. package/bpk-scrim-utils/package.json +2 -2
  83. package/bpk-theming/package.json +2 -2
  84. package/package.json +4 -4
  85. package/bpk-component-accordion/src/themeAttributes.js +0 -25
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-datepicker",
3
- "version": "18.0.0",
3
+ "version": "18.0.1",
4
4
  "description": "Backpack datepicker component.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -14,12 +14,12 @@
14
14
  },
15
15
  "gitHead": "f9f94f86d7cfc75e43bc6ad5eb01b23e62a89cc8",
16
16
  "dependencies": {
17
- "bpk-component-breakpoint": "^5.0.0",
18
- "bpk-component-calendar": "^12.0.0",
19
- "bpk-component-input": "^7.0.0",
20
- "bpk-component-modal": "^6.0.0",
21
- "bpk-component-popover": "^8.0.0",
22
- "bpk-mixins": "^31.2.0",
17
+ "bpk-component-breakpoint": "^5.0.1",
18
+ "bpk-component-calendar": "^12.0.1",
19
+ "bpk-component-input": "^7.0.1",
20
+ "bpk-component-modal": "^6.0.1",
21
+ "bpk-component-popover": "^8.0.1",
22
+ "bpk-mixins": "^31.4.0",
23
23
  "bpk-react-utils": "^7.0.0",
24
24
  "prop-types": "^15.7.2"
25
25
  },
@@ -27,7 +27,7 @@
27
27
  "react": "^17.0.2"
28
28
  },
29
29
  "devDependencies": {
30
- "@skyscanner/bpk-foundations-web": "^8.3.0",
31
- "bpk-storybook-utils": "^2.0.0"
30
+ "@skyscanner/bpk-foundations-web": "^8.5.0",
31
+ "bpk-storybook-utils": "^2.0.1"
32
32
  }
33
33
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-description-list",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "description": "Backpack description list component.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -14,7 +14,7 @@
14
14
  },
15
15
  "gitHead": "5c156b97cb0ba5e75851d3c763334578714c895e",
16
16
  "dependencies": {
17
- "bpk-mixins": "^31.2.0",
17
+ "bpk-mixins": "^31.4.0",
18
18
  "bpk-react-utils": "^7.0.0",
19
19
  "prop-types": "^15.7.2"
20
20
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-dialog",
3
- "version": "7.0.0",
3
+ "version": "7.0.1",
4
4
  "description": "Backpack dialog component.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -14,19 +14,19 @@
14
14
  },
15
15
  "gitHead": "f9f94f86d7cfc75e43bc6ad5eb01b23e62a89cc8",
16
16
  "dependencies": {
17
- "bpk-component-close-button": "^4.0.0",
18
- "bpk-component-flare": "^3.0.0",
19
- "bpk-mixins": "^31.2.0",
17
+ "bpk-component-close-button": "^4.0.1",
18
+ "bpk-component-flare": "^3.0.1",
19
+ "bpk-mixins": "^31.4.0",
20
20
  "bpk-react-utils": "^7.0.0",
21
- "bpk-scrim-utils": "^6.0.0",
21
+ "bpk-scrim-utils": "^6.0.1",
22
22
  "prop-types": "^15.7.2"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "react": "^17.0.2"
26
26
  },
27
27
  "devDependencies": {
28
- "bpk-component-button": "^7.0.0",
29
- "bpk-component-icon": "^10.0.0",
30
- "bpk-component-text": "^8.0.0"
28
+ "bpk-component-button": "^7.0.1",
29
+ "bpk-component-icon": "^10.0.1",
30
+ "bpk-component-text": "^8.0.1"
31
31
  }
32
32
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-drawer",
3
- "version": "7.0.0",
3
+ "version": "7.0.1",
4
4
  "description": "Backpack drawer component.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -14,13 +14,13 @@
14
14
  },
15
15
  "gitHead": "f9f94f86d7cfc75e43bc6ad5eb01b23e62a89cc8",
16
16
  "dependencies": {
17
- "@skyscanner/bpk-foundations-web": "^8.3.0",
18
- "bpk-component-close-button": "^4.0.0",
19
- "bpk-component-icon": "^10.0.0",
20
- "bpk-component-link": "^4.0.0",
21
- "bpk-mixins": "^31.2.0",
17
+ "@skyscanner/bpk-foundations-web": "^8.5.0",
18
+ "bpk-component-close-button": "^4.0.1",
19
+ "bpk-component-icon": "^10.0.1",
20
+ "bpk-component-link": "^4.0.1",
21
+ "bpk-mixins": "^31.4.0",
22
22
  "bpk-react-utils": "^7.0.0",
23
- "bpk-scrim-utils": "^6.0.0",
23
+ "bpk-scrim-utils": "^6.0.1",
24
24
  "prop-types": "^15.7.2",
25
25
  "react-transition-group": "^2.5.3"
26
26
  },
@@ -28,7 +28,7 @@
28
28
  "react": "^17.0.2"
29
29
  },
30
30
  "devDependencies": {
31
- "bpk-component-button": "^7.0.0",
32
- "bpk-component-text": "^8.0.0"
31
+ "bpk-component-button": "^7.0.1",
32
+ "bpk-component-text": "^8.0.1"
33
33
  }
34
34
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-fieldset",
3
- "version": "5.0.0",
3
+ "version": "5.0.1",
4
4
  "description": "Backpack fieldset component.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -14,9 +14,9 @@
14
14
  },
15
15
  "gitHead": "4e4ec9add28e1db54d6a38a10c331bbd163f2926",
16
16
  "dependencies": {
17
- "bpk-component-form-validation": "^5.0.0",
18
- "bpk-component-label": "^6.0.0",
19
- "bpk-mixins": "^31.2.0",
17
+ "bpk-component-form-validation": "^5.0.1",
18
+ "bpk-component-label": "^6.0.1",
19
+ "bpk-mixins": "^31.4.0",
20
20
  "bpk-react-utils": "^7.0.0",
21
21
  "prop-types": "^15.7.2"
22
22
  },
@@ -24,13 +24,13 @@
24
24
  "react": "^17.0.2"
25
25
  },
26
26
  "devDependencies": {
27
- "bpk-component-autosuggest": "^7.0.0",
28
- "bpk-component-button": "^7.0.0",
29
- "bpk-component-calendar": "^12.0.0",
30
- "bpk-component-checkbox": "^5.0.0",
31
- "bpk-component-datepicker": "^18.0.0",
32
- "bpk-component-input": "^7.0.0",
33
- "bpk-component-select": "^6.0.0",
34
- "bpk-component-textarea": "^5.0.0"
27
+ "bpk-component-autosuggest": "^7.0.1",
28
+ "bpk-component-button": "^7.0.1",
29
+ "bpk-component-calendar": "^12.0.1",
30
+ "bpk-component-checkbox": "^5.0.1",
31
+ "bpk-component-datepicker": "^18.0.1",
32
+ "bpk-component-input": "^7.0.1",
33
+ "bpk-component-select": "^6.0.1",
34
+ "bpk-component-textarea": "^5.0.1"
35
35
  }
36
36
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-flare",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "Backpack FlareBar and ContentBubble component.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -17,9 +17,9 @@
17
17
  },
18
18
  "gitHead": "f9f94f86d7cfc75e43bc6ad5eb01b23e62a89cc8",
19
19
  "dependencies": {
20
- "bpk-component-label": "^6.0.0",
21
- "bpk-component-text": "^8.0.0",
22
- "bpk-mixins": "^31.2.0",
20
+ "bpk-component-label": "^6.0.1",
21
+ "bpk-component-text": "^8.0.1",
22
+ "bpk-mixins": "^31.4.0",
23
23
  "bpk-react-utils": "^7.0.0",
24
24
  "prop-types": "^15.7.2"
25
25
  },
@@ -44,7 +44,7 @@ $bpk-spacing-v2: true;
44
44
  height: $bpk-flare-height-desktop;
45
45
  margin-left: 50%;
46
46
  transform: translateX(-50%);
47
- fill: $bpk-color-white;
47
+ fill: $bpk-surface-default-day;
48
48
 
49
49
  @include bpk-rtl {
50
50
  margin-right: 50%;
@@ -63,7 +63,7 @@ $bpk-spacing-v2: true;
63
63
  left: 0;
64
64
  width: $bpk-flare-corner-radius;
65
65
  height: $bpk-flare-corner-radius;
66
- fill: $bpk-color-white;
66
+ fill: $bpk-surface-default-day;
67
67
 
68
68
  &--trailing {
69
69
  right: 0;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-floating-notification",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Backpack floating-notification component.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -13,10 +13,10 @@
13
13
  "registry": "https://registry.npmjs.org/"
14
14
  },
15
15
  "dependencies": {
16
- "bpk-component-aria-live": "^3.0.0",
17
- "bpk-component-button": "^7.0.0",
18
- "bpk-component-text": "^8.0.0",
19
- "bpk-mixins": "^31.2.0",
16
+ "bpk-component-aria-live": "^3.0.1",
17
+ "bpk-component-button": "^7.0.1",
18
+ "bpk-component-text": "^8.0.1",
19
+ "bpk-mixins": "^31.4.0",
20
20
  "bpk-react-utils": "^7.0.0",
21
21
  "prop-types": "^15.5.8"
22
22
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-form-validation",
3
- "version": "5.0.0",
3
+ "version": "5.0.1",
4
4
  "description": "Backpack form-validation component.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -14,8 +14,8 @@
14
14
  },
15
15
  "gitHead": "f9f94f86d7cfc75e43bc6ad5eb01b23e62a89cc8",
16
16
  "dependencies": {
17
- "bpk-animate-height": "^5.0.0",
18
- "bpk-mixins": "^31.2.0",
17
+ "bpk-animate-height": "^5.0.1",
18
+ "bpk-mixins": "^31.4.0",
19
19
  "bpk-react-utils": "^7.0.0",
20
20
  "prop-types": "^15.7.2"
21
21
  },
@@ -23,12 +23,12 @@
23
23
  "react": "^17.0.2"
24
24
  },
25
25
  "devDependencies": {
26
- "@skyscanner/bpk-foundations-web": "^8.3.0",
27
- "bpk-component-button": "^7.0.0",
28
- "bpk-component-checkbox": "^5.0.0",
29
- "bpk-component-icon": "^10.0.0",
30
- "bpk-component-input": "^7.0.0",
31
- "bpk-component-select": "^6.0.0",
32
- "bpk-component-textarea": "^5.0.0"
26
+ "@skyscanner/bpk-foundations-web": "^8.5.0",
27
+ "bpk-component-button": "^7.0.1",
28
+ "bpk-component-checkbox": "^5.0.1",
29
+ "bpk-component-icon": "^10.0.1",
30
+ "bpk-component-input": "^7.0.1",
31
+ "bpk-component-select": "^6.0.1",
32
+ "bpk-component-textarea": "^5.0.1"
33
33
  }
34
34
  }
@@ -8,25 +8,25 @@ npm install bpk-component-graphic-promotion --save-dev
8
8
 
9
9
  ## Usage
10
10
 
11
- ```js
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
- subheading="Portugal and 6 more countries have just been added to the UK travel green list"
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
- buttonText="Learn more"
27
- onClick={() => redirect("https://www.sponsor-name.com/promotion")}
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
- | style | object | false | {} |
46
- | tagline | string | false | null |
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
- ```typescript
64
+ ```ts
65
65
  const sponsor = {
66
66
  label: 'Sponsored',
67
67
  altText: 'Skyscanner',
@@ -15,7 +15,6 @@
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
19
  import BpkGraphicPromo, {
21
20
  type Props as BpkGraphicPromoProps,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-graphic-promotion",
3
- "version": "5.0.0",
3
+ "version": "5.0.1",
4
4
  "description": "Backpack graphic-promotion component.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -8,16 +8,15 @@
8
8
  "url": "git@github.com:Skyscanner/backpack.git"
9
9
  },
10
10
  "author": "Backpack Design System <backpack@skyscanner.net>",
11
- "main": "index.js",
11
+ "main": "index.ts",
12
12
  "publishConfig": {
13
13
  "registry": "https://registry.npmjs.org/"
14
14
  },
15
15
  "dependencies": {
16
- "bpk-component-button": "^7.0.0",
17
- "bpk-component-text": "^8.0.0",
18
- "bpk-mixins": "^31.2.0",
19
- "bpk-react-utils": "^7.0.0",
20
- "prop-types": "^15.5.8"
16
+ "bpk-component-button": "^7.0.1",
17
+ "bpk-component-text": "^8.0.1",
18
+ "bpk-mixins": "^31.4.0",
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
+ });