@sapudex/web-components 2.2.0 → 2.4.0

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 (273) hide show
  1. package/.eslintignore +3 -0
  2. package/bundle.esm.js +3 -0
  3. package/cypress/fixtures/contact-numbers.ts +10 -0
  4. package/cypress/fixtures/event-ribbon-links.ts +5 -0
  5. package/cypress/specs/Accordion.cy.tsx +25 -2
  6. package/cypress/specs/AccordionItem.cy.tsx +1 -1
  7. package/cypress/specs/Avatar.cy.tsx +1 -1
  8. package/cypress/specs/AvatarGroup.cy.tsx +1 -2
  9. package/cypress/specs/Badge.cy.tsx +1 -1
  10. package/cypress/specs/Contact.cy.tsx +92 -0
  11. package/cypress/specs/ContactItem.cy.tsx +56 -0
  12. package/cypress/specs/CountrySelector.cy.tsx +10 -4
  13. package/cypress/specs/EventRibbon.cy.tsx +110 -0
  14. package/cypress/specs/Footer.cy.tsx +1 -1
  15. package/cypress/specs/ListItem.cy.tsx +1 -1
  16. package/cypress/specs/PhoneNumberField.cy.tsx +4 -2
  17. package/cypress/specs/Review.cy.tsx +1 -3
  18. package/cypress/specs/ReviewItem.cy.tsx +1 -1
  19. package/cypress/specs/SecondaryNavigationDesktop.cy.tsx +123 -116
  20. package/cypress/specs/SecondaryNavigationMobile.cy.tsx +27 -38
  21. package/cypress/specs/SelectBox.cy.tsx +93 -88
  22. package/cypress/specs/Slider.cy.tsx +1 -1
  23. package/cypress/specs/StatusBadge.cy.tsx +1 -1
  24. package/cypress/specs/StatusMessage.cy.tsx +1 -1
  25. package/cypress/specs/Switch.cy.tsx +1 -2
  26. package/cypress/specs/Table.cy.tsx +1 -9
  27. package/cypress/specs/Tag.cy.tsx +1 -1
  28. package/cypress/specs/TagGroup.cy.tsx +1 -2
  29. package/cypress/specs/TextField.cy.tsx +1 -1
  30. package/cypress/specs/Textarea.cy.tsx +1 -1
  31. package/cypress/specs/Toast.cy.tsx +1 -1
  32. package/cypress/specs/Tooltip.cy.tsx +1 -2
  33. package/cypress/specs/TruncatedText.cy.tsx +2 -1
  34. package/cypress/specs/Upload.cy.tsx +1 -2
  35. package/cypress/specs/UploadItem.cy.tsx +1 -1
  36. package/cypress/specs/Wizard.cy.tsx +7 -4
  37. package/cypress/support/commands.ts +31 -2
  38. package/cypress/support/component-imports.instrumented.ts +95 -0
  39. package/cypress/support/component-imports.src.ts +95 -0
  40. package/cypress/support/component.ts +1 -1
  41. package/cypress.config.ts +6 -0
  42. package/dist/Accordion.d.ts +7 -1
  43. package/dist/Accordion.js +3 -3
  44. package/dist/Accordion.js.map +1 -1
  45. package/dist/Assets.js +31 -0
  46. package/dist/Assets.js.map +1 -1
  47. package/dist/AssetsVariables.js +4 -0
  48. package/dist/AssetsVariables.js.map +1 -1
  49. package/dist/Button.d.ts +7 -0
  50. package/dist/Button.js +3 -0
  51. package/dist/Button.js.map +1 -1
  52. package/dist/Contact.d.ts +102 -0
  53. package/dist/Contact.js +152 -0
  54. package/dist/Contact.js.map +1 -0
  55. package/dist/ContactItem.d.ts +67 -0
  56. package/dist/ContactItem.js +96 -0
  57. package/dist/ContactItem.js.map +1 -0
  58. package/dist/ContactItemTemplate.d.ts +2 -0
  59. package/dist/ContactItemTemplate.js +13 -0
  60. package/dist/ContactItemTemplate.js.map +1 -0
  61. package/dist/ContactTemplate.d.ts +4 -0
  62. package/dist/ContactTemplate.js +29 -0
  63. package/dist/ContactTemplate.js.map +1 -0
  64. package/dist/CountrySelector.d.ts +2 -4
  65. package/dist/CountrySelector.js +3 -5
  66. package/dist/CountrySelector.js.map +1 -1
  67. package/dist/DatePicker.js +2 -1
  68. package/dist/DatePicker.js.map +1 -1
  69. package/dist/EventRibbon.d.ts +80 -0
  70. package/dist/EventRibbon.js +111 -0
  71. package/dist/EventRibbon.js.map +1 -0
  72. package/dist/EventRibbonTemplate.d.ts +2 -0
  73. package/dist/EventRibbonTemplate.js +7 -0
  74. package/dist/EventRibbonTemplate.js.map +1 -0
  75. package/dist/Footer.d.ts +0 -1
  76. package/dist/Footer.js +7 -9
  77. package/dist/Footer.js.map +1 -1
  78. package/dist/HeroBanner.d.ts +1 -1
  79. package/dist/List.d.ts +1 -1
  80. package/dist/List.js +1 -1
  81. package/dist/List.js.map +1 -1
  82. package/dist/MastheadItem.d.ts +1 -3
  83. package/dist/MastheadItem.js +6 -11
  84. package/dist/MastheadItem.js.map +1 -1
  85. package/dist/MastheadMenu.d.ts +0 -1
  86. package/dist/MastheadMenu.js +2 -4
  87. package/dist/MastheadMenu.js.map +1 -1
  88. package/dist/MastheadProfileMenu.d.ts +0 -1
  89. package/dist/MastheadProfileMenu.js +2 -4
  90. package/dist/MastheadProfileMenu.js.map +1 -1
  91. package/dist/MastheadShell.d.ts +4 -1
  92. package/dist/MastheadShell.js +21 -5
  93. package/dist/MastheadShell.js.map +1 -1
  94. package/dist/Pagination.d.ts +17 -3
  95. package/dist/Pagination.js +33 -31
  96. package/dist/Pagination.js.map +1 -1
  97. package/dist/PhoneNumberField.d.ts +5 -5
  98. package/dist/PhoneNumberField.js +1 -1
  99. package/dist/PhoneNumberField.js.map +1 -1
  100. package/dist/SearchableListBase.d.ts +9 -0
  101. package/dist/SearchableListBase.js +15 -3
  102. package/dist/SearchableListBase.js.map +1 -1
  103. package/dist/SecondaryNavigation.d.ts +0 -1
  104. package/dist/SecondaryNavigation.js +2 -4
  105. package/dist/SecondaryNavigation.js.map +1 -1
  106. package/dist/TextField.d.ts +7 -0
  107. package/dist/TextField.js +3 -0
  108. package/dist/TextField.js.map +1 -1
  109. package/dist/Wizard.d.ts +20 -1
  110. package/dist/Wizard.js +22 -9
  111. package/dist/Wizard.js.map +1 -1
  112. package/dist/WizardTemplate.js +1 -1
  113. package/dist/WizardTemplate.js.map +1 -1
  114. package/dist/assets/{InputSuggestions-KGCQrV_T.js → InputSuggestions-CYW_6A8K.js} +1 -1
  115. package/dist/assets/{ListItemStandardExpandableTextTemplate-D4zLIdLd.js → ListItemStandardExpandableTextTemplate-BDrgWGjT.js} +1 -1
  116. package/dist/assets/{bundle.esm-Diw1zQ-o.js → bundle.esm-DRCvw6Ji.js} +235 -225
  117. package/dist/assets/messagebundle_en-BK8-Eyic.js +1 -0
  118. package/dist/css/themes/Accordion.css +1 -1
  119. package/dist/css/themes/Button.css +1 -1
  120. package/dist/css/themes/Contact.css +1 -0
  121. package/dist/css/themes/ContactItem.css +1 -0
  122. package/dist/css/themes/DatePickerPopover.css +1 -1
  123. package/dist/css/themes/EventRibbon.css +1 -0
  124. package/dist/css/themes/MastheadCountrySelector.css +1 -1
  125. package/dist/css/themes/MastheadItem.css +1 -1
  126. package/dist/css/themes/MastheadShell.css +1 -1
  127. package/dist/css/themes/Modal.css +1 -1
  128. package/dist/css/themes/Pagination.css +1 -1
  129. package/dist/css/themes/RatingIndicator.css +1 -1
  130. package/dist/css/themes/Slider.css +1 -1
  131. package/dist/css/themes/TextField.css +1 -1
  132. package/dist/custom-elements-internal.json +823 -99
  133. package/dist/custom-elements.json +783 -83
  134. package/dist/data/CountryListISO3166.d.ts +13 -4
  135. package/dist/data/CountryListISO3166.js +8 -0
  136. package/dist/data/CountryListISO3166.js.map +1 -1
  137. package/dist/generated/assets/i18n/messagebundle_en.json +1 -1
  138. package/dist/generated/i18n/i18n-defaults.d.ts +3 -1
  139. package/dist/generated/i18n/i18n-defaults.js +3 -1
  140. package/dist/generated/i18n/i18n-defaults.js.map +1 -1
  141. package/dist/generated/templates/AccordionTemplate.lit.js +4 -2
  142. package/dist/generated/templates/AccordionTemplate.lit.js.map +1 -1
  143. package/dist/generated/templates/MastheadItemTemplate.lit.js +25 -22
  144. package/dist/generated/templates/MastheadItemTemplate.lit.js.map +1 -1
  145. package/dist/generated/templates/PaginationTemplate.lit.js +1 -1
  146. package/dist/generated/templates/PaginationTemplate.lit.js.map +1 -1
  147. package/dist/generated/templates/PhoneNumberFieldTemplate.lit.js +2 -2
  148. package/dist/generated/templates/PhoneNumberFieldTemplate.lit.js.map +1 -1
  149. package/dist/generated/themes/Accordion.css.d.ts +1 -1
  150. package/dist/generated/themes/Accordion.css.js +1 -1
  151. package/dist/generated/themes/Accordion.css.js.map +1 -1
  152. package/dist/generated/themes/Button.css.d.ts +1 -1
  153. package/dist/generated/themes/Button.css.js +1 -1
  154. package/dist/generated/themes/Button.css.js.map +1 -1
  155. package/dist/generated/themes/Contact.css.d.ts +2 -0
  156. package/dist/generated/themes/Contact.css.js +8 -0
  157. package/dist/generated/themes/Contact.css.js.map +1 -0
  158. package/dist/generated/themes/ContactItem.css.d.ts +2 -0
  159. package/dist/generated/themes/ContactItem.css.js +8 -0
  160. package/dist/generated/themes/ContactItem.css.js.map +1 -0
  161. package/dist/generated/themes/DatePickerPopover.css.d.ts +1 -1
  162. package/dist/generated/themes/DatePickerPopover.css.js +1 -1
  163. package/dist/generated/themes/DatePickerPopover.css.js.map +1 -1
  164. package/dist/generated/themes/EventRibbon.css.d.ts +2 -0
  165. package/dist/generated/themes/EventRibbon.css.js +8 -0
  166. package/dist/generated/themes/EventRibbon.css.js.map +1 -0
  167. package/dist/generated/themes/MastheadCountrySelector.css.d.ts +1 -1
  168. package/dist/generated/themes/MastheadCountrySelector.css.js +1 -1
  169. package/dist/generated/themes/MastheadCountrySelector.css.js.map +1 -1
  170. package/dist/generated/themes/MastheadItem.css.d.ts +1 -1
  171. package/dist/generated/themes/MastheadItem.css.js +1 -1
  172. package/dist/generated/themes/MastheadItem.css.js.map +1 -1
  173. package/dist/generated/themes/MastheadShell.css.d.ts +1 -1
  174. package/dist/generated/themes/MastheadShell.css.js +1 -1
  175. package/dist/generated/themes/MastheadShell.css.js.map +1 -1
  176. package/dist/generated/themes/Modal.css.d.ts +1 -1
  177. package/dist/generated/themes/Modal.css.js +1 -1
  178. package/dist/generated/themes/Modal.css.js.map +1 -1
  179. package/dist/generated/themes/Pagination.css.d.ts +1 -1
  180. package/dist/generated/themes/Pagination.css.js +1 -1
  181. package/dist/generated/themes/Pagination.css.js.map +1 -1
  182. package/dist/generated/themes/RatingIndicator.css.d.ts +1 -1
  183. package/dist/generated/themes/RatingIndicator.css.js +1 -1
  184. package/dist/generated/themes/RatingIndicator.css.js.map +1 -1
  185. package/dist/generated/themes/Slider.css.d.ts +1 -1
  186. package/dist/generated/themes/Slider.css.js +1 -1
  187. package/dist/generated/themes/Slider.css.js.map +1 -1
  188. package/dist/generated/themes/TextField.css.d.ts +1 -1
  189. package/dist/generated/themes/TextField.css.js +1 -1
  190. package/dist/generated/themes/TextField.css.js.map +1 -1
  191. package/dist/messagebundle.properties +5 -0
  192. package/dist/messagebundle_en.properties +3 -0
  193. package/dist/types/ContactItemIcon.d.ts +6 -0
  194. package/dist/types/ContactItemIcon.js +8 -0
  195. package/dist/types/ContactItemIcon.js.map +1 -0
  196. package/dist/types/EventRibbon.d.ts +37 -0
  197. package/dist/types/EventRibbon.js +43 -0
  198. package/dist/types/EventRibbon.js.map +1 -0
  199. package/dist/utils/parseArrayFromString.d.ts +2 -0
  200. package/dist/utils/parseArrayFromString.js +5 -0
  201. package/dist/utils/parseArrayFromString.js.map +1 -0
  202. package/dist/vscode.html-custom-data.json +183 -1
  203. package/dist/web-types.json +321 -2
  204. package/filter-coverage.js +58 -0
  205. package/package.json +8 -3
  206. package/src/Accordion.hbs +13 -9
  207. package/src/Accordion.ts +7 -4
  208. package/src/Assets.ts +29 -0
  209. package/src/AssetsVariables.ts +4 -0
  210. package/src/Button.ts +9 -0
  211. package/src/Contact.ts +200 -0
  212. package/src/ContactItem.ts +119 -0
  213. package/src/ContactItemTemplate.tsx +22 -0
  214. package/src/ContactTemplate.tsx +105 -0
  215. package/src/CountrySelector.ts +5 -8
  216. package/src/DatePicker.ts +2 -1
  217. package/src/EventRibbon.ts +143 -0
  218. package/src/EventRibbonTemplate.tsx +18 -0
  219. package/src/Footer.ts +7 -10
  220. package/src/List.ts +1 -1
  221. package/src/MastheadItem.hbs +8 -0
  222. package/src/MastheadItem.ts +8 -16
  223. package/src/MastheadMenu.ts +2 -5
  224. package/src/MastheadProfileMenu.ts +2 -5
  225. package/src/MastheadShell.ts +25 -5
  226. package/src/Pagination.hbs +7 -3
  227. package/src/Pagination.ts +48 -31
  228. package/src/PhoneNumberField.hbs +1 -1
  229. package/src/PhoneNumberField.ts +7 -2
  230. package/src/SearchableListBase.ts +24 -3
  231. package/src/SecondaryNavigation.ts +3 -5
  232. package/src/TextField.ts +9 -0
  233. package/src/Wizard.ts +39 -11
  234. package/src/WizardTemplate.tsx +5 -1
  235. package/src/data/CountryListISO3166.ts +10 -2
  236. package/src/generated/i18n/i18n-defaults.ts +2 -2
  237. package/src/generated/templates/AccordionTemplate.lit.ts +4 -2
  238. package/src/generated/templates/MastheadItemTemplate.lit.ts +25 -22
  239. package/src/generated/templates/PaginationTemplate.lit.ts +1 -1
  240. package/src/generated/templates/PhoneNumberFieldTemplate.lit.ts +1 -1
  241. package/src/generated/themes/Accordion.css.ts +1 -1
  242. package/src/generated/themes/Button.css.ts +1 -1
  243. package/src/generated/themes/Contact.css.ts +9 -0
  244. package/src/generated/themes/ContactItem.css.ts +9 -0
  245. package/src/generated/themes/DatePickerPopover.css.ts +1 -1
  246. package/src/generated/themes/EventRibbon.css.ts +9 -0
  247. package/src/generated/themes/MastheadCountrySelector.css.ts +1 -1
  248. package/src/generated/themes/MastheadItem.css.ts +1 -1
  249. package/src/generated/themes/MastheadShell.css.ts +1 -1
  250. package/src/generated/themes/Modal.css.ts +1 -1
  251. package/src/generated/themes/Pagination.css.ts +1 -1
  252. package/src/generated/themes/RatingIndicator.css.ts +1 -1
  253. package/src/generated/themes/Slider.css.ts +1 -1
  254. package/src/generated/themes/TextField.css.ts +1 -1
  255. package/src/i18n/messagebundle.properties +5 -0
  256. package/src/i18n/messagebundle_en.properties +3 -0
  257. package/src/themes/Accordion.css +1 -0
  258. package/src/themes/Button.css +74 -26
  259. package/src/themes/Contact.css +184 -0
  260. package/src/themes/ContactItem.css +44 -0
  261. package/src/themes/DatePickerPopover.css +64 -6
  262. package/src/themes/EventRibbon.css +411 -0
  263. package/src/themes/MastheadCountrySelector.css +8 -5
  264. package/src/themes/MastheadItem.css +12 -4
  265. package/src/themes/MastheadShell.css +3 -1
  266. package/src/themes/Modal.css +8 -4
  267. package/src/themes/Pagination.css +19 -0
  268. package/src/themes/TextField.css +2 -13
  269. package/src/types/ContactItemIcon.ts +7 -0
  270. package/src/types/EventRibbon.ts +51 -0
  271. package/src/utils/parseArrayFromString.ts +5 -0
  272. package/swap-component-imports.js +18 -0
  273. package/dist/assets/messagebundle_en-CVKgy_9L.js +0 -1
