@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.
- package/.eslintignore +3 -0
- package/bundle.esm.js +3 -0
- package/cypress/fixtures/contact-numbers.ts +10 -0
- package/cypress/fixtures/event-ribbon-links.ts +5 -0
- package/cypress/specs/Accordion.cy.tsx +25 -2
- package/cypress/specs/AccordionItem.cy.tsx +1 -1
- package/cypress/specs/Avatar.cy.tsx +1 -1
- package/cypress/specs/AvatarGroup.cy.tsx +1 -2
- package/cypress/specs/Badge.cy.tsx +1 -1
- package/cypress/specs/Contact.cy.tsx +92 -0
- package/cypress/specs/ContactItem.cy.tsx +56 -0
- package/cypress/specs/CountrySelector.cy.tsx +10 -4
- package/cypress/specs/EventRibbon.cy.tsx +110 -0
- package/cypress/specs/Footer.cy.tsx +1 -1
- package/cypress/specs/ListItem.cy.tsx +1 -1
- package/cypress/specs/PhoneNumberField.cy.tsx +4 -2
- package/cypress/specs/Review.cy.tsx +1 -3
- package/cypress/specs/ReviewItem.cy.tsx +1 -1
- package/cypress/specs/SecondaryNavigationDesktop.cy.tsx +123 -116
- package/cypress/specs/SecondaryNavigationMobile.cy.tsx +27 -38
- package/cypress/specs/SelectBox.cy.tsx +93 -88
- package/cypress/specs/Slider.cy.tsx +1 -1
- package/cypress/specs/StatusBadge.cy.tsx +1 -1
- package/cypress/specs/StatusMessage.cy.tsx +1 -1
- package/cypress/specs/Switch.cy.tsx +1 -2
- package/cypress/specs/Table.cy.tsx +1 -9
- package/cypress/specs/Tag.cy.tsx +1 -1
- package/cypress/specs/TagGroup.cy.tsx +1 -2
- package/cypress/specs/TextField.cy.tsx +1 -1
- package/cypress/specs/Textarea.cy.tsx +1 -1
- package/cypress/specs/Toast.cy.tsx +1 -1
- package/cypress/specs/Tooltip.cy.tsx +1 -2
- package/cypress/specs/TruncatedText.cy.tsx +2 -1
- package/cypress/specs/Upload.cy.tsx +1 -2
- package/cypress/specs/UploadItem.cy.tsx +1 -1
- package/cypress/specs/Wizard.cy.tsx +7 -4
- package/cypress/support/commands.ts +31 -2
- package/cypress/support/component-imports.instrumented.ts +95 -0
- package/cypress/support/component-imports.src.ts +95 -0
- package/cypress/support/component.ts +1 -1
- package/cypress.config.ts +6 -0
- package/dist/Accordion.d.ts +7 -1
- package/dist/Accordion.js +3 -3
- package/dist/Accordion.js.map +1 -1
- package/dist/Assets.js +31 -0
- package/dist/Assets.js.map +1 -1
- package/dist/AssetsVariables.js +4 -0
- package/dist/AssetsVariables.js.map +1 -1
- package/dist/Button.d.ts +7 -0
- package/dist/Button.js +3 -0
- package/dist/Button.js.map +1 -1
- package/dist/Contact.d.ts +102 -0
- package/dist/Contact.js +152 -0
- package/dist/Contact.js.map +1 -0
- package/dist/ContactItem.d.ts +67 -0
- package/dist/ContactItem.js +96 -0
- package/dist/ContactItem.js.map +1 -0
- package/dist/ContactItemTemplate.d.ts +2 -0
- package/dist/ContactItemTemplate.js +13 -0
- package/dist/ContactItemTemplate.js.map +1 -0
- package/dist/ContactTemplate.d.ts +4 -0
- package/dist/ContactTemplate.js +29 -0
- package/dist/ContactTemplate.js.map +1 -0
- package/dist/CountrySelector.d.ts +2 -4
- package/dist/CountrySelector.js +3 -5
- package/dist/CountrySelector.js.map +1 -1
- package/dist/DatePicker.js +2 -1
- package/dist/DatePicker.js.map +1 -1
- package/dist/EventRibbon.d.ts +80 -0
- package/dist/EventRibbon.js +111 -0
- package/dist/EventRibbon.js.map +1 -0
- package/dist/EventRibbonTemplate.d.ts +2 -0
- package/dist/EventRibbonTemplate.js +7 -0
- package/dist/EventRibbonTemplate.js.map +1 -0
- package/dist/Footer.d.ts +0 -1
- package/dist/Footer.js +7 -9
- package/dist/Footer.js.map +1 -1
- package/dist/HeroBanner.d.ts +1 -1
- package/dist/List.d.ts +1 -1
- package/dist/List.js +1 -1
- package/dist/List.js.map +1 -1
- package/dist/MastheadItem.d.ts +1 -3
- package/dist/MastheadItem.js +6 -11
- package/dist/MastheadItem.js.map +1 -1
- package/dist/MastheadMenu.d.ts +0 -1
- package/dist/MastheadMenu.js +2 -4
- package/dist/MastheadMenu.js.map +1 -1
- package/dist/MastheadProfileMenu.d.ts +0 -1
- package/dist/MastheadProfileMenu.js +2 -4
- package/dist/MastheadProfileMenu.js.map +1 -1
- package/dist/MastheadShell.d.ts +4 -1
- package/dist/MastheadShell.js +21 -5
- package/dist/MastheadShell.js.map +1 -1
- package/dist/Pagination.d.ts +17 -3
- package/dist/Pagination.js +33 -31
- package/dist/Pagination.js.map +1 -1
- package/dist/PhoneNumberField.d.ts +5 -5
- package/dist/PhoneNumberField.js +1 -1
- package/dist/PhoneNumberField.js.map +1 -1
- package/dist/SearchableListBase.d.ts +9 -0
- package/dist/SearchableListBase.js +15 -3
- package/dist/SearchableListBase.js.map +1 -1
- package/dist/SecondaryNavigation.d.ts +0 -1
- package/dist/SecondaryNavigation.js +2 -4
- package/dist/SecondaryNavigation.js.map +1 -1
- package/dist/TextField.d.ts +7 -0
- package/dist/TextField.js +3 -0
- package/dist/TextField.js.map +1 -1
- package/dist/Wizard.d.ts +20 -1
- package/dist/Wizard.js +22 -9
- package/dist/Wizard.js.map +1 -1
- package/dist/WizardTemplate.js +1 -1
- package/dist/WizardTemplate.js.map +1 -1
- package/dist/assets/{InputSuggestions-KGCQrV_T.js → InputSuggestions-CYW_6A8K.js} +1 -1
- package/dist/assets/{ListItemStandardExpandableTextTemplate-D4zLIdLd.js → ListItemStandardExpandableTextTemplate-BDrgWGjT.js} +1 -1
- package/dist/assets/{bundle.esm-Diw1zQ-o.js → bundle.esm-DRCvw6Ji.js} +235 -225
- package/dist/assets/messagebundle_en-BK8-Eyic.js +1 -0
- package/dist/css/themes/Accordion.css +1 -1
- package/dist/css/themes/Button.css +1 -1
- package/dist/css/themes/Contact.css +1 -0
- package/dist/css/themes/ContactItem.css +1 -0
- package/dist/css/themes/DatePickerPopover.css +1 -1
- package/dist/css/themes/EventRibbon.css +1 -0
- package/dist/css/themes/MastheadCountrySelector.css +1 -1
- package/dist/css/themes/MastheadItem.css +1 -1
- package/dist/css/themes/MastheadShell.css +1 -1
- package/dist/css/themes/Modal.css +1 -1
- package/dist/css/themes/Pagination.css +1 -1
- package/dist/css/themes/RatingIndicator.css +1 -1
- package/dist/css/themes/Slider.css +1 -1
- package/dist/css/themes/TextField.css +1 -1
- package/dist/custom-elements-internal.json +823 -99
- package/dist/custom-elements.json +783 -83
- package/dist/data/CountryListISO3166.d.ts +13 -4
- package/dist/data/CountryListISO3166.js +8 -0
- package/dist/data/CountryListISO3166.js.map +1 -1
- package/dist/generated/assets/i18n/messagebundle_en.json +1 -1
- package/dist/generated/i18n/i18n-defaults.d.ts +3 -1
- package/dist/generated/i18n/i18n-defaults.js +3 -1
- package/dist/generated/i18n/i18n-defaults.js.map +1 -1
- package/dist/generated/templates/AccordionTemplate.lit.js +4 -2
- package/dist/generated/templates/AccordionTemplate.lit.js.map +1 -1
- package/dist/generated/templates/MastheadItemTemplate.lit.js +25 -22
- package/dist/generated/templates/MastheadItemTemplate.lit.js.map +1 -1
- package/dist/generated/templates/PaginationTemplate.lit.js +1 -1
- package/dist/generated/templates/PaginationTemplate.lit.js.map +1 -1
- package/dist/generated/templates/PhoneNumberFieldTemplate.lit.js +2 -2
- package/dist/generated/templates/PhoneNumberFieldTemplate.lit.js.map +1 -1
- package/dist/generated/themes/Accordion.css.d.ts +1 -1
- package/dist/generated/themes/Accordion.css.js +1 -1
- package/dist/generated/themes/Accordion.css.js.map +1 -1
- package/dist/generated/themes/Button.css.d.ts +1 -1
- package/dist/generated/themes/Button.css.js +1 -1
- package/dist/generated/themes/Button.css.js.map +1 -1
- package/dist/generated/themes/Contact.css.d.ts +2 -0
- package/dist/generated/themes/Contact.css.js +8 -0
- package/dist/generated/themes/Contact.css.js.map +1 -0
- package/dist/generated/themes/ContactItem.css.d.ts +2 -0
- package/dist/generated/themes/ContactItem.css.js +8 -0
- package/dist/generated/themes/ContactItem.css.js.map +1 -0
- package/dist/generated/themes/DatePickerPopover.css.d.ts +1 -1
- package/dist/generated/themes/DatePickerPopover.css.js +1 -1
- package/dist/generated/themes/DatePickerPopover.css.js.map +1 -1
- package/dist/generated/themes/EventRibbon.css.d.ts +2 -0
- package/dist/generated/themes/EventRibbon.css.js +8 -0
- package/dist/generated/themes/EventRibbon.css.js.map +1 -0
- package/dist/generated/themes/MastheadCountrySelector.css.d.ts +1 -1
- package/dist/generated/themes/MastheadCountrySelector.css.js +1 -1
- package/dist/generated/themes/MastheadCountrySelector.css.js.map +1 -1
- package/dist/generated/themes/MastheadItem.css.d.ts +1 -1
- package/dist/generated/themes/MastheadItem.css.js +1 -1
- package/dist/generated/themes/MastheadItem.css.js.map +1 -1
- package/dist/generated/themes/MastheadShell.css.d.ts +1 -1
- package/dist/generated/themes/MastheadShell.css.js +1 -1
- package/dist/generated/themes/MastheadShell.css.js.map +1 -1
- package/dist/generated/themes/Modal.css.d.ts +1 -1
- package/dist/generated/themes/Modal.css.js +1 -1
- package/dist/generated/themes/Modal.css.js.map +1 -1
- package/dist/generated/themes/Pagination.css.d.ts +1 -1
- package/dist/generated/themes/Pagination.css.js +1 -1
- package/dist/generated/themes/Pagination.css.js.map +1 -1
- package/dist/generated/themes/RatingIndicator.css.d.ts +1 -1
- package/dist/generated/themes/RatingIndicator.css.js +1 -1
- package/dist/generated/themes/RatingIndicator.css.js.map +1 -1
- package/dist/generated/themes/Slider.css.d.ts +1 -1
- package/dist/generated/themes/Slider.css.js +1 -1
- package/dist/generated/themes/Slider.css.js.map +1 -1
- package/dist/generated/themes/TextField.css.d.ts +1 -1
- package/dist/generated/themes/TextField.css.js +1 -1
- package/dist/generated/themes/TextField.css.js.map +1 -1
- package/dist/messagebundle.properties +5 -0
- package/dist/messagebundle_en.properties +3 -0
- package/dist/types/ContactItemIcon.d.ts +6 -0
- package/dist/types/ContactItemIcon.js +8 -0
- package/dist/types/ContactItemIcon.js.map +1 -0
- package/dist/types/EventRibbon.d.ts +37 -0
- package/dist/types/EventRibbon.js +43 -0
- package/dist/types/EventRibbon.js.map +1 -0
- package/dist/utils/parseArrayFromString.d.ts +2 -0
- package/dist/utils/parseArrayFromString.js +5 -0
- package/dist/utils/parseArrayFromString.js.map +1 -0
- package/dist/vscode.html-custom-data.json +183 -1
- package/dist/web-types.json +321 -2
- package/filter-coverage.js +58 -0
- package/package.json +8 -3
- package/src/Accordion.hbs +13 -9
- package/src/Accordion.ts +7 -4
- package/src/Assets.ts +29 -0
- package/src/AssetsVariables.ts +4 -0
- package/src/Button.ts +9 -0
- package/src/Contact.ts +200 -0
- package/src/ContactItem.ts +119 -0
- package/src/ContactItemTemplate.tsx +22 -0
- package/src/ContactTemplate.tsx +105 -0
- package/src/CountrySelector.ts +5 -8
- package/src/DatePicker.ts +2 -1
- package/src/EventRibbon.ts +143 -0
- package/src/EventRibbonTemplate.tsx +18 -0
- package/src/Footer.ts +7 -10
- package/src/List.ts +1 -1
- package/src/MastheadItem.hbs +8 -0
- package/src/MastheadItem.ts +8 -16
- package/src/MastheadMenu.ts +2 -5
- package/src/MastheadProfileMenu.ts +2 -5
- package/src/MastheadShell.ts +25 -5
- package/src/Pagination.hbs +7 -3
- package/src/Pagination.ts +48 -31
- package/src/PhoneNumberField.hbs +1 -1
- package/src/PhoneNumberField.ts +7 -2
- package/src/SearchableListBase.ts +24 -3
- package/src/SecondaryNavigation.ts +3 -5
- package/src/TextField.ts +9 -0
- package/src/Wizard.ts +39 -11
- package/src/WizardTemplate.tsx +5 -1
- package/src/data/CountryListISO3166.ts +10 -2
- package/src/generated/i18n/i18n-defaults.ts +2 -2
- package/src/generated/templates/AccordionTemplate.lit.ts +4 -2
- package/src/generated/templates/MastheadItemTemplate.lit.ts +25 -22
- package/src/generated/templates/PaginationTemplate.lit.ts +1 -1
- package/src/generated/templates/PhoneNumberFieldTemplate.lit.ts +1 -1
- package/src/generated/themes/Accordion.css.ts +1 -1
- package/src/generated/themes/Button.css.ts +1 -1
- package/src/generated/themes/Contact.css.ts +9 -0
- package/src/generated/themes/ContactItem.css.ts +9 -0
- package/src/generated/themes/DatePickerPopover.css.ts +1 -1
- package/src/generated/themes/EventRibbon.css.ts +9 -0
- package/src/generated/themes/MastheadCountrySelector.css.ts +1 -1
- package/src/generated/themes/MastheadItem.css.ts +1 -1
- package/src/generated/themes/MastheadShell.css.ts +1 -1
- package/src/generated/themes/Modal.css.ts +1 -1
- package/src/generated/themes/Pagination.css.ts +1 -1
- package/src/generated/themes/RatingIndicator.css.ts +1 -1
- package/src/generated/themes/Slider.css.ts +1 -1
- package/src/generated/themes/TextField.css.ts +1 -1
- package/src/i18n/messagebundle.properties +5 -0
- package/src/i18n/messagebundle_en.properties +3 -0
- package/src/themes/Accordion.css +1 -0
- package/src/themes/Button.css +74 -26
- package/src/themes/Contact.css +184 -0
- package/src/themes/ContactItem.css +44 -0
- package/src/themes/DatePickerPopover.css +64 -6
- package/src/themes/EventRibbon.css +411 -0
- package/src/themes/MastheadCountrySelector.css +8 -5
- package/src/themes/MastheadItem.css +12 -4
- package/src/themes/MastheadShell.css +3 -1
- package/src/themes/Modal.css +8 -4
- package/src/themes/Pagination.css +19 -0
- package/src/themes/TextField.css +2 -13
- package/src/types/ContactItemIcon.ts +7 -0
- package/src/types/EventRibbon.ts +51 -0
- package/src/utils/parseArrayFromString.ts +5 -0
- package/swap-component-imports.js +18 -0
- package/dist/assets/messagebundle_en-CVKgy_9L.js +0 -1
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import UDExBreadcrumbs from "
|
|
2
|
-
import UDExBreadcrumbsItem from "../../src/BreadcrumbsItem.js";
|
|
3
|
-
import UDExButton from "../../src/Button.js";
|
|
4
|
-
import UDExSecondaryNavigation from "../../src/SecondaryNavigation.js";
|
|
1
|
+
import { UDExBreadcrumbs, UDExBreadcrumbsItem, UDExButton, UDExSecondaryNavigation } from "../support/component-imports.js";
|
|
5
2
|
import navItems, { additionalNavItems } from "../fixtures/secondary-navigation-items.js";
|
|
6
3
|
|
|
7
4
|
const defaultSecondaryNavigation = <UDExSecondaryNavigation
|
|
@@ -29,60 +26,49 @@ const secondaryNavigationWithoutBreadcrumbs = <UDExSecondaryNavigation
|
|
|
29
26
|
</UDExSecondaryNavigation>
|
|
30
27
|
|
|
31
28
|
describe("Desktop", () => {
|
|
32
|
-
let itemClickHandler;
|
|
33
|
-
let navigation: Cypress.Chainable<JQuery<HTMLElement>>
|
|
34
|
-
let navigationItems: Cypress.Chainable<JQuery<HTMLElement>>;
|
|
35
|
-
let firstNavItem: Cypress.Chainable<JQuery<HTMLElement>>
|
|
36
|
-
|
|
37
29
|
beforeEach( () => {
|
|
38
|
-
cy.mount(defaultSecondaryNavigation)
|
|
39
30
|
cy.viewport(1920, 1080)
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
afterEach( () => {
|
|
48
|
-
navigation = null;
|
|
49
|
-
navigationItems = null;
|
|
50
|
-
firstNavItem = null;
|
|
51
|
-
document.removeEventListener("item-click", itemClickHandler);
|
|
52
|
-
itemClickHandler = null;
|
|
31
|
+
cy.mount(defaultSecondaryNavigation)
|
|
32
|
+
const itemClickHandler = cy.stub().as("itemClickHandler");
|
|
33
|
+
cy.get("#secondary-nav").then($navigation => {
|
|
34
|
+
$navigation[0].addEventListener("item-click", itemClickHandler)
|
|
35
|
+
})
|
|
53
36
|
});
|
|
54
37
|
|
|
55
38
|
it("correctly renders", () => {
|
|
56
|
-
|
|
39
|
+
cy.get("#secondary-nav").shadow().find(".udex-secondary-navigation__root").should("exist")
|
|
57
40
|
});
|
|
58
41
|
|
|
59
42
|
it("renders breadcrumbs slot", () => {
|
|
60
|
-
|
|
43
|
+
cy.get("#secondary-nav").shadow().find("slot[name='breadcrumbs']").should("exist")
|
|
61
44
|
});
|
|
62
45
|
|
|
63
46
|
it("renders buttons slot", () => {
|
|
64
|
-
|
|
47
|
+
cy.get("#secondary-nav").shadow().find("slot[name='buttons']").should("exist")
|
|
65
48
|
});
|
|
66
49
|
|
|
67
50
|
it("renders heading", () => {
|
|
68
|
-
|
|
51
|
+
cy.get("#secondary-nav").shadow().find(".udex-secondary-navigation__title").should("have.text", "Secondary title")
|
|
69
52
|
});
|
|
70
53
|
|
|
71
54
|
it("tests if component renders heading as a link", () => {
|
|
72
|
-
|
|
55
|
+
cy.get("#secondary-nav").shadow().find(".udex-secondary-navigation__title").then($headingLink => {
|
|
56
|
+
$headingLink[0].removeAttribute("href")
|
|
57
|
+
}).click()
|
|
73
58
|
});
|
|
74
59
|
|
|
75
60
|
it("tests if component renders visible items", () => {
|
|
76
|
-
|
|
61
|
+
cy.get("#secondary-nav").shadow().find(".udex-secondary-navigation__list-item").should("have.length", 7)
|
|
77
62
|
});
|
|
78
63
|
|
|
79
64
|
it("item component renders label", () => {
|
|
80
|
-
|
|
65
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first()
|
|
66
|
+
.should("have.attr", "label", "Secondary Navigation 1");
|
|
81
67
|
});
|
|
82
68
|
|
|
83
69
|
it("item component renders dropdown after clicking", () => {
|
|
84
|
-
|
|
85
|
-
|
|
70
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first().click()
|
|
71
|
+
.shadow().find(".udex-secondary-navigation__dropdown").should("be.visible")
|
|
86
72
|
});
|
|
87
73
|
|
|
88
74
|
it("emits 'item-click' event and displays item info", () => {
|
|
@@ -91,126 +77,137 @@ describe("Desktop", () => {
|
|
|
91
77
|
target: "_self",
|
|
92
78
|
}
|
|
93
79
|
|
|
94
|
-
|
|
95
|
-
cy.get("@itemClickHandler").should("have.been.called").its("
|
|
80
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first().click()
|
|
81
|
+
cy.get("@itemClickHandler").should("have.been.called").its("lastCall.args.0.detail.clickedItem").should("include", expectedDetails)
|
|
96
82
|
});
|
|
97
83
|
|
|
98
84
|
it("closes dropdown after clicking outside", () => {
|
|
99
|
-
|
|
85
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first().click();
|
|
100
86
|
cy.get("html").click()
|
|
101
87
|
|
|
102
|
-
|
|
88
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first().should("not.have.attr", "is-open")
|
|
103
89
|
});
|
|
104
90
|
|
|
105
91
|
it("closes dropdown after clicking on another item", () => {
|
|
106
|
-
|
|
107
|
-
|
|
92
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first().click();
|
|
93
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").eq(1).click();
|
|
108
94
|
|
|
109
|
-
|
|
95
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first().shadow().get(".udex-secondary-navigation__dropdown").should("not.exist")
|
|
110
96
|
});
|
|
111
97
|
|
|
112
|
-
it("dropdown renders items",
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
firstLevelItems.eq(1).should("have.text", "secondary nested 2")
|
|
118
|
-
firstLevelItems.eq(2).should("have.text", "secondary nested 3")
|
|
98
|
+
it("dropdown renders items", () => {
|
|
99
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first().click()
|
|
100
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first().shadow().find("udex-secondary-navigation-sub-item").eq(0).should("have.attr", "label", "secondary nested 1")
|
|
101
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first().shadow().find("udex-secondary-navigation-sub-item").eq(1).should("have.attr", "label", "secondary nested 2")
|
|
102
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first().shadow().find("udex-secondary-navigation-sub-item").eq(2).should("have.attr", "label", "secondary nested 3")
|
|
119
103
|
});
|
|
120
104
|
|
|
121
|
-
it("dropdown renders nested items after clicking on the nested item",
|
|
122
|
-
|
|
105
|
+
it("dropdown renders nested items after clicking on the nested item", () => {
|
|
106
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first().click()
|
|
107
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first()
|
|
108
|
+
.shadow().find("udex-secondary-navigation-sub-item").first().click()
|
|
123
109
|
|
|
124
|
-
|
|
125
|
-
|
|
110
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first()
|
|
111
|
+
.shadow().find("udex-secondary-navigation-sub-item").eq(0).should("have.attr", "label", "secondary nested 1")
|
|
112
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first()
|
|
113
|
+
.shadow().find("udex-secondary-navigation-sub-item").eq(1).should("have.attr", "label", "tertiary nested 1")
|
|
114
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first()
|
|
115
|
+
.shadow().find("udex-secondary-navigation-sub-item").eq(2).should("have.attr", "label", "tertiary nested 2")
|
|
126
116
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
secondLevelItems.eq(1).should("have.text", "tertiary nested 1")
|
|
130
|
-
secondLevelItems.eq(2).should("have.text", "tertiary nested 2")
|
|
117
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first()
|
|
118
|
+
.shadow().find("udex-secondary-navigation-sub-item").eq(2).click();
|
|
131
119
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
120
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first()
|
|
121
|
+
.shadow().find("udex-secondary-navigation-sub-item").eq(0).should("have.attr", "label", "tertiary nested 2");
|
|
122
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first()
|
|
123
|
+
.shadow().find("udex-secondary-navigation-sub-item").eq(1).should("have.attr", "label", "quaternary nested 1");
|
|
124
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first()
|
|
125
|
+
.shadow().find("udex-secondary-navigation-sub-item").eq(2).should("have.attr", "label", "quaternary nested 2");
|
|
138
126
|
});
|
|
139
127
|
|
|
140
|
-
it("
|
|
141
|
-
|
|
128
|
+
it("dropdown renders previous nested items after clicking back on the nested item", () => {
|
|
129
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first().click();
|
|
142
130
|
|
|
143
|
-
|
|
144
|
-
|
|
131
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first().shadow().find("udex-secondary-navigation-sub-item").first()
|
|
132
|
+
.click();
|
|
145
133
|
|
|
146
|
-
|
|
147
|
-
|
|
134
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first()
|
|
135
|
+
.shadow().find("udex-secondary-navigation-sub-item").first().click()
|
|
148
136
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
137
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first()
|
|
138
|
+
.shadow().find("udex-secondary-navigation-sub-item").eq(0).should("have.attr", "label", "secondary nested 1")
|
|
139
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first()
|
|
140
|
+
.shadow().find("udex-secondary-navigation-sub-item").eq(1).should("have.attr", "label", "secondary nested 2")
|
|
141
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first()
|
|
142
|
+
.shadow().find("udex-secondary-navigation-sub-item").eq(2).should("have.attr", "label", "secondary nested 3")
|
|
153
143
|
});
|
|
154
144
|
|
|
155
145
|
it("opens dropdown on Enter key press", () => {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
.
|
|
159
|
-
|
|
146
|
+
cy.get("#secondary-nav").shadow()
|
|
147
|
+
.find(".udex-secondary-navigation__title").then($headingLink => {
|
|
148
|
+
$headingLink[0].removeAttribute("href")
|
|
149
|
+
})
|
|
150
|
+
.click()
|
|
151
|
+
.realPress("Tab").realPress("Enter");
|
|
160
152
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
153
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first().shadow()
|
|
154
|
+
.find(".udex-secondary-navigation__dropdown")
|
|
155
|
+
.should("be.visible");
|
|
164
156
|
});
|
|
165
157
|
|
|
166
158
|
it("closes dropdown on Esc key press", () => {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
.
|
|
170
|
-
|
|
159
|
+
cy.get("#secondary-nav").shadow()
|
|
160
|
+
.find(".udex-secondary-navigation__title").then($headingLink => {
|
|
161
|
+
$headingLink[0].removeAttribute("href")
|
|
162
|
+
})
|
|
163
|
+
.click()
|
|
164
|
+
.realPress("Tab").realPress("Escape");
|
|
171
165
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
166
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first().shadow()
|
|
167
|
+
.find(".udex-secondary-navigation__dropdown")
|
|
168
|
+
.should("not.exist");
|
|
175
169
|
});
|
|
176
170
|
|
|
177
171
|
it("moves focus to next item with ArrowRight", () => {
|
|
178
|
-
|
|
179
|
-
|
|
172
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").eq(1)
|
|
173
|
+
.click().realPress("{rightarrow}").realPress("Enter");
|
|
180
174
|
|
|
181
175
|
cy.get("@itemClickHandler").should("have.been.called").its("lastCall.args.0.detail.clickedItem").should("include", {title: "Secondary Navigation 3"})
|
|
182
176
|
cy.get("@itemClickHandler").should("have.been.called").its("lastCall.args.0.detail").should("include", {clickedIndex: 2})
|
|
183
177
|
});
|
|
184
178
|
|
|
185
179
|
it("moves focus to previous item with ArrowLeft", () => {
|
|
186
|
-
|
|
187
|
-
|
|
180
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").eq(1)
|
|
181
|
+
.click().realPress("{leftarrow}").realPress("Enter");
|
|
188
182
|
|
|
189
183
|
cy.get("@itemClickHandler").should("have.been.called").its("lastCall.args.0.detail.clickedItem").should("include",{ title: "Secondary Navigation 1"})
|
|
190
184
|
cy.get("@itemClickHandler").should("have.been.called").its("lastCall.args.0.detail").should("include", {clickedIndex: 0})
|
|
191
185
|
});
|
|
192
186
|
|
|
193
187
|
it("navigates right into nested item", () => {
|
|
194
|
-
|
|
195
|
-
.
|
|
196
|
-
.
|
|
197
|
-
|
|
188
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first()
|
|
189
|
+
.click()
|
|
190
|
+
.realPress("{downarrow}").realPress("Enter")
|
|
191
|
+
|
|
192
|
+
cy.get("@itemClickHandler").should("have.been.called").its("lastCall.args.0.detail.clickedItem").should("include",{ title: "secondary nested 2"})
|
|
198
193
|
});
|
|
199
194
|
|
|
200
195
|
it("navigates left back from nested item", () => {
|
|
201
|
-
|
|
202
|
-
.find("udex-secondary-
|
|
203
|
-
.
|
|
204
|
-
.
|
|
196
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first()
|
|
197
|
+
.click().shadow().find(".udex-secondary-navigation__dropdown")
|
|
198
|
+
.should("be.visible")
|
|
199
|
+
.realPress("{downarrow}").realPress("{rightarrow}").realPress("{leftarrow}").realPress("Enter")
|
|
200
|
+
|
|
201
|
+
cy.get("@itemClickHandler").should("have.been.called").its("lastCall.args.0.detail.clickedItem").should("include",{ title: "secondary nested 2"})
|
|
205
202
|
});
|
|
206
203
|
|
|
207
204
|
it("renders button when path is missing", () => {
|
|
208
|
-
|
|
205
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first().shadow().find(".udex-secondary-navigation__item")
|
|
209
206
|
.should("have.prop", "tagName").and("eq", "BUTTON");
|
|
210
207
|
});
|
|
211
208
|
|
|
212
209
|
it("renders anchor when path is present", () => {
|
|
213
|
-
|
|
210
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").eq(2)
|
|
214
211
|
.shadow()
|
|
215
212
|
.find(".udex-secondary-navigation__item")
|
|
216
213
|
.should("have.prop", "tagName")
|
|
@@ -218,13 +215,13 @@ describe("Desktop", () => {
|
|
|
218
215
|
});
|
|
219
216
|
|
|
220
217
|
it("button has 'active' attribute after click", () => {
|
|
221
|
-
|
|
222
|
-
.should("have.attr", "active")
|
|
218
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").eq(1).click()
|
|
219
|
+
.should("have.attr", "active")
|
|
223
220
|
});
|
|
224
221
|
|
|
225
222
|
it("link has 'active' attribute after click", () => {
|
|
226
|
-
|
|
227
|
-
.should("have.attr", "active")
|
|
223
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").eq(2).click()
|
|
224
|
+
.should("have.attr", "active")
|
|
228
225
|
});
|
|
229
226
|
|
|
230
227
|
it("closes navigation and focuses Secondary title on Shift+Tab", () => {
|
|
@@ -240,13 +237,17 @@ describe("Desktop", () => {
|
|
|
240
237
|
});
|
|
241
238
|
|
|
242
239
|
it("moves focus to next item on `More option`", () => {
|
|
243
|
-
|
|
240
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").eq(6).click().realPress("{downarrow}").realPress("Tab").realPress("Enter")
|
|
241
|
+
cy.get("#secondary-nav").find("udex-button").then($button => {
|
|
242
|
+
const { borderColor: buttonBorder } = window.getComputedStyle($button[0], "::after")
|
|
243
|
+
expect(buttonBorder).to.eq('rgb(0, 100, 217)');
|
|
244
|
+
})
|
|
244
245
|
});
|
|
245
246
|
|
|
246
247
|
it("dynamically changed nav-items attribute is applied", () => {
|
|
247
|
-
|
|
248
|
+
cy.get("#secondary-nav").invoke("attr", "nav-items", JSON.stringify(additionalNavItems));
|
|
248
249
|
|
|
249
|
-
|
|
250
|
+
cy.get("#secondary-nav").shadow().find(".udex-secondary-navigation__list-item").should("have.length", 3)
|
|
250
251
|
});
|
|
251
252
|
|
|
252
253
|
it("dynamically changes navigation visible items", () => {
|
|
@@ -286,18 +287,18 @@ describe("Desktop", () => {
|
|
|
286
287
|
})
|
|
287
288
|
|
|
288
289
|
it("closes dropdown and focuses buy now button", () => {
|
|
289
|
-
|
|
290
|
-
|
|
290
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first().click()
|
|
291
|
+
.shadow()
|
|
291
292
|
.find(".udex-secondary-navigation__dropdown")
|
|
292
293
|
.should("be.visible")
|
|
293
|
-
.realPress("Tab")
|
|
294
|
+
.realPress("Tab")
|
|
294
295
|
|
|
295
296
|
cy.get("#buy-now").should("be.focused");
|
|
296
297
|
});
|
|
297
298
|
|
|
298
299
|
it("navigates deep dropdown and focuses buy now button", () => {
|
|
299
|
-
|
|
300
|
-
|
|
300
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first().click()
|
|
301
|
+
.shadow()
|
|
301
302
|
.find(".udex-secondary-navigation__dropdown")
|
|
302
303
|
.should("be.visible")
|
|
303
304
|
.realPress("{downarrow}")
|
|
@@ -313,8 +314,8 @@ describe("Desktop", () => {
|
|
|
313
314
|
});
|
|
314
315
|
|
|
315
316
|
it("focuses last dropdown item with End key", () => {
|
|
316
|
-
|
|
317
|
-
|
|
317
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first().click()
|
|
318
|
+
.shadow()
|
|
318
319
|
.find(".udex-secondary-navigation__dropdown")
|
|
319
320
|
.should("be.visible")
|
|
320
321
|
.realPress("{downarrow}")
|
|
@@ -325,8 +326,8 @@ describe("Desktop", () => {
|
|
|
325
326
|
});
|
|
326
327
|
|
|
327
328
|
it("focuses first dropdown item on Home key", () => {
|
|
328
|
-
|
|
329
|
-
|
|
329
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first().click()
|
|
330
|
+
.shadow()
|
|
330
331
|
.find(".udex-secondary-navigation__dropdown")
|
|
331
332
|
.should("be.visible")
|
|
332
333
|
.realPress("{downarrow}")
|
|
@@ -338,7 +339,10 @@ describe("Desktop", () => {
|
|
|
338
339
|
});
|
|
339
340
|
|
|
340
341
|
it("moves focus down in dropdown with ArrowDown", () => {
|
|
341
|
-
|
|
342
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first().click()
|
|
343
|
+
.shadow()
|
|
344
|
+
.find(".udex-secondary-navigation__dropdown")
|
|
345
|
+
.should("be.visible")
|
|
342
346
|
.realPress("{downarrow}")
|
|
343
347
|
.realPress("{downarrow}")
|
|
344
348
|
.realPress("{enter}");
|
|
@@ -347,7 +351,10 @@ describe("Desktop", () => {
|
|
|
347
351
|
});
|
|
348
352
|
|
|
349
353
|
it("moves focus up in dropdown with ArrowUp", () => {
|
|
350
|
-
|
|
354
|
+
cy.get("#secondary-nav").shadow().find("udex-secondary-navigation-item").first().click()
|
|
355
|
+
.shadow()
|
|
356
|
+
.find(".udex-secondary-navigation__dropdown")
|
|
357
|
+
.should("be.visible")
|
|
351
358
|
.realPress("{downarrow}")
|
|
352
359
|
.realPress("{downarrow}")
|
|
353
360
|
.realPress("{uparrow}")
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import UDExBreadcrumbs from "
|
|
2
|
-
import UDExBreadcrumbsItem from "../../src/BreadcrumbsItem.js";
|
|
3
|
-
import UDExButton from "../../src/Button.js";
|
|
4
|
-
import UDExSecondaryNavigation from "../../src/SecondaryNavigation.js";
|
|
1
|
+
import { UDExBreadcrumbs, UDExBreadcrumbsItem, UDExButton, UDExSecondaryNavigation } from "../support/component-imports.js";
|
|
5
2
|
import navItems from "../fixtures/secondary-navigation-items.js";
|
|
6
3
|
|
|
7
4
|
const defaultSecondaryNavigation = <UDExSecondaryNavigation
|
|
@@ -23,70 +20,62 @@ const defaultSecondaryNavigation = <UDExSecondaryNavigation
|
|
|
23
20
|
|
|
24
21
|
describe("SecondaryNavigation", () => {
|
|
25
22
|
describe("Mobile", () => {
|
|
26
|
-
let mobileNavOpener: Cypress.Chainable<JQuery<HTMLElement>>;
|
|
27
23
|
|
|
28
24
|
beforeEach(() => {
|
|
29
|
-
cy.mount(defaultSecondaryNavigation)
|
|
30
25
|
cy.viewport(979, 1080)
|
|
31
|
-
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
afterEach( () => {
|
|
35
|
-
mobileNavOpener = null;
|
|
26
|
+
cy.mount(defaultSecondaryNavigation)
|
|
36
27
|
});
|
|
37
28
|
|
|
38
29
|
it("mobile opener visible", () => {
|
|
39
|
-
|
|
30
|
+
cy.get("#secondary-nav").shadow().find(".udex-secondary-navigation__mobile-nav").should("be.visible")
|
|
40
31
|
});
|
|
41
32
|
|
|
42
33
|
it("mobile dropdown hidden", () => {
|
|
43
|
-
|
|
34
|
+
cy.get("#secondary-nav").shadow().find(".udex-secondary-navigation__mobile-nav").shadow().find(".udex-secondary-navigation__dropdown").should("not.exist")
|
|
44
35
|
});
|
|
45
36
|
|
|
46
37
|
it("renders \"mobileLinkTitle\" for the item", () => {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
38
|
+
cy.get("#secondary-nav").shadow().find(".udex-secondary-navigation__mobile-nav").click()
|
|
39
|
+
cy.get("#secondary-nav").shadow().find(".udex-secondary-navigation__mobile-nav")
|
|
40
|
+
.shadow().find("udex-secondary-navigation-sub-item").first()
|
|
41
|
+
.should("have.attr", "mobile-link-title", "Secondary Navigation 1 mobile")
|
|
51
42
|
});
|
|
52
43
|
|
|
53
44
|
it("renders \"title\" for the item when no \"mobileLinkTitle\"", () => {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
45
|
+
cy.get("#secondary-nav").shadow().find(".udex-secondary-navigation__mobile-nav").click()
|
|
46
|
+
cy.get("#secondary-nav").shadow().find(".udex-secondary-navigation__mobile-nav")
|
|
47
|
+
.shadow().find("udex-secondary-navigation-sub-item").eq(1)
|
|
48
|
+
.should("have.attr", "label", "Secondary Navigation 2")
|
|
58
49
|
});
|
|
59
50
|
|
|
60
51
|
it("opens/closes by pressing the mobile button", () => {
|
|
61
|
-
|
|
52
|
+
cy.get("#secondary-nav").shadow().find(".udex-secondary-navigation__mobile-nav").click();
|
|
62
53
|
|
|
63
|
-
|
|
64
|
-
|
|
54
|
+
cy.get("#secondary-nav").shadow().find(".udex-secondary-navigation__mobile-nav").shadow().find(".udex-secondary-navigation__dropdown")
|
|
55
|
+
.should("be.visible")
|
|
65
56
|
|
|
66
|
-
|
|
67
|
-
|
|
57
|
+
cy.get("#secondary-nav").shadow().find(".udex-secondary-navigation__mobile-nav").click();
|
|
58
|
+
cy.get("#secondary-nav").shadow().find(".udex-secondary-navigation__mobile-nav").shadow().find(".udex-secondary-navigation__dropdown")
|
|
59
|
+
.should("not.exist")
|
|
68
60
|
});
|
|
69
61
|
|
|
70
62
|
it("closes after pressing the mobile navigation item", () => {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const mobileDropdown = mobileNavOpener.shadow().find(".udex-secondary-navigation__dropdown");
|
|
74
|
-
const mobileItems = mobileDropdown.shadow().find("udex-secondary-navigation-sub-item");
|
|
63
|
+
cy.get("#secondary-nav").shadow().find(".udex-secondary-navigation__mobile-nav").click();
|
|
75
64
|
|
|
76
|
-
|
|
65
|
+
cy.get("#secondary-nav").shadow().find(".udex-secondary-navigation__mobile-nav").shadow().find(".udex-secondary-navigation__dropdown")
|
|
66
|
+
.should("be.visible")
|
|
77
67
|
|
|
78
|
-
|
|
68
|
+
cy.get("#secondary-nav").shadow().find(".udex-secondary-navigation__mobile-nav").shadow().find("udex-secondary-navigation-sub-item").eq(2).click();
|
|
69
|
+
cy.get("#secondary-nav").shadow().find(".udex-secondary-navigation__mobile-nav").shadow().find(".udex-secondary-navigation__dropdown")
|
|
70
|
+
.should("not.exist")
|
|
79
71
|
});
|
|
80
72
|
|
|
81
73
|
it("active title changes when pressing navigation item", () => {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
const mobileDropdown = mobileNavOpener.shadow().find(".udex-secondary-navigation__dropdown");
|
|
85
|
-
const mobileItems = mobileDropdown.shadow().find("udex-secondary-navigation-sub-item");
|
|
74
|
+
cy.get("#secondary-nav").shadow().find(".udex-secondary-navigation__mobile-nav").click();
|
|
86
75
|
|
|
87
|
-
|
|
76
|
+
cy.get("#secondary-nav").shadow().find(".udex-secondary-navigation__mobile-nav").shadow().find("udex-secondary-navigation-sub-item").eq(2).click();
|
|
88
77
|
|
|
89
|
-
const subTitle =
|
|
78
|
+
const subTitle = cy.get("#secondary-nav").shadow().find(".udex-secondary-navigation__mobile-nav").shadow().find(".udex-secondary-navigation__item-sub-title");
|
|
90
79
|
subTitle.should("have.text", "Secondary Navigation 3 mobile");
|
|
91
80
|
});
|
|
92
81
|
});
|