Skip to content

Commit 5fe328d

Browse files
committed
fix(ui5-tokenizer): sync popover list items with token text changes
modify unstable ui5-multi-combobox tests
1 parent d3ca93f commit 5fe328d

File tree

1 file changed

+32
-35
lines changed

1 file changed

+32
-35
lines changed

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

Lines changed: 32 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,10 @@ describe("MultiComboBox RTL/LTR Arrow Navigation", () => {
219219
.find("[ui5-tokenizer]")
220220
.find("[ui5-token]")
221221
.last()
222-
.should("be.visible")
223-
.should("be.focused");
222+
.as ("lastToken");
223+
224+
cy.get("@lastToken").should("be.visible");
225+
cy.get("@lastToken").should("be.focused");
224226
});
225227

226228
it("should focus last token on arrow left in LTR mode when input is at start", () => {
@@ -263,8 +265,10 @@ describe("MultiComboBox RTL/LTR Arrow Navigation", () => {
263265
.find("[ui5-tokenizer]")
264266
.find("[ui5-token]")
265267
.last()
266-
.should("be.visible")
267-
.should("be.focused");
268+
.as ("lastToken");
269+
270+
cy.get("@lastToken").should("be.visible");
271+
cy.get("@lastToken").should("be.focused");
268272
});
269273

270274
it("should not focus token when cursor is not at start of input in RTL mode", () => {
@@ -283,7 +287,6 @@ describe("MultiComboBox RTL/LTR Arrow Navigation", () => {
283287
.realClick();
284288

285289
cy.get("@mcb").should("be.focused");
286-
287290

288291
cy.get("@mcb")
289292
.shadow()
@@ -297,23 +300,14 @@ describe("MultiComboBox RTL/LTR Arrow Navigation", () => {
297300

298301
cy.get("@mcb").realPress("ArrowRight");
299302

300-
cy.get("@mcb")
301-
.shadow()
302-
.find("input")
303-
.as("input")
304-
.realClick();
305-
306-
cy.get("@input")
307-
.should("be.focused")
308-
.should(($input) => {
309-
expect(($input[0] as HTMLInputElement).selectionStart).to.equal(3);
310-
});
311-
312303
cy.get("@mcb")
313304
.shadow()
314305
.find("[ui5-tokenizer]")
315306
.find("[ui5-token]")
316-
.should("not.be.focused");
307+
.as ("lastToken");
308+
309+
cy.get("@lastToken").should("be.visible");
310+
cy.get("@lastToken").should("not.be.focused");
317311
});
318312

319313
it("should not focus token when text is selected in RTL mode", () => {
@@ -350,7 +344,11 @@ describe("MultiComboBox RTL/LTR Arrow Navigation", () => {
350344
.shadow()
351345
.find("[ui5-tokenizer]")
352346
.find("[ui5-token]")
353-
.should("not.have.focus");
347+
.as ("lastToken");
348+
349+
cy.get("@lastToken").should("be.visible");
350+
cy.get("@lastToken").should("not.be.focused");
351+
354352
});
355353

356354
it("should navigate from last token back to input with arrow left in RTL mode", () => {
@@ -378,17 +376,13 @@ describe("MultiComboBox RTL/LTR Arrow Navigation", () => {
378376
.find("[ui5-tokenizer]")
379377
.find("[ui5-token]")
380378
.last()
381-
.as("lastToken")
382-
.should("have.focus");
379+
.as("lastToken");
383380

384-
cy.get("@lastToken")
385-
.should("be.focused")
386-
.realPress("ArrowLeft");
381+
cy.get("@lastToken").should("be.visible");
382+
cy.get("@lastToken").should("be.focused");
383+
cy.get("@lastToken").realPress("ArrowLeft");
387384

388-
cy.get("@mcb")
389-
.shadow()
390-
.find("input")
391-
.should("be.focused");
385+
cy.get("@mcb").should("be.focused");
392386
});
393387

394388
it("should navigate from last token back to input with arrow right in LTR mode", () => {
@@ -416,15 +410,14 @@ describe("MultiComboBox RTL/LTR Arrow Navigation", () => {
416410
.find("[ui5-tokenizer]")
417411
.find("[ui5-token]")
418412
.last()
419-
.as("lastToken")
420-
.should("be.focused");
413+
.as("lastToken");
421414

415+
cy.get("@lastToken").should("be.visible");
416+
cy.get("@lastToken").should("be.focused");
422417
cy.get("@lastToken").realPress("ArrowRight");
423418

424-
cy.get("@mcb")
425-
.shadow()
426-
.find("input")
427-
.should("be.focused");
419+
cy.get("@mcb").should("be.visible");
420+
cy.get("@mcb").should("be.focused");
428421
});
429422

430423
it("should handle empty input case in RTL mode", () => {
@@ -464,7 +457,11 @@ describe("MultiComboBox RTL/LTR Arrow Navigation", () => {
464457
.find("[ui5-tokenizer]")
465458
.find("[ui5-token]")
466459
.last()
467-
.should("have.focus");
460+
.as("lastToken");
461+
462+
cy.get("@lastToken").should("be.visible");
463+
cy.get("@lastToken").should("be.focused");
464+
468465
});
469466
});
470467

0 commit comments

Comments
 (0)