@sapudex/web-components 2.11.0 → 2.12.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 (131) hide show
  1. package/cypress/fixtures/profile-menu.ts +75 -0
  2. package/cypress/specs/ListItem.cy.tsx +66 -52
  3. package/cypress/specs/MastheadProfileMenu.cy.tsx +174 -0
  4. package/cypress/specs/SelectBox.cy.tsx +134 -66
  5. package/cypress/support/component-imports.instrumented.ts +4 -0
  6. package/cypress/support/component-imports.src.ts +4 -0
  7. package/dist/Button.d.ts +8 -0
  8. package/dist/Button.js +11 -0
  9. package/dist/Button.js.map +1 -1
  10. package/dist/List.d.ts +9 -2
  11. package/dist/List.js +19 -8
  12. package/dist/List.js.map +1 -1
  13. package/dist/ListGroupHeader.d.ts +2 -1
  14. package/dist/ListGroupHeader.js.map +1 -1
  15. package/dist/ListItem.d.ts +12 -1
  16. package/dist/ListItem.js +15 -1
  17. package/dist/ListItem.js.map +1 -1
  18. package/dist/ListItemBase.d.ts +10 -0
  19. package/dist/ListItemBase.js +31 -0
  20. package/dist/ListItemBase.js.map +1 -1
  21. package/dist/ListSelectAll.d.ts +2 -1
  22. package/dist/ListSelectAll.js.map +1 -1
  23. package/dist/MastheadItem.d.ts +2 -0
  24. package/dist/MastheadItem.js +6 -0
  25. package/dist/MastheadItem.js.map +1 -1
  26. package/dist/MastheadProfileMenu.d.ts +67 -3
  27. package/dist/MastheadProfileMenu.js +164 -10
  28. package/dist/MastheadProfileMenu.js.map +1 -1
  29. package/dist/MastheadShell.d.ts +1 -0
  30. package/dist/MastheadShell.js +6 -1
  31. package/dist/MastheadShell.js.map +1 -1
  32. package/dist/SearchableListBase.d.ts +16 -0
  33. package/dist/SearchableListBase.js +31 -1
  34. package/dist/SearchableListBase.js.map +1 -1
  35. package/dist/SelectBox.js +10 -0
  36. package/dist/SelectBox.js.map +1 -1
  37. package/dist/SelectBoxItem.d.ts +29 -0
  38. package/dist/SelectBoxItem.js +26 -0
  39. package/dist/SelectBoxItem.js.map +1 -1
  40. package/dist/StatusBadge.d.ts +1 -7
  41. package/dist/StatusBadge.js +1 -8
  42. package/dist/StatusBadge.js.map +1 -1
  43. package/dist/StepInputTemplate.js +1 -1
  44. package/dist/StepInputTemplate.js.map +1 -1
  45. package/dist/assets/{InputSuggestions-9WQMOg4t.js → InputSuggestions-CgAp8PwR.js} +1 -1
  46. package/dist/assets/{ListItemStandardExpandableTextTemplate-BQaMMo_n.js → ListItemStandardExpandableTextTemplate-D5HEHY33.js} +1 -1
  47. package/dist/assets/{bundle.esm-ZNiP-jPI.js → bundle.esm-CjcqU0ib.js} +210 -210
  48. package/dist/assets/messagebundle_en-PmkE-Vht.js +1 -0
  49. package/dist/css/themes/Button.css +1 -1
  50. package/dist/css/themes/ListItem.css +1 -1
  51. package/dist/css/themes/MastheadProfileMenu.css +1 -1
  52. package/dist/css/themes/RatingIndicator.css +1 -1
  53. package/dist/css/themes/Slider.css +1 -1
  54. package/dist/css/themes/StepInput.css +1 -1
  55. package/dist/custom-elements-internal.json +907 -123
  56. package/dist/custom-elements.json +738 -108
  57. package/dist/generated/assets/i18n/messagebundle_en.json +1 -1
  58. package/dist/generated/i18n/i18n-defaults.d.ts +5 -1
  59. package/dist/generated/i18n/i18n-defaults.js +5 -1
  60. package/dist/generated/i18n/i18n-defaults.js.map +1 -1
  61. package/dist/generated/templates/ListItemTemplate.lit.js +31 -23
  62. package/dist/generated/templates/ListItemTemplate.lit.js.map +1 -1
  63. package/dist/generated/templates/ListTemplate.lit.js +2 -2
  64. package/dist/generated/templates/ListTemplate.lit.js.map +1 -1
  65. package/dist/generated/templates/MastheadProfileMenuTemplate.lit.js +11 -6
  66. package/dist/generated/templates/MastheadProfileMenuTemplate.lit.js.map +1 -1
  67. package/dist/generated/templates/SearchableListBaseTemplate.lit.js +6 -6
  68. package/dist/generated/templates/SearchableListBaseTemplate.lit.js.map +1 -1
  69. package/dist/generated/themes/Button.css.d.ts +1 -1
  70. package/dist/generated/themes/Button.css.js +1 -1
  71. package/dist/generated/themes/Button.css.js.map +1 -1
  72. package/dist/generated/themes/ListItem.css.d.ts +1 -1
  73. package/dist/generated/themes/ListItem.css.js +1 -1
  74. package/dist/generated/themes/ListItem.css.js.map +1 -1
  75. package/dist/generated/themes/MastheadProfileMenu.css.d.ts +1 -1
  76. package/dist/generated/themes/MastheadProfileMenu.css.js +1 -1
  77. package/dist/generated/themes/MastheadProfileMenu.css.js.map +1 -1
  78. package/dist/generated/themes/RatingIndicator.css.d.ts +1 -1
  79. package/dist/generated/themes/RatingIndicator.css.js +1 -1
  80. package/dist/generated/themes/RatingIndicator.css.js.map +1 -1
  81. package/dist/generated/themes/Slider.css.d.ts +1 -1
  82. package/dist/generated/themes/Slider.css.js +1 -1
  83. package/dist/generated/themes/Slider.css.js.map +1 -1
  84. package/dist/generated/themes/StepInput.css.d.ts +1 -1
  85. package/dist/generated/themes/StepInput.css.js +1 -1
  86. package/dist/generated/themes/StepInput.css.js.map +1 -1
  87. package/dist/messagebundle.properties +4 -0
  88. package/dist/messagebundle_en.properties +4 -0
  89. package/dist/types/StatusBadgeValueState.d.ts +8 -0
  90. package/dist/types/StatusBadgeValueState.js +10 -0
  91. package/dist/types/StatusBadgeValueState.js.map +1 -0
  92. package/dist/vscode.html-custom-data.json +83 -16
  93. package/dist/web-types.json +374 -30
  94. package/package.json +1 -1
  95. package/src/Button.ts +10 -0
  96. package/src/List.hbs +0 -2
  97. package/src/List.ts +27 -8
  98. package/src/ListGroupHeader.ts +2 -1
  99. package/src/ListItem.hbs +16 -2
  100. package/src/ListItem.ts +29 -2
  101. package/src/ListItemBase.ts +42 -0
  102. package/src/ListSelectAll.ts +2 -1
  103. package/src/MastheadItem.ts +9 -0
  104. package/src/MastheadProfileMenu.hbs +79 -15
  105. package/src/MastheadProfileMenu.ts +228 -13
  106. package/src/MastheadShell.ts +7 -1
  107. package/src/SearchableListBase.hbs +18 -1
  108. package/src/SearchableListBase.ts +47 -1
  109. package/src/SelectBox.ts +11 -0
  110. package/src/SelectBoxItem.ts +39 -0
  111. package/src/StatusBadge.ts +1 -8
  112. package/src/StepInputTemplate.tsx +1 -1
  113. package/src/generated/i18n/i18n-defaults.ts +2 -2
  114. package/src/generated/templates/ListItemTemplate.lit.ts +31 -23
  115. package/src/generated/templates/ListTemplate.lit.ts +2 -2
  116. package/src/generated/templates/MastheadProfileMenuTemplate.lit.ts +10 -5
  117. package/src/generated/templates/SearchableListBaseTemplate.lit.ts +6 -6
  118. package/src/generated/themes/Button.css.ts +1 -1
  119. package/src/generated/themes/ListItem.css.ts +1 -1
  120. package/src/generated/themes/MastheadProfileMenu.css.ts +1 -1
  121. package/src/generated/themes/RatingIndicator.css.ts +1 -1
  122. package/src/generated/themes/Slider.css.ts +1 -1
  123. package/src/generated/themes/StepInput.css.ts +1 -1
  124. package/src/i18n/messagebundle.properties +4 -0
  125. package/src/i18n/messagebundle_en.properties +4 -0
  126. package/src/themes/Button.css +13 -0
  127. package/src/themes/ListItem.css +4 -9
  128. package/src/themes/MastheadProfileMenu.css +87 -3
  129. package/src/themes/StepInput.css +10 -0
  130. package/src/types/StatusBadgeValueState.ts +9 -0
  131. package/dist/assets/messagebundle_en-DwlTjyni.js +0 -1
