Skip to content

Commit 39325f8

Browse files
authored
Merge branch 'main' into mi-vh-icon-state
2 parents 1def053 + 85e9be1 commit 39325f8

31 files changed

+869
-189
lines changed

packages/base/src/Runtimes.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import getSharedResource from "./getSharedResource.js";
66
type RuntimeData = VersionInfo & {
77
alias: string,
88
description: string,
9+
importMetaUrl: string,
910
};
1011

1112
let currentRuntimeIndex: number;
@@ -41,6 +42,7 @@ const registerCurrentRuntime = () => {
4142
},
4243
alias: currentRuntimeAlias,
4344
description: `Runtime ${currentRuntimeIndex} - ver ${versionInfo.version}${currentRuntimeAlias ? ` (${currentRuntimeAlias})` : ""}`,
45+
importMetaUrl: import.meta.url,
4446
});
4547
}
4648
};

packages/main/cypress/specs/Carousel.cy.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -557,10 +557,10 @@ describe("Carousel general interaction", () => {
557557
cy.get("#firstButton").realClick();
558558
cy.realPress("End");
559559
cy.get("#testHomeAndEnd").should("have.prop", "_focusedItemIndex", 9);
560-
cy.get("#testHomeAndEnd").should("have.prop", "_currentSlideIndex", 9);
560+
cy.get("#testHomeAndEnd").should("have.prop", "_currentPageIndex", 9);
561561
cy.realPress("Home");
562562
cy.get("#testHomeAndEnd").should("have.prop", "_focusedItemIndex", 0);
563-
cy.get("#testHomeAndEnd").should("have.prop", "_currentSlideIndex", 0);
563+
cy.get("#testHomeAndEnd").should("have.prop", "_currentPageIndex", 0);
564564
});
565565