package/.eslintignore CHANGED
@@ -2,9 +2,12 @@
2
2
 
3
3
  config
4
4
  dist
5
+ instrumented
6
+ coverage
5
7
  test
6
8
  src/generated
7
9
  jsdoc-dist
10
+ .nyc_output
8
11
  .eslintrc.cjs
9
12
  package-scripts.cjs
10
13
  bundle.esm.js
package/bundle.esm.js CHANGED
@@ -32,11 +32,14 @@ import "./dist/BreadcrumbsItem.js";
32
32
  import "./dist/Button.js";
33
33
  import "./dist/Carousel.js";
34
34
  import "./dist/Checkbox.js";
35
+ import "./dist/Contact.js";
36
+ import "./dist/ContactItem.js";
35
37
  import "./dist/ControlButton.js";
36
38
  import "./dist/CountrySelector.js";
37
39
  import "./dist/DatePicker.js";
38
40
  import "./dist/Divider.js";
39
41
  import "./dist/Dropdown.js";
42
+ import "./dist/EventRibbon.js";
40
43
  import "./dist/FilterMenu.js";
41
44
  import "./dist/FilterMenuGroupHeader.js";
42
45
  import "./dist/FilterMenuItem.js";
@@ -0,0 +1,10 @@
1
+ export const contactNumbers = [
2
+ {
3
+ "country":"Local Country Name",
4
+ "number":"+1-800-872-1727"
5
+ },
6
+ {
7
+ "country":"United States",
8
+ "number":"+1-800-872-1727"
9
+ }
10
+ ];
@@ -0,0 +1,5 @@
1
+ export const eventLink = {
2
+ target: "_blank",
3
+ url: "#",
4
+ text: "Learn more",
5
+ }
@@ -1,5 +1,4 @@
1
- import UDExAccordion from "../../src/Accordion.js";
2
- import UDExAccordionItem from "../../src/AccordionItem.js";
1
+ import { UDExAccordion, UDExAccordionItem } from "../support/component-imports.js";
3
2
 