@@ -0,0 +1,75 @@
1
+ export const userData = {
2
+ name : "John Sánchez",
3
+ username : "john.miller",
4
+ email : "john.miller@sap.com",
5
+ avatarUrl : "https://avatars.profile.sap.com/d/6/idd62e808170c86bf4c00df641a1d5715e4283e241ea481a2aa4a13c9711c0acbf_small.jpeg",
6
+ avatarInitials: "JS"
7
+ };
8
+ export const columnsData = [
9
+ {
10
+ category: "Group heading",
11
+ url: "https://sap.com",
12
+ items: [
13
+ {
14
+ "title": "Lorem ipsum",
15
+ "url": "https://sap.com",
16
+ "externalLink": true
17
+ },
18
+ {
19
+ "title": "Curabitur aliquam",
20
+ "url": "https://sap.com"
21
+ },
22
+ {
23
+ "title": "Sed sodales nisisuscipit",
24
+ "url": "https://sap.com"
25
+ },
26
+ {
27
+ "title": "Lorem ipsum example of two lines in row",
28
+ "url": "https://sap.com",
29
+ "externalLink": true
30
+ },
31
+ {
32
+ "title": "Sed sodales nisisuscipit",
33
+ "url": "https://sap.com"
34
+ }
35
+ ],
36
+ },
37
+ {
38
+ items: [
39
+ {
40
+ title: "SAP Learning Journeys",
41
+ url: "https://community-qa.sap.com/topics",
42
+ },
43
+ {
44
+ title: "Training Courses",
45
+ url: "https://community-qa.sap.com/topics",
46
+ externalLink: true,
47
+ },
48
+ {
49
+ title: "SAP Learning Hub",
50
+ url: "https://community-qa.sap.com/topics",
51
+ },
52
+ {
53
+ title: "SAP Training and Adoption",
54
+ url: "https://community-qa.sap.com/topics",
55
+ },
56
+ ],
57
+ },
58
+ ];
59
+
60
+ export const identities = [
61
+ {
62
+ avatarUrl: "https://avatars.profile.sap.com/d/6/idd62e808170c86bf4c00df641a1d5715e4283e241ea481a2aa4a13c9711c0acbf_small.jpeg",
63
+ email: "email_1@email.com",
64
+ name: "code_type1",
65
+ idsUser: "P1111111",
66
+ isLogged: false,
67
+ },
68
+ {
69
+ avatarUrl: "https://avatars.profile.sap.com/d/6/idd62e808170c86bf4c00df641a1d5715e4283e241ea481a2aa4a13c9711c0acbf_small.jpeg",
70
+ email: "email_2@email.com",
71
+ name: "code_type2",
72
+ idsUser: "P2222222",
73
+ isLogged: true,
74
+ },
75
+ ];
@@ -1,71 +1,76 @@
1
1
  import { UDExListItem } from "../support/component-imports.js";