566566
it("'PageUp' and 'PageDown' button press", () => {
@@ -592,22 +592,22 @@ describe("Carousel general interaction", () => {
592592

593593
cy.get("#firstButton").realClick();
594594
cy.get("#testPageUpDown").should("have.prop", "_focusedItemIndex", 0);
595-
cy.get("#testPageUpDown").should("have.prop", "_currentSlideIndex", 0);
595+
cy.get("#testPageUpDown").should("have.prop", "_currentPageIndex", 0);
596596
cy.realPress("PageUp");
597597
cy.get("#testPageUpDown").should("have.prop", "_focusedItemIndex", 10);
598-
cy.get("#testPageUpDown").should("have.prop", "_currentSlideIndex", 10);
598+
cy.get("#testPageUpDown").should("have.prop", "_currentPageIndex", 10);
599599
cy.realPress("PageUp");
600600
cy.get("#testPageUpDown").should("have.prop", "_focusedItemIndex", 20);
601-
cy.get("#testPageUpDown").should("have.prop", "_currentSlideIndex", 19);
601+
cy.get("#testPageUpDown").should("have.prop", "_currentPageIndex", 19);
602602
cy.realPress("PageUp");
603603
cy.get("#testPageUpDown").should("have.prop", "_focusedItemIndex", 21);
604-
cy.get("#testPageUpDown").should("have.prop", "_currentSlideIndex", 19);
604+
cy.get("#testPageUpDown").should("have.prop", "_currentPageIndex", 19);
605605
cy.realPress("PageDown");
606606
cy.get("#testPageUpDown").should("have.prop", "_focusedItemIndex", 9);
607-
cy.get("#testPageUpDown").should("have.prop", "_currentSlideIndex", 9);
607+
cy.get("#testPageUpDown").should("have.prop", "_currentPageIndex", 9);
608608
cy.realPress("PageDown");
609609
cy.get("#testPageUpDown").should("have.prop", "_focusedItemIndex", 0);
610-
cy.get("#testPageUpDown").should("have.prop", "_currentSlideIndex", 0);
610+
cy.get("#testPageUpDown").should("have.prop", "_currentPageIndex", 0);
611611
cy.realPress("PageDown");
612612
cy.get("#testPageUpDown").should("have.prop", "_focusedItemIndex", 0);
613613
});

packages/main/cypress/specs/Input.cy.tsx

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3425,5 +3425,113 @@ describe("Input built-in filtering", () => {
34253425
cy.get("@input")
34263426
.should("have.value", "a");
34273427
});
3428+
3429+
it("should restore typed value when pressing arrow up from first suggestion", () => {
3430+
cy.mount(
3431+
<Input id="arrow-up-test" showSuggestions>
3432+
<SuggestionItem text="Argentina" />
3433+
<SuggestionItem text="Australia" />
3434+
</Input>
3435+
);
3436+
3437+
cy.get("#arrow-up-test")
3438+
.shadow()
3439+
.find("input")
3440+
.as("input");
3441+
3442+
cy.get("@input")
3443+
.realClick()
3444+
.realType("A");
3445+
3446+
cy.get("@input")
3447+
.should("have.value", "Argentina");
3448+
3449+
cy.realPress("ArrowDown");
3450+
3451+
cy.get("@input")
3452+
.should("have.value", "Australia");
3453+
3454+
cy.realPress("ArrowUp");
3455+
3456+
cy.get("@input")
3457+
.should("have.value", "Argentina");
3458+
3459+
cy.realPress("ArrowUp");
3460+
3461+
cy.get("@input")
3462+
.should("have.value", "A");
3463+
});
3464+
3465+
it("should select all text for non-matching items and partial for matching during navigation", () => {
3466+
cy.mount(
3467+
<Input id="typeahead-nav-test" showSuggestions>
3468+
<SuggestionItem text="Aute" />
3469+
<SuggestionItem text="ad" />
3470+
<SuggestionItem text="exercitation" />
3471+
</Input>
3472+
);
3473+
3474+
cy.get("#typeahead-nav-test")
3475+
.shadow()
3476+
.find("input")
3477+
.as("input");
3478+
3479+
cy.get("@input")
3480+
.realClick()
3481+
.realType("A");
3482+
3483+
cy.get("@input")
3484+
.should("have.value", "Aute")
3485+
.should(($input) => {
3486+
const input = $input[0] as HTMLInputElement;
3487+
expect(input.selectionStart).to.equal(1);
3488+
expect(input.selectionEnd).to.equal(4);
3489+
});
3490+
3491+
cy.realPress("ArrowDown");
3492+
3493+
cy.get("@input")
3494+
.should("have.value", "ad")
3495+
.should(($input) => {
3496+
const input = $input[0] as HTMLInputElement;
3497+
expect(input.selectionStart).to.equal(1);
3498+
expect(input.selectionEnd).to.equal(2);
3499+
});
3500+
3501+
cy.realPress("ArrowDown");
3502+
3503+
cy.get("@input")
3504+
.should("have.value", "exercitation")
3505+
.should(($input) => {
3506+
const input = $input[0] as HTMLInputElement;
3507+
expect(input.selectionStart).to.equal(0);
3508+
expect(input.selectionEnd).to.equal(12);
3509+
});
3510+
3511+
cy.realPress("ArrowUp");
3512+
3513+
cy.get("@input")
3514+
.should("have.value", "ad")
3515+
.should(($input) => {
3516+
const input = $input[0] as HTMLInputElement;
3517+
expect(input.selectionStart).to.equal(1);
3518+
expect(input.selectionEnd).to.equal(2);
3519+
});
3520+
3521+
cy.realPress("ArrowUp");
3522+
3523+
cy.get("@input")
3524+
.should("have.value", "Aute")
3525+
.should(($input) => {
3526+
const input = $input[0] as HTMLInputElement;
3527+
expect(input.selectionStart).to.equal(1);
3528+
expect(input.selectionEnd).to.equal(4);
3529+
});
3530+
3531+
cy.realPress("ArrowUp");
3532+
3533+
cy.get("@input")
3534+
.should("have.value", "A");
3535+
});
34283536
});
34293537
});