4
3
  const defaultAccordion = <UDExAccordion headline="Test headline" id="accordionComponent">
5
4
  <UDExAccordionItem label="Some label for item 1" numberBadge="72">
@@ -19,6 +18,15 @@ const defaultAccordion = <UDExAccordion headline="Test headline" id="accordionCo
19
18
  </UDExAccordionItem>
20
19
  </UDExAccordion>
21
20
 
21
+ const simpleAccordion = <UDExAccordion hide-expand-button id="accordionComponent">
22
+ <UDExAccordionItem label="Some label for item 1">
23
+ <div>some content<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Amet aperiam aut eum ipsum natus necessitatibus neque officiis repellendus totam voluptatum!</p></div>
24
+ </UDExAccordionItem>
25
+ <UDExAccordionItem label="Some label for item 2">
26
+ <div>some content<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Amet aperiam aut eum ipsum natus necessitatibus neque officiis repellendus totam voluptatum!</p></div>
27
+ </UDExAccordionItem>
28
+ </UDExAccordion>
29
+
22
30
  describe("Accordion", () => {
23
31
  beforeEach(() => {
24
32
  cy.mount(defaultAccordion)
@@ -139,4 +147,19 @@ describe("Accordion", () => {
139
147
  cy.get("[udex-accordion]").shadow().find(".udex-accordion__btn").click()
140
148
  cy.get("@toggleItems").should("have.been.called")
141
149
  });
150
+ });
151
+
152
+ describe("Accordion - simplified", () => {
153
+ beforeEach(() => {
154
+ cy.mount(simpleAccordion)
155
+ })
156
+
157
+ it("does not render empty headline", () => {
158
+ cy.get("[udex-accordion]").shadow().find(".udex-accordion__headline").should("not.exist");
159
+ });
160
+
161
+
162
+ it("hide expand all button", () => {
163
+ cy.get("[udex-accordion]").shadow().find(".udex-accordion__btn").should("not.exist");
164
+ });
142
165
  });
@@ -1,4 +1,4 @@
1
- import UDExAccordionItem from "../../src/AccordionItem.js";
1
+ import { UDExAccordionItem } from "../support/component-imports.js";
2
2
 
3
3
  const accordionItem = <UDExAccordionItem label="Some label for item 1" numberBadge="72">
4
4
  <div>some content<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Amet aperiam aut eum ipsum natus necessitatibus neque officiis repellendus totam voluptatum!</p></div>
@@ -1,4 +1,4 @@
1
- import UDExAvatar from "../../src/Avatar.js";
1
+ import { UDExAvatar } from "../support/component-imports.js";
2
2
 
3
3
  describe("Avatar", () => {
4
4
  it("renders correctly", () => {
@@ -1,5 +1,4 @@
1
- import UDExAvatar from "../../src/Avatar.js";
2
- import UDExAvatarGroup from "../../src/AvatarGroup.js";
1
+ import { UDExAvatar, UDExAvatarGroup } from "../support/component-imports.js";
3
2
 
4
3
  const defaultAvatarGroup = <UDExAvatarGroup>
5
4
  <UDExAvatar initials="SM"></UDExAvatar>
@@ -1,4 +1,4 @@
1
- import UDExBadge from "../../src/Badge.js";
1
+ import { UDExBadge } from "../support/component-imports.js";
2
2
  import "@ui5/webcomponents-icons/employee.js";
3
3
 
4
4
  const defaultBadge = <UDExBadge id="badge" icon="employee">Default</UDExBadge>
@@ -0,0 +1,92 @@
1
+ import { UDExContact, UDExContactItem } from "../support/component-imports.js";
2
+ import { contactNumbers } from "../fixtures/contact-numbers.js";
3
+
4
+ const contactComponent = <UDExContact
5
+ button-text="Contact us"
6
+ local-country-numbers-link="local-country-numbers-link-href"
7
+ contact-numbers={JSON.stringify(contactNumbers)}
8
+ >
9
+ <UDExContactItem label="Call me now" href="www.sap.com" icon="Headset">SAP can call you to discuss any questions you have.</UDExContactItem>
10
+ <UDExContactItem label="Chat now" icon="Discussion-2">Get live help and chat with an SAP representative.</UDExContactItem>
11
+ <UDExContactItem label="Contact us" href="www.sap.com" icon="Email">E-mail us with comments, questions or feedback.</UDExContactItem>
12
+ </UDExContact>
13
+
14
+ describe("Contact component", () => {
15
+ beforeEach(() => {
16
+ cy.mount(contactComponent)
17
+ });
18
+
19
+ it("component is correctly rendered", () => {
20
+ cy.get("[udex-contact]").shadow().find(".udex-contact").should("be.visible");
21
+ });
22
+
23
+ it("renders the text for component", () => {
24
+ cy.get("[udex-contact]").shadow().find("[udex-button]").should("have.text", "Contact us");
25
+ });
26
+
27
+ it("test if the popover is closed after pressing \"Escape\" key", () => {
28
+ cy.get("[udex-contact]").shadow().find(".udex-contact__button").click().realPress("Escape");
29
+ cy.get("[udex-contact]").shadow().find("[ui5-responsive-popover]").should("not.visible");
30
+ });
31
+
32
+ describe("Desktop tests", () => {
33
+ beforeEach(() => {
34
+ cy.viewport(1920, 1080);
35
+ cy.get("[udex-contact]").shadow().find(".udex-contact__button").click();
36
+ });
37
+
38
+ it("renders the popover after clicking the button opener", () => {
39
+ cy.get("[udex-contact]").shadow().find("[ui5-responsive-popover]").should("be.visible");
40
+ });
41
+
42
+ it("renders the popover after clicking the button opener", () => {
43
+ cy.get("[udex-contact]").shadow().find("[ui5-responsive-popover]").should("be.visible");
44
+ });
45
+
46
+ it("renders right amount of contact items", () => {
47
+ cy.get("[udex-contact]").find("udex-contact-item").should("have.length", 3);
48
+ });
49
+
50
+ it("renders the title of phone section", () => {
51
+ cy.get("[udex-contact]").shadow().find(".udex-contact__call-us-title").should("have.text", "Call us today!");
52
+ });
53
+
54
+ it("renders the text of complete list section", () => {
55
+ cy.get("[udex-contact]").shadow().find(".udex-contact__complete-list").should("have.text", "Complete list of local country numbers");
56
+ });
57
+
58
+ it("renders the href of complete list link", () => {
59
+ cy.get("[udex-contact]").shadow().find(".udex-contact__local-country-link").should("have.attr", "href", "local-country-numbers-link-href");
60
+ });
61
+
62
+ it("renders the list of phone numbers", () => {
63
+ const numbers = cy.get("[udex-contact]").shadow().find(".udex-contact__number-wrapper");
64
+ numbers.each(($item, index) => {
65
+ const currentContactNumber = contactNumbers[index];
66
+ const country = $item.find(".udex-contact__country").text();
67
+ const number = $item.find(".udex-contact__number").text();
68
+ expect(country).to.include(currentContactNumber.country);
69
+ expect(number).to.include(currentContactNumber.number);
70
+ })
71
+ });
72
+ });
73
+
74
+ describe("Mobile tests", () => {
75
+ beforeEach(() => {
76
+ cy.simulateDevice();
77
+ });
78
+
79
+ it("renders the close mobile button", () => {
80
+ cy.get("[udex-contact]").shadow().find(".udex-contact__button").click();
81
+ cy.get("[udex-contact]").shadow().find(".udex-contact__close-btn").should("be.visible");
82
+ });
83
+
84
+ it("renders the tooltip for the opener button", () => {
85
+ cy.get("[udex-contact]").shadow().find(".udex-contact__button").should("have.attr", "tooltip", "Contact us");
86
+ });
87
+
88
+ it("renders the accessibleName for the opener button", () => {
89
+ cy.get("[udex-contact]").shadow().find(".udex-contact__button").should("have.attr", "accessible-name", "Contact us");
90
+ });
91
+ });
92
+ });
@@ -0,0 +1,56 @@
1
+ import { UDExContactItem } from "../support/component-imports.js";
2
+
3
+ const contactItemComponent = <UDExContactItem label="Call me now" href="www.sap.com" icon="Headset">SAP can call you to discuss any questions you have.</UDExContactItem>
4
+
5
+ describe("Contact Item component", () => {
6
+ beforeEach(() => {
7
+ cy.mount(contactItemComponent)
8
+ })
9
+
10
+ it("component is correctly rendered", () => {
11
+ cy.get("[udex-contact-item]").shadow().find(".udex-contact-item").should("be.visible");
12
+ });
13
+
14
+ it("renders the text for the item", () => {
15
+ cy.get("[udex-contact-item]").shadow().find(".udex-contact-item__description").should("be.visible");
16
+ });
17
+
18
+ it("renders the link text for the item", () => {
19
+ cy.get("[udex-contact-item]").shadow().find(".udex-contact-item__link").should("have.text", "Call me now");
20
+ });
21
+
22
+ it("renders the href for the link", () => {
23
+ cy.get("[udex-contact-item]").shadow().find(".udex-contact-item__link").should("have.attr", "href", "www.sap.com");
24
+ });
25
+
26
+ it("renders the icon for the item", () => {
27
+ cy.get("[udex-contact-item]").shadow().find(".udex-contact-item__icon").should("be.visible");
28
+ });
29
+
30
+ it("renders the name for the icon", () => {
31
+ cy.get("[udex-contact-item]").shadow().find(".udex-contact-item__icon").should("have.attr", "name", "headset");
32
+ });
33
+
34
+ it("test the contact item has custom \"item-click\" event with mouse click on the link", () => {
35
+ cy.get("[udex-contact-item]").shadow().find(".udex-contact-item__link")
36
+ .then($link => {
37
+ $link.get(0).addEventListener("item-click", event => {
38
+ expect(event.type).to.equal("item-click");
39
+ });
40
+ });
41
+
42
+ cy.get("[udex-contact-item]").shadow().find(".udex-contact-item__link").click();
43
+ });
44
+
45
+ it("tests the \"item-click\" event is prevented when prevent default is called", () => {
46
+ cy.get("[udex-contact-item]").shadow().find(".udex-contact-item__link")
47
+ .then($link => {
48
+ $link.get(0).addEventListener("item-click", event => {
49
+ event.preventDefault();
50
+ });
51
+ });
52
+
53
+ cy.get("[udex-contact-item]").shadow().find(".udex-contact-item__link").click();
54
+ cy.url().should("not.include", "www.sap.com");
55
+ });
56
+ });
@@ -1,4 +1,4 @@
1
- import UDExCountrySelector from "../../src/CountrySelector.js";
1
+ import { UDExCountrySelector } from "../support/component-imports.js";
2
2
 
3
3
  const defaultCountrySelector = <UDExCountrySelector id="default"
4
4
  searchPlaceholder="Search Countries and Regions"
@@ -159,7 +159,9 @@ describe("CountrySelector", () => {
159
159
 
160
160
  it('emits change-search when search field typing', () => {
161
161
  const changeHandler = cy.stub().as("changeHandler")
162
- document.addEventListener("change-search", changeHandler)
162
+ cy.get("#default").then($countrySelector => {
163
+ $countrySelector[0].addEventListener("change-search", changeHandler)
164
+ })
163
165
  cy.get("#default").shadow().find("#udexTextField").click()
164
166
  cy.get("#default").shadow().find("udex-search").shadow().find(".udex-search__field").click().realPress("p").realPress("o").realPress("l").realPress("a")
165
167
  cy.get("@changeHandler").should("have.been.called")
@@ -167,7 +169,9 @@ describe("CountrySelector", () => {
167
169
 
168
170
  it("emits reset-search when search reset button is clicked", () => {
169
171
  const resetHandler = cy.stub().as("resetHandler")
170
- document.addEventListener("reset-search", resetHandler)
172
+ cy.get("#default").then($countrySelector => {
173
+ $countrySelector[0].addEventListener("reset-search", resetHandler)
174
+ })
171
175
  cy.get("#default").shadow().find("#udexTextField").click()
172
176
  cy.get("#default").shadow().find("udex-search").shadow().find(".udex-search__field").click().realPress("p").realPress("o").realPress("l").realPress("a")
173
177
  cy.get("#default").shadow().find("udex-search").shadow().find(".udex-search__reset-button").click()
@@ -176,7 +180,9 @@ describe("CountrySelector", () => {
176
180
 
177
181
  it('emits submit-search when user presses Enter key in the search', () => {
178
182
  const submitHandler = cy.stub().as("submitHandler")
179
- document.addEventListener("submit-search", submitHandler)
183
+ cy.get("#default").then($countrySelector => {
184
+ $countrySelector[0].addEventListener("submit-search", submitHandler)
185
+ })
180
186
  cy.get("#default").shadow().find("#udexTextField").click()
181
187
  cy.get("#default").shadow().find("udex-search").shadow().find(".udex-search__field").click().realPress("p").realPress("o").realPress("l").realPress("a").realPress("Enter")
182
188
  cy.get("@submitHandler").should("have.been.called")
@@ -0,0 +1,110 @@
1
+ import { UDExEventRibbon } from "../support/component-imports.js";
2
+ import { eventLink } from "../fixtures/event-ribbon-links.js";
3
+
4
+ const defaultEventRibbon = <UDExEventRibbon
5
+ eventText="Get your free all-access pass to a network of latest innovations and insights"
6
+ eventLogo="now"
7
+ eventLink={JSON.stringify(eventLink)}
8
+ backgroundColorScheme="Blue1">
9
+ </UDExEventRibbon>
10
+
11
+ const linkIconEventRibbon = <UDExEventRibbon
12
+ eventLinkIcon="add-calendar"
13
+ eventText="Get your free all-access pass to a network of latest innovations and insights"
14
+ eventLogo="now"
15
+ eventLink={JSON.stringify(eventLink)}
16
+ backgroundColorScheme="Blue3">
17
+ </UDExEventRibbon>
18
+
19
+ const linkIconMediaEventRibbon = <UDExEventRibbon
20
+ eventLinkIcon="media-play"
21
+ eventText="Get your free all-access pass to a network of latest innovations and insights"
22
+ eventLogo="now"
23
+ eventLink={JSON.stringify(eventLink)}
24
+ backgroundColorScheme="Blue3">
25
+ </UDExEventRibbon>
26
+
27
+ const darkEventRibbon = <UDExEventRibbon
28
+ mode="dark"
29
+ eventText="Get your free all-access pass to a network of latest innovations and insights"
30
+ eventLogo="now"
31
+ eventLink={JSON.stringify(eventLink)}
32
+ backgroundColorScheme="Raspberry2">
33
+ </UDExEventRibbon>
34
+
35
+ const imageEventRibbon = <UDExEventRibbon
36
+ eventText="Get your free all-access pass to a network of latest innovations and insights"
37
+ eventLogo="now"
38
+ eventLink={JSON.stringify(eventLink)}
39
+ backgroundColorScheme="Blue1"
40
+ backgroundImage="https://cdn.udex.services.sap.com/dds/design-tokens/assets/logos/sap-logo.svg">
41
+ </UDExEventRibbon>
42
+
43
+ describe("EventRibbon", () => {
44
+ it("is correctly rendered", () => {
45
+ cy.mount(defaultEventRibbon)
46
+ cy.get("[udex-event-ribbon]").shadow().find(".udex-event-ribbon__container").should("be.visible");
47
+ });
48
+
49
+ xit("renders light mode by default", () => {
50
+ cy.mount(defaultEventRibbon)
51
+ cy.get("[udex-event-ribbon]").shadow().find(".udex-event-ribbon__container").then($eventRibbon => {
52
+ const {backgroundColor} = window.getComputedStyle($eventRibbon[0])
53
+ expect(backgroundColor).eqls("rgb(85, 107, 129)")
54
+ })
55
+ });
56
+
57
+ xit("correctly darkens light solid background by 1 shade on hover", () => {
58
+ cy.mount(defaultEventRibbon)
59
+ cy.get("[udex-event-ribbon]").shadow().find(".udex-event-ribbon__container").realHover().then($eventRibbon => {
60
+ const {backgroundColor} = window.getComputedStyle($eventRibbon[0])
61
+ expect(backgroundColor).eqls("rgb(85, 107, 129)")
62
+ })
63
+ });
64
+
65
+ it("doesn't render event link icon by default", () => {
66
+ cy.mount(defaultEventRibbon)
67
+ cy.get("[udex-event-ribbon]").shadow().find(".udex-event-ribbon__container").find("ui5-icon").should("not.exist");
68
+ });
69
+
70
+ it("correctly renders add-calendar icon", () => {
71
+ cy.mount(linkIconEventRibbon)
72
+ cy.get("[udex-event-ribbon]").shadow().find(".udex-event-ribbon__container").find("ui5-icon").should("have.attr", "name", "add-calendar");
73
+ });
74
+
75
+ it("correctly renders media-play icon", () => {
76
+ cy.mount(linkIconMediaEventRibbon)
77
+ cy.get("[udex-event-ribbon]").shadow().find(".udex-event-ribbon__container").find("ui5-icon").should("have.attr", "name", "media-play");
78
+ });
79
+
80
+ xit("correctly renders dark solid background", () => {
81
+ cy.mount(darkEventRibbon)
82
+ cy.get("[udex-event-ribbon]").shadow().find(".udex-event-ribbon__container").then($eventRibbon => {
83
+ const {backgroundColor} = window.getComputedStyle($eventRibbon[0])
84
+ expect(backgroundColor).eqls("rgb(85, 107, 129)")
85
+ })
86
+ });
87
+
88
+ xit("correctly darkens dark solid background by 1 shade on hover", () => {
89
+ cy.mount(darkEventRibbon)
90
+ cy.get("[udex-event-ribbon]").shadow().find(".udex-event-ribbon__container").realHover().then($eventRibbon => {
91
+ const {backgroundColor} = window.getComputedStyle($eventRibbon[0])
92
+ expect(backgroundColor).eqls("rgb(85, 107, 129)")
93
+ })
94
+ });
95
+
96
+ it("correctly renders background image", () => {
97
+ cy.mount(imageEventRibbon)
98
+ cy.get("[udex-event-ribbon]").shadow().find(".udex-event-ribbon__container").then($eventRibbon => {
99
+ const { backgroundImage } = window.getComputedStyle($eventRibbon[0])
100
+ assert.strictEqual(backgroundImage, 'url("https://cdn.udex.services.sap.com/dds/design-tokens/assets/logos/sap-logo.svg")')
101
+ })
102
+ });
103
+
104
+ it("correctly parses eventLink object", () => {
105
+ cy.mount(defaultEventRibbon)
106
+ cy.get("[udex-event-ribbon]").shadow().find(".udex-event-ribbon__container").should("have.attr", "target", "_blank");
107
+ cy.get("[udex-event-ribbon]").shadow().find(".udex-event-ribbon__container").should("have.attr", "href", "#");
108
+ cy.get("[udex-event-ribbon]").shadow().find(".udex-event-ribbon__container").should("have.attr", "title", "Learn more");
109
+ });
110
+ })
@@ -1,4 +1,4 @@
1
- import UDExFooter from "../../src/Footer.js";
1
+ import { UDExFooter } from "../support/component-imports.js";
2
2
  import { quickLinks, trendingLinks, aboutLinks, siteInformationLinks, socialLinks } from "../fixtures/footer-links.js";
3
3
  import { setLanguage } from "@ui5/webcomponents-base/dist/config/Language.js";
4
4
 
@@ -1,4 +1,4 @@
1
- import UDExListItem from "../../src/ListItem.js"
1
+ import { UDExListItem } from "../support/component-imports.js";
2
2
  import UDExButton from "../../src/Button.js"
3
3
 
4
4
  const defaultListItem = <UDExListItem
@@ -1,4 +1,4 @@
1
- import UDExPhoneNumberField from "../../src/PhoneNumberField.js";
1
+ import { UDExPhoneNumberField } from "../support/component-imports.js";
2
2
 
3
3
  const defaultPhoneNumberField = <UDExPhoneNumberField id="default"
4
4
  valueState="Standard"
@@ -128,8 +128,10 @@ describe("PhoneNumberField", () => {
128
128
 
129
129
  it("emit input when the value of the component changes", () => {
130
130
  const inputHandler = cy.stub().as("inputHandler")
131
- document.addEventListener("input", inputHandler)
132
131
  cy.mount(<UDExPhoneNumberField></UDExPhoneNumberField>)
132
+ cy.get("[udex-phone-number-field]").then($phoneNumberField => {
133
+ $phoneNumberField[0].addEventListener("input", inputHandler)
134
+ })
133
135
  cy.get("[udex-phone-number-field]").shadow().find("input").click().type("012")
134
136
  cy.get("@inputHandler").should("have.been.called")
135
137
  });
@@ -1,6 +1,4 @@
1
- import UDExButton from "../../src/Button.js";
2
- import UDExRatingBar from "../../src/RatingBar.js";
3
- import UDExReview from "../../src/Review.js";
1
+ import { UDExButton, UDExRatingBar, UDExReview } from "../support/component-imports.js";
4
2
 
5
3
  const defaultReview = <UDExReview id="review-standard" rating={4.5} reviews={200}>
6
4
  <span slot="defaultText">Share your thought with other customers</span>
@@ -1,4 +1,4 @@
1
- import UDExReviewItem from "../../src/ReviewItem.js";
1
+ import { UDExReviewItem } from "../support/component-imports.js";
2
2
 
3
3
  const defaultReviewItem = <UDExReviewItem
4
4
  id="review-item"