2
2
  import UDExButton from "../../src/Button.js"
3
+ import { UDExAvatarShape } from "../../dist/Avatar.js";
4
+ import { UDExAvatarSize } from "../../src/Avatar.js";
5
+ import { UDExAdditionalTextState, UDExListStyleType } from "../../src/types/List.js";
6
+ import UDExStatusBadgeValueState from "../../dist/types/StatusBadgeValueState.js";
3
7
 
4
8
  const defaultListItem = <UDExListItem
5
- id="listItem"
6
- accessibleName="accessible-name"
7
- supportingText="Supporting text"
8
- image="image"
9
- imageAlt="Person Avatar"
10
- additionalText="Additional Text"
11
- additionalTextState="Information"
12
- imageSize="M"
13
- imageShape="Square"
14
- type="Circle">
15
- Default List Item
9
+ id="listItem"
10
+ accessibleName="accessible-name"
11
+ supportingText="Supporting text"
12
+ image="./stories/list/image.png"
13
+ imageAlt="Person Avatar"
14
+ additionalText="Additional Text"
15
+ additionalTextState={UDExAdditionalTextState.Information}
16
+ imageBadgeState={UDExStatusBadgeValueState.Information}
17
+ imageSize={UDExAvatarSize.M}
18
+ imageShape={UDExAvatarShape.Square}
19
+ type={UDExListStyleType.Circle}>
20
+ Default List Item
16
21
  </UDExListItem>
17
22
 
18
23
  const listItemSuccess = <UDExListItem
19
- id="listItemSuccess"
20
- accessibleName="accessible-name"
21
- supportingText="Supporting text"
22
- image="./stories/list/image.png"
23
- imageAlt="Person Avatar"
24
- additionalText="Additional Text"
25
- additionalTextState="Success"
26
- imageSize="M"
27
- imageShape="Square">
28
- Default List Item
24
+ id="listItemSuccess"
25
+ accessibleName="accessible-name"
26
+ supportingText="Supporting text"
27
+ image="./stories/list/image.png"
28
+ imageAlt="Person Avatar"
29
+ additionalText="Additional Text"
30
+ additionalTextState={UDExAdditionalTextState.Success}
31
+ imageSize={UDExAvatarSize.M}
32
+ imageShape={UDExAvatarShape.Square}>
33
+ Default List Item
29
34
  </UDExListItem>
30
35
 
31
36
  const listItemError = <UDExListItem
32
- id="listItemError"
33
- accessibleName="accessible-name"
34
- supportingText="Supporting text"
35
- image="./stories/list/image.png"
36
- imageAlt="Person Avatar"
37
- additionalText="Additional Text"
38
- additionalTextState="Error"
39
- imageSize="M"
40
- imageShape="Square">
41
- Default List Item
37
+ id="listItemError"
38
+ accessibleName="accessible-name"
39
+ supportingText="Supporting text"
40
+ image="./stories/list/image.png"
41
+ imageAlt="Person Avatar"
42
+ additionalText="Additional Text"
43
+ additionalTextState={UDExAdditionalTextState.Error}
44
+ imageSize={UDExAvatarSize.M}
45
+ imageShape={UDExAvatarShape.Square}>
46
+ Default List Item
42
47
  </UDExListItem>
43
48
 
44
49
  const listItemWarning = <UDExListItem
45
- id="listItemWarning"
46
- accessibleName="accessible-name"
47
- supportingText="Supporting text"
48
- image="./stories/list/image.png"
49
- imageAlt="Person Avatar"
50
- additionalText="Additional Text"
51
- additionalTextState="Warning"
52
- imageSize="M"
53
- imageShape="Square">
54
- Default List Item
50
+ id="listItemWarning"
51
+ accessibleName="accessible-name"
52
+ supportingText="Supporting text"
53
+ image="./stories/list/image.png"
54
+ imageAlt="Person Avatar"
55
+ additionalText="Additional Text"
56
+ additionalTextState={UDExAdditionalTextState.Warning}
57
+ imageSize={UDExAvatarSize.M}
58
+ imageShape={UDExAvatarShape.Square}>
59
+ Default List Item
55
60
  </UDExListItem>
56
61
 
57
62
  const listItemWithIcons = <UDExListItem