packages/main/cypress/specs/MultiInput.cy.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,7 +1290,7 @@ describe("Keyboard handling", () => {
12901290
.should("be.focused");
12911291
});
12921292

1293-
it("should focus token last token when caret is at the beginning of the value", () => {
1293+
it("should not focus token on backspace when input has value and caret is at position 0", () => {
12941294
cy.mount(
12951295
<MultiInput id="two-tokens" value="abc">
12961296
<Token slot="tokens" id="firstToken" text="aa"></Token>
@@ -1312,9 +1312,11 @@ describe("Keyboard handling", () => {
13121312

13131313
cy.realPress("Backspace");
13141314

1315-
cy.get("[ui5-token]")
1316-
.eq(1)
1315+
cy.get("@innerInput")
13171316
.should("be.focused");
1317+
1318+
cy.get("@innerInput")
1319+
.should("have.value", "abc");
13181320
});
13191321

13201322
// Test is skipped for now as it fails randomly

packages/main/cypress/specs/StepInput.cy.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,12 +646,32 @@ describe("StepInput thousand separator formatting", () => {
646646
);
647647

648648
cy.get("[ui5-step-input]")
649+
.as("stepInput");
650+
651+
cy.get<StepInput>("@stepInput")
649652
.ui5StepInputGetInnerInput()
650653
.should($input => {
651654
const val = $input.val() as string;
652655
const num = Number(val.replace(/[^\d]/g, ""));
653656
expect(num).to.equal(12345);
654657
});
658+
659+
cy.get<StepInput>("@stepInput")
660+
.realClick({ "clickCount": 2 })
661+
.should("be.focused");
662+
663+
cy.realType("1,0000");
664+
cy.realPress("Enter");
665+
666+
cy.get<StepInput>("@stepInput")
667+
.ui5StepInputGetInnerInput()
668+
.should($input => {
669+
const val = $input.val() as string;
670+
expect(val).to.equal("10,000");
671+
});
672+
673+
cy.get<StepInput>("@stepInput")
674+
.should("have.prop", "value", 10000);
655675
});
656676

657677
it("should update input value when language is changed", () => {

packages/main/cypress/specs/Switch.cy.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ describe("General accesibility attributes", () => {
111111
.ui5SwitchCheckAttributeInShadowDomRoot("role", "switch");
112112

113113
cy.get("@switch")
114-
.ui5SwitchCheckAttributeInShadowDomRoot("aria-label", `${geoLocationDescr} No`);
114+
.ui5SwitchCheckAttributeInShadowDomRoot("aria-label", geoLocationDescr);
115115

116116
});
117117

@@ -127,7 +127,7 @@ describe("General accesibility attributes", () => {
127127
.ui5SwitchCheckAttributeInShadowDomRoot("role", "switch");
128128

129129
cy.get("@switch")
130-
.ui5SwitchCheckAttributeInShadowDomRoot("aria-label", `${gpsLocationDescr} No`);
130+
.ui5SwitchCheckAttributeInShadowDomRoot("aria-label", gpsLocationDescr);
131131
});
132132

133133
it("Should set correct correct tooltip on the root", () => {
@@ -137,11 +137,13 @@ describe("General accesibility attributes", () => {
137137
.ui5SwitchCheckAttributeInShadowDomRoot("title", gpsLocationDescr);
138138
});
139139

140-
it("Should set correct attribute 'aria-label' when 'text-on' and 'text-off' attributes aren't set", () => {
140+
it("Should not have 'aria-label' attribute when 'text-on' and 'text-off' attributes aren't set", () => {
141141
cy.mount(<Switch></Switch>);
142142

143143
cy.get("[ui5-switch]")
144-
.ui5SwitchCheckAttributeInShadowDomRoot("aria-label", "");
144+
.shadow()
145+
.find(".ui5-switch-root")
146+
.should("not.have.attr", "aria-label");
145147
});
146148

147149
it("Should propagate 'required' attribute properly on the root", () => {

0 commit comments

Comments
 (0)