Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions packages/main/cypress/specs/FileUploader.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,62 @@ describe("Interaction", () => {
.find("[ui5-token]")
.should("have.length", 1);
});

it("tokenizer collapses when n-More popover loses focus", () => {
cy.mount(
<FileUploader id="uploader" style="width: 200px;"></FileUploader>
);

cy.get("[ui5-file-uploader]")
.as("uploader")
.shadow()
.find("input[type='file']")
.selectFile([
{
contents: Cypress.Buffer.from("file1 content"),
fileName: "file1.txt",
mimeType: "text/plain"
},
{
contents: Cypress.Buffer.from("file2 content"),
fileName: "file11.txt",
mimeType: "text/plain"
},
{
contents: Cypress.Buffer.from("file3 content"),
fileName: "file111.txt",
mimeType: "text/plain"
}
], { force: true });

cy.get("@uploader")
.shadow()
.find("[ui5-tokenizer]")
.as("tokenizer")
.should("exist");

cy.get("@uploader").realClick();
cy.get("@uploader").realPress("ArrowRight");

cy.focused()
.should("have.attr", "aria-description", "Token");

cy.realPress(["Control", "i"]);

cy.get("@tokenizer")
.shadow()
.find("ui5-responsive-popover")
.should("exist");

cy.get("@tokenizer")
.should("have.attr", "expanded");

cy.get("body")
.realClick();

cy.get("@tokenizer")
.should("not.have.attr", "expanded");
});
});

describe("Accessibility", () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/main/src/FileUploader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ class FileUploader extends UI5Element implements IFormInputElement {

this.focused = false;
if (this._tokenizer) {
this._tokenizer.expanded = this._tokenizerOpen;
this._tokenizer.expanded = this._tokenizer.open;
}
}

Expand Down Expand Up @@ -667,7 +667,7 @@ class FileUploader extends UI5Element implements IFormInputElement {
}

get shouldOpenValueStateMessagePopover(): boolean {
return this.focused && this.hasValueState && !this.hideInput && !this._tokenizerOpen;
return this.focused && this.hasValueState && !this.hideInput && !this._tokenizer?.open;
}

/**
Expand Down
Loading