58
- id="listItemIcons"
59
- accessible-name="accessible-name"
60
- supporting-text="Supporting text"
61
- image="./stories/list/image.png"
62
- image-alt="Person Avatar"
63
- additional-text="Additional Text"
64
- imageSize="M"
65
- imageShape="Square">
66
- Default List Item
67
- <UDExButton accessible-name='Action' slot='firstIcon' design='Tertiary' icon='edit' size='Small'></UDExButton>
68
- <UDExButton accessible-name='Action' slot='secondIcon' design='Tertiary' icon='decline' size='Small'></UDExButton>
63
+ id="listItemIcons"
64
+ accessible-name="accessible-name"
65
+ supporting-text="Supporting text"
66
+ image="./stories/list/image.png"
67
+ image-alt="Person Avatar"
68
+ additional-text="Additional Text"
69
+ imageSize={UDExAvatarSize.M}
70
+ imageShape={UDExAvatarShape.Square}>
71
+ Default List Item
72
+ <UDExButton accessible-name='Action' slot='firstIcon' design='Tertiary' icon='edit' size='Small'></UDExButton>
73
+ <UDExButton accessible-name='Action' slot='secondIcon' design='Tertiary' icon='decline' size='Small'></UDExButton>
69
74
  </UDExListItem>
70
75
 
71
76
  describe("ListItem", () => {
@@ -111,6 +116,15 @@ describe("ListItem", () => {
111
116
  expect($wrapper.attr("aria-labelledby")).to.eq(`${itemId}-invisibleText`);
112
117
  });
113
118
  });
119
+
120
+ it("renders status badge", () => {
121
+ cy.get("#listItem").shadow().find("udex-status-badge").should("exist");
122
+ });
123
+
124
+ it("renders status badge properties", () => {
125
+ cy.get("#listItem").shadow().find("udex-status-badge").should("have.attr", "value-state", UDExStatusBadgeValueState.Information);
126
+ cy.get("#listItem").shadow().find("udex-status-badge").should("have.attr", "size", UDExAvatarSize.M);
127
+ });
114
128
  });
115
129
 
116
130
  describe("With Icons", () => {
@@ -0,0 +1,174 @@
1
+ import { UDExMastheadProfileMenu } from "../support/component-imports.js"
2
+ import { UDExMessageStrip } from "../support/component-imports.js"
3
+ import { UDExLink } from "../support/component-imports.js";
4
+ import { identities, columnsData, userData } from "../fixtures/profile-menu.js";
5
+ import AnalyticsName from "../../src/types/AnalyticsName.js";
6
+
7
+ const profileMenu = <UDExMastheadProfileMenu
8
+ id="profileMenu"
9
+ identities={JSON.stringify(identities)}
10
+ links={JSON.stringify(columnsData)}
11
+ loggedInUser={JSON.stringify(userData)}
12
+ accessible-name="Test accessible name">
13
+ <UDExMessageStrip design="Action" slot="message">
14
+ <span style="vertical-align: middle">Action or Promotion.</span>
15
+ <UDExLink design="Default" href="https://www.sap.com" target="_blank">
16
+ Learn more
17
+ </UDExLink>
18
+ </UDExMessageStrip>
19
+ </UDExMastheadProfileMenu>
20
+
21
+ const simpleProfileMenu = <UDExMastheadProfileMenu
22
+ id="masthead-profile-menu-simple"
23
+ accessible-name="Test accessible name"
24
+ loggedInUser={JSON.stringify(userData)}
25
+ links={JSON.stringify([columnsData[1]])}
26
+ logoutUrl="#">
27
+ </UDExMastheadProfileMenu>
28
+
29
+ describe("Masthead Profile Menu", () => {
30
+ beforeEach(() => {
31
+ cy.mount(profileMenu);
32
+ cy.get("[udex-masthead-profile-menu]").shadow().as("profile");
33
+ });
34
+
35
+ it("is correctly rendered", () => {
36
+ cy.get("@profile").find(".udex-masthead-profile-menu").should("be.visible");
37
+ });
38
+
39
+ it("tests if web component renders user avatar", () => {
40
+ cy.get("@profile").find("udex-avatar").should("exist");
41
+ });
42
+
43
+ it("tests if web component renders user name", () => {
44
+ cy.get("@profile").find(".udex-profile-menu__account-name").should("have.text", "John Sánchez");
45
+ });
46
+
47
+ it("tests if web component renders user email", () => {
48
+ cy.get("@profile").find(".udex-profile-menu__account-email").should("have.text", "john.miller@sap.com");
49
+ });
50
+
51
+ it("tests if web component renders message strip", () => {
52
+ cy.get("[udex-masthead-profile-menu]").find("udex-message-strip").should("exist");
53
+ });
54
+
55
+ it("tests if web component renders masthead menu", () => {
56
+ cy.get("@profile").find("udex-masthead-menu").should("exist");
57
+ });
58
+
59
+ it("tests if web component renders logout link", () => {
60
+ cy.mount(simpleProfileMenu);
61
+ cy.get("#masthead-profile-menu-simple").shadow().find(".udex-masthead-profile-menu__actions").should("exist");
62
+ });
63
+
64
+ it("tests if web component renders switch account button", () => {
65
+ cy.get("@profile").find(".udex-masthead-profile-menu__btn-switcher").should("exist");
66
+ });
67
+
68
+ it("tests if identities menu opens when the switch account button is clicked", () => {
69
+ cy.get("@profile").find(".udex-masthead-profile-menu__btn-switcher").click();
70
+ cy.get("@profile").find("[udex-list]").should("be.visible");
71
+ });
72
+
73
+ it("verifies the correct number of identity list items are rendered", () => {
74
+ cy.get("@profile").find(".udex-masthead-profile-menu__btn-switcher").click();
75
+ cy.get("@profile").find("udex-list").find("[udex-list-item]").should("have.length", identities.length);
76
+ });
77
+
78
+ it("renders the correct title for the identity switcher list", () => {
79
+ cy.get("@profile").find(".udex-masthead-profile-menu__btn-switcher").click();
80
+ cy.get("@profile").find(".udex-masthead-profile-menu__switcher-title").should("have.text", "Switch account");
81
+ });
82
+
83
+ it("renders the back button for the identity", () => {
84
+ cy.get("@profile").find(".udex-masthead-profile-menu__btn-switcher").click();
85
+ cy.get("@profile").find(".udex-masthead-profile-menu__btn-back").should("exist");
86
+ });
87
+
88
+ it("navigates back to the profile view after clicking the back button", () => {
89
+ cy.get("@profile").find(".udex-masthead-profile-menu__btn-switcher").click();
90
+ cy.get("@profile").find(".udex-masthead-profile-menu__btn-back").click();
91
+ cy.get("@profile").find(".udex-profile-menu__account-name").should("have.text", "John Sánchez");
92
+ });
93
+
94
+ it("renders the back button title for the desktop", () => {
95
+ cy.get("@profile").find(".udex-masthead-profile-menu__btn-switcher").click();
96
+ cy.get("@profile").find(".udex-masthead-profile-menu__btn-back").should("have.attr", "label", "Back");
97
+ });
98
+
99
+ it("renders the back button title for the mobile", () => {
100
+ cy.viewport(1024, 640);
101
+ cy.get("@profile").find(".udex-masthead-profile-menu__btn-switcher").click();
102
+ cy.get("@profile").find(".udex-masthead-profile-menu__btn-back").should("have.attr", "label", "Switch account");
103
+ });
104
+
105
+ it("tests if event \"ui5-profile-item-click\" emits when clicking on a menu item", () => {
106
+ let eventType;
107
+ let analyticsName;
108
+ let itemLabel
109
+
110
+ cy.get("#profileMenu").then(menu => {
111
+ menu.get(0).addEventListener("ui5-profile-item-click", ({type, detail}: CustomEvent) => {
112
+ eventType = type;
113
+ analyticsName = detail.analyticsName;
114
+ itemLabel = detail.item.label;
115
+ detail.originalEvent.preventDefault();
116
+ });
117
+ });
118
+
119
+ cy.get("@profile").find("udex-masthead-menu").shadow().find("udex-masthead-menu-item").eq(0).click().then(() => {
120
+ expect(eventType).to.equal("ui5-profile-item-click");
121
+ expect(analyticsName).to.equal(AnalyticsName.Header);
122
+ expect(itemLabel).to.equal(columnsData[0].category);
123
+ });
124
+ });
125
+
126
+ it("tests if event \"ui5-logout\" emits when clicking on logout item", () => {
127
+ let eventType;
128
+ cy.mount(simpleProfileMenu);
129
+ cy.get("#masthead-profile-menu-simple").then(menu => {
130
+ menu.get(0).addEventListener("ui5-logout", (e: CustomEvent) => {
131
+ eventType = e.type;
132
+ e.detail.originalEvent.preventDefault();
133
+ });
134
+ });
135
+
136
+ cy.get("#masthead-profile-menu-simple").shadow().find(".udex-masthead-profile-menu__actions").find("udex-masthead-menu-item").eq(0).click().then(() => {
137
+ expect(eventType).to.equal("ui5-logout");
138
+ });
139
+ });
140
+
141
+ it("tests if event \"ui5-add-or-remove-account-click\" emits when clicking on add or remove account button", () => {
142
+ let eventType;
143
+ let analyticsName;
144
+ cy.get("#profileMenu").then(menu => {
145
+ menu.get(0).addEventListener("ui5-add-or-remove-account-click", (e: CustomEvent) => {
146
+ eventType = e.type;
147
+ analyticsName = e.detail.analyticsName;
148
+ });
149
+ });
150
+
151
+ cy.get("@profile").find(".udex-masthead-profile-menu__btn-switcher").click();
152
+ cy.get("@profile").find(".udex-masthead-profile-menu__add-remove-btn").click().then(() => {
153
+ expect(eventType).to.equal("ui5-add-or-remove-account-click");
154
+ expect(analyticsName).to.equal(AnalyticsName.Header);
155
+ });
156
+ });
157
+
158
+ it("tests if event \"ui5-identity-item-click\" emits when clicking on identity item", () => {
159
+ let eventType;
160
+ let idsUser;
161
+ cy.get("#profileMenu").then(menu => {
162
+ menu.get(0).addEventListener("ui5-identity-item-click", (e: CustomEvent) => {
163
+ eventType = e.type;
164
+ idsUser = e.detail.item.idsUser;
165
+ });
166
+ });
167
+
168
+ cy.get("@profile").find(".udex-masthead-profile-menu__btn-switcher").click();
169
+ cy.get("@profile").find("udex-list-item").eq(0).click().then(() => {
170
+ expect(eventType).to.equal("ui5-identity-item-click");
171
+ expect(idsUser).to.equal(identities[0].idsUser);
172
+ });
173
+ });
174
+ });
@@ -1,10 +1,11 @@
1
- import { UDExSelectBox, UDExSelectBoxSelectAll, UDExSelectBoxGroupHeader, UDExSelectBoxItem } from "../support/component-imports.js";
1
+ import { UDExSelectBox, UDExSelectBoxSelectAll, UDExSelectBoxGroupHeader, UDExSelectBoxItem, UDExButton } from "../support/component-imports.js";
2
+ import { UDExListMode } from "../../src/types/List.js";
2
3
 
3
4
  const fullComponent = <UDExSelectBox
4
- id="select-box"
5
- height="400px"
6
- label="Programming languages"
7
- supportingText="category lists">
5
+ id="select-box"
6
+ height="400px"
7
+ label="Programming languages"
8
+ supportingText="category lists">
8
9
  <UDExSelectBoxItem label="JavaScript" supportingText="Frontend web development">
9
10
  <span class="custom-content">Lorem ipsum</span>
10
11
  </UDExSelectBoxItem>
@@ -26,59 +27,65 @@ supportingText="category lists">
26
27
 
27
28
  const multiSelect = <div style="width: 300px; position:relative;">
28
29
  <a id="previous-focus" href="#">Previous focusable element</a>
29
- <UDExSelectBox
30
- id="select-box"
31
- height="400px"
32
- label="Programming languages"
33
- supportingText="category lists"
34
- mode="MultiSelect">
35
- <UDExSelectBoxItem label="JavaScript" supportingText="Frontend web development"></UDExSelectBoxItem>
36
- <UDExSelectBoxItem label="Python" supportingText="Used in data analysis"></UDExSelectBoxItem>
37
- <UDExSelectBoxItem label="Java" supportingText="Building large-scale applications"></UDExSelectBoxItem>
38
- <UDExSelectBoxItem label="Swift" supportingText="iOS app development"></UDExSelectBoxItem>
39
- <UDExSelectBoxItem label="C# - is a general-purpose high-level programming language supporting multiple paradigms" supportingText="Object-oriented language"></UDExSelectBoxItem>
40
- <UDExSelectBoxItem label="Perl" supportingText="General-purpose scripting language"></UDExSelectBoxItem>
41
- <UDExSelectBoxItem label="Rust" supportingText="Focused on safety and speed"></UDExSelectBoxItem>
42
- <UDExSelectBoxItem label="PHP" supportingText="Server-side scripting language"></UDExSelectBoxItem>
43
- <UDExSelectBoxItem label="Go" supportingText="Statically typed language"></UDExSelectBoxItem>
44
- <UDExSelectBoxItem label="Kotlin" supportingText="For Android development"></UDExSelectBoxItem>
45
- <UDExSelectBoxItem label="TypeScript" supportingText="Super set of JS with static typing"></UDExSelectBoxItem>
46
- <UDExSelectBoxItem label="Ruby" supportingText="Readable and easy-to-use"></UDExSelectBoxItem>
47
- <UDExSelectBoxItem label="C++" supportingText="Efficient and flexible language"></UDExSelectBoxItem>
48
- <UDExSelectBoxItem label="C" supportingText="Most widely used programming language" disabled></UDExSelectBoxItem>
49
- <UDExSelectBoxItem label="R" supportingText="Language for statistical computing"></UDExSelectBoxItem>
50
- </UDExSelectBox></div>
30
+ <UDExSelectBox
31
+ id="select-box"
32
+ height="400px"
33
+ label="Programming languages"
34
+ supportingText="category lists"
35
+ mode={UDExListMode.MultiSelect}>
36
+ <UDExSelectBoxItem label="JavaScript" supportingText="Frontend web development"></UDExSelectBoxItem>
37
+ <UDExSelectBoxItem label="Python" supportingText="Used in data analysis"></UDExSelectBoxItem>
38
+ <UDExSelectBoxItem label="Java" supportingText="Building large-scale applications"></UDExSelectBoxItem>
39
+ <UDExSelectBoxItem label="Swift" supportingText="iOS app development"></UDExSelectBoxItem>
40
+ <UDExSelectBoxItem label="C# - is a general-purpose high-level programming language supporting multiple paradigms" supportingText="Object-oriented language"></UDExSelectBoxItem>
41
+ <UDExSelectBoxItem label="Perl" supportingText="General-purpose scripting language"></UDExSelectBoxItem>
42
+ <UDExSelectBoxItem label="Rust" supportingText="Focused on safety and speed"></UDExSelectBoxItem>
43
+ <UDExSelectBoxItem label="PHP" supportingText="Server-side scripting language"></UDExSelectBoxItem>
44
+ <UDExSelectBoxItem label="Go" supportingText="Statically typed language"></UDExSelectBoxItem>
45
+ <UDExSelectBoxItem label="Kotlin" supportingText="For Android development"></UDExSelectBoxItem>
46
+ <UDExSelectBoxItem label="TypeScript" supportingText="Super set of JS with static typing"></UDExSelectBoxItem>
47
+ <UDExSelectBoxItem label="Ruby" supportingText="Readable and easy-to-use"></UDExSelectBoxItem>
48
+ <UDExSelectBoxItem label="C++" supportingText="Efficient and flexible language"></UDExSelectBoxItem>
49
+ <UDExSelectBoxItem label="C" supportingText="Most widely used programming language" disabled></UDExSelectBoxItem>
50
+ <UDExSelectBoxItem label="R" supportingText="Language for statistical computing"></UDExSelectBoxItem>
51
+ </UDExSelectBox>
52
+ </div>
51
53
 
52
- const displayOnly = <div style="width: 350px; position:relative;"><UDExSelectBox
53
- id="select-box"
54
- height="400px"
55
- label="Programming languages"
56
- supportingText="category lists"
57
- mode="MultiSelect"
58
- displayonly>
59
- <UDExSelectBoxItem selected label="JavaScript" supportingText="Frontend web development"></UDExSelectBoxItem>
60
- <UDExSelectBoxItem selected label="Python" supportingText="Used in data analysis"></UDExSelectBoxItem>
61
- <UDExSelectBoxItem selected label="Java" supportingText="Building large-scale applications"></UDExSelectBoxItem>
62
- <UDExSelectBoxItem selected label="Swift" supportingText="iOS app development"></UDExSelectBoxItem>
63
- <UDExSelectBoxItem selected label="C#" supportingText="Object-oriented language"></UDExSelectBoxItem>
64
- <UDExSelectBoxItem selected label="Perl" supportingText="General-purpose scripting language"></UDExSelectBoxItem>
65
- <UDExSelectBoxItem selected label="Rust" supportingText="Focused on safety and speed"></UDExSelectBoxItem>
66
- <UDExSelectBoxItem selected label="PHP" supportingText="Server-side scripting language"></UDExSelectBoxItem>
67
- <UDExSelectBoxItem selected label="Go" supportingText="Statically typed language"></UDExSelectBoxItem>
68
- <UDExSelectBoxItem selected label="Kotlin" supportingText="For Android development"></UDExSelectBoxItem>
69
- <UDExSelectBoxItem selected label="TypeScript" supportingText="Super set of JS with static typing"></UDExSelectBoxItem>
70
- <UDExSelectBoxItem selected label="Ruby" supportingText="Readable and easy-to-use"></UDExSelectBoxItem>
71
- <UDExSelectBoxItem selected label="C++" supportingText="Efficient and flexible language"></UDExSelectBoxItem>
72
- <UDExSelectBoxItem label="C" supportingText="Most widely used programming language" disabled></UDExSelectBoxItem>
73
- <UDExSelectBoxItem label="R" supportingText="Language for statistical computing"></UDExSelectBoxItem>
74
- </UDExSelectBox></div>
54
+ const displayOnly = <div style="width: 350px; position:relative;">
55
+ <UDExSelectBox
56
+ id="select-box"
57
+ height="400px"
58
+ label="Programming languages"
59
+ supportingText="category lists"
60
+ mode={UDExListMode.MultiSelect}
61
+ displayonly>
62
+ <UDExSelectBoxItem selected label="JavaScript" supportingText="Frontend web development"></UDExSelectBoxItem>
63
+ <UDExSelectBoxItem selected label="Python" supportingText="Used in data analysis"></UDExSelectBoxItem>
64
+ <UDExSelectBoxItem selected label="Java" supportingText="Building large-scale applications"></UDExSelectBoxItem>
65
+ <UDExSelectBoxItem selected label="Swift" supportingText="iOS app development"></UDExSelectBoxItem>
66
+ <UDExSelectBoxItem selected label="C#" supportingText="Object-oriented language"></UDExSelectBoxItem>
67
+ <UDExSelectBoxItem selected label="Perl" supportingText="General-purpose scripting language"></UDExSelectBoxItem>
68
+ <UDExSelectBoxItem selected label="Rust" supportingText="Focused on safety and speed"></UDExSelectBoxItem>
69
+ <UDExSelectBoxItem selected label="PHP" supportingText="Server-side scripting language"></UDExSelectBoxItem>
70
+ <UDExSelectBoxItem selected label="Go" supportingText="Statically typed language"></UDExSelectBoxItem>
71
+ <UDExSelectBoxItem selected label="Kotlin" supportingText="For Android development"></UDExSelectBoxItem>
72
+ <UDExSelectBoxItem selected label="TypeScript" supportingText="Super set of JS with static typing"></UDExSelectBoxItem>
73
+ <UDExSelectBoxItem selected label="Ruby" supportingText="Readable and easy-to-use"></UDExSelectBoxItem>
74
+ <UDExSelectBoxItem selected label="C++" supportingText="Efficient and flexible language"></UDExSelectBoxItem>
75
+ <UDExSelectBoxItem label="C" supportingText="Most widely used programming language" disabled></UDExSelectBoxItem>
76
+ <UDExSelectBoxItem label="R" supportingText="Language for statistical computing"></UDExSelectBoxItem>
77
+ </UDExSelectBox>
78
+ </div>
75
79
 
76
80
  const shortComponent = <div style="width: 350px; position:relative;"><UDExSelectBox
77
- id="select-box"
78
- height="400px"
79
- label="Programming languages"
80
- supportingText="category lists">
81
- <UDExSelectBoxItem label="JavaScript"></UDExSelectBoxItem>
81
+ id="select-box"
82
+ height="400px"
83
+ label="Programming languages"
84
+ supportingText="category lists">
85
+ <UDExSelectBoxItem label="JavaScript" additionalText="Additional Text">
86
+ <UDExButton id='firstIcon' accessible-name='Action' slot='firstIcon' design='Tertiary' icon='action' size='Small'></UDExButton>
87
+ <UDExButton id='secondIcon' accessible-name='Email' slot='secondIcon' design='Tertiary' icon='email' size='Small'></UDExButton>
88
+ </UDExSelectBoxItem>
82
89
  <UDExSelectBoxItem label="Python"></UDExSelectBoxItem>
83
90
  <UDExSelectBoxItem label="Java"></UDExSelectBoxItem>
84
91
  <UDExSelectBoxItem label="Swift"></UDExSelectBoxItem>
@@ -87,21 +94,21 @@ supportingText="category lists">
87
94
  </UDExSelectBox></div>
88
95
 
89
96
  const groupHeader = <div style="width: 350px; position:relative;"><UDExSelectBox
90
- id="select-box"
91
- mode="MultiSelect"
92
- label="Programming languages">
93
- <UDExSelectBoxGroupHeader label="Programming Languages" supportingText="Digital Builders">
94
- <UDExSelectBoxItem label="JavaScript" supportingText="Frontend web development"></UDExSelectBoxItem>
95
- <UDExSelectBoxItem label="Python" supportingText="Used in data analysis"></UDExSelectBoxItem>
96
- </UDExSelectBoxGroupHeader>
97
+ id="select-box"
98
+ mode={UDExListMode.MultiSelect}
99
+ label="Programming languages">
100
+ <UDExSelectBoxGroupHeader label="Programming Languages" supportingText="Digital Builders">
101
+ <UDExSelectBoxItem label="JavaScript" supportingText="Frontend web development"></UDExSelectBoxItem>
102
+ <UDExSelectBoxItem label="Python" supportingText="Used in data analysis"></UDExSelectBoxItem>
103
+ </UDExSelectBoxGroupHeader>
97
104
  </UDExSelectBox></div>
98
105
 
99
106
  const selectAll = <div style="width: 350px; position:relative;">
100
107
  <a id="previous-focus" href="#">Previous focusable element</a>
101
108
  <UDExSelectBox
102
- id="select-box"
103
- mode="MultiSelect"
104
- label="Programming languages">
109
+ id="select-box"
110
+ mode={UDExListMode.MultiSelect}
111
+ label="Programming languages">
105
112
  <UDExSelectBoxSelectAll>
106
113
  <UDExSelectBoxItem label="JavaScript" supportingText="Frontend web development"></UDExSelectBoxItem>
107
114
  <UDExSelectBoxItem label="Python" supportingText="Used in data analysis"></UDExSelectBoxItem>
@@ -238,6 +245,28 @@ describe("SelectBox", () => {
238
245
  .should("not.exist");
239
246
  });
240
247
 
248
+ it('render the additional text in the item', () => {
249
+ cy.mount(shortComponent);
250
+ cy.get("#select-box").shadow().find(".udex-text-field__trigger").click();
251
+ cy.get("#select-box").shadow().find("udex-list-item").eq(0).as("firstItem");
252
+
253
+ cy.get("@firstItem").should("have.attr", "additional-text", "Additional Text");
254
+ });
255
+
256
+ it('render the first icon slot in the item', () => {
257
+ cy.mount(shortComponent);
258
+ cy.get("#select-box").shadow().find(".udex-text-field__trigger").click();
259
+ cy.get("#select-box").shadow().find("udex-list-item").eq(0).as("firstItem");
260
+ cy.get("@firstItem").find("#firstIcon").should("exist");
261
+ });
262
+
263
+ it('render the second icon slot in the item', () => {
264
+ cy.mount(shortComponent);
265
+ cy.get("#select-box").shadow().find(".udex-text-field__trigger").click();
266
+ cy.get("#select-box").shadow().find("udex-list-item").eq(0).as("firstItem");
267
+ cy.get("@firstItem").find("#secondIcon").should("exist");
268
+ });
269
+
241
270
  it('should filter items based on search input', () => {
242
271
  cy.mount(fullComponent);
243
272
  cy.get("#select-box").shadow()
@@ -906,6 +935,45 @@ describe("SelectBox", () => {
906
935
  cy.get("@showmore")
907
936
  .should("have.been.called");
908
937
  });
909
- });
910
938
 
939
+ it('emit first-icon-click when first icon clicked', () => {
940
+ let eventType;
941
+ let itemLabel;
942
+ cy.mount(shortComponent);
943
+ cy.get("#select-box").then(menu => {
944
+ menu.get(0).addEventListener("ui5-first-icon-click", (e: CustomEvent) => {
945
+ eventType = e.type;
946
+ itemLabel = e.detail.item.label;
947
+ e.detail.originalEvent.stopPropagation();
948
+ });
949
+ });
950
+
951
+ cy.get("#select-box").shadow().find(".udex-text-field__trigger").click();
952
+ cy.get("#select-box").shadow().find("udex-list-item").eq(0).as("firstItem");
953
+ cy.get("@firstItem").find("#firstIcon").click().then(() => {
954
+ expect(eventType).to.equal("ui5-first-icon-click");
955
+ expect(itemLabel).to.equal("JavaScript");
956
+ });
957
+ });
958
+
959
+ it('emit second-icon-click when second icon clicked', () => {
960
+ let eventType;
961
+ let itemAdditionalText;
962
+ cy.mount(shortComponent);
963
+ cy.get("#select-box").then(menu => {
964
+ menu.get(0).addEventListener("ui5-second-icon-click", (e: CustomEvent) => {
965
+ eventType = e.type;
966
+ itemAdditionalText = e.detail.item.additionalText;
967
+ e.detail.originalEvent.stopPropagation();
968
+ });
969
+ });
970
+
971
+ cy.get("#select-box").shadow().find(".udex-text-field__trigger").click();
972
+ cy.get("#select-box").shadow().find("udex-list-item").eq(0).as("firstItem");
973
+ cy.get("@firstItem").find("#secondIcon").click().then(() => {
974
+ expect(eventType).to.equal("ui5-second-icon-click");
975
+ expect(itemAdditionalText).to.equal("Additional Text");
976
+ });
977
+ });
978
+ });
911
979
  });