Skip to content

Commit

Permalink
fix(ui5-file-uploader): remove the cloning of the value state message (
Browse files Browse the repository at this point in the history
…#9915)

The valueStateMessage slot content no longer needs to be cloned, as the ui5-popover is now integrated into the component’s shadow root through the new Popover API.
  • Loading branch information
hinzzx authored Sep 24, 2024
1 parent d594ae7 commit a73dd60
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
4 changes: 0 additions & 4 deletions packages/main/src/FileUploader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -475,10 +475,6 @@ class FileUploader extends UI5Element implements IFormInputElement {
return this.hasValueState && this.valueState !== ValueState.Positive;
}

get valueStateMessageText() {
return this.getSlottedNodes("valueStateMessage").map(el => el.cloneNode(true));
}

get shouldDisplayDefaultValueStateMessage(): boolean {
return !this.valueStateMessage.length && this.hasValueStateText;
}
Expand Down
4 changes: 1 addition & 3 deletions packages/main/src/FileUploaderPopover.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
{{#if shouldDisplayDefaultValueStateMessage}}
{{valueStateText}}
{{else}}
{{#each valueStateMessageText}}
{{this}}
{{/each}}
<slot name="valueStateMessage"></slot>
{{/if}}
{{/inline}}
2 changes: 1 addition & 1 deletion packages/main/test/pages/FileUploader.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

<div>
<label>FileUploader with ValueState</label>
<ui5-file-uploader placeholder="upload file" value-state="Critical">
<ui5-file-uploader placeholder="upload file" value-state="Critical" id="fu-valuestate-test">
<ui5-button>Upload</ui5-button>
</ui5-file-uploader>

Expand Down
14 changes: 14 additions & 0 deletions packages/main/test/specs/FileUploader.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,18 @@ describe("API", () => {

assert.notOk(await fileUploader.isFocused(), "Uploader isn't focusable");
});

it("Value state message of type 'Critical' is opened on focusing the File Uploader button", async () => {
await browser.url(`test/pages/FileUploader.html`);

const fileUploader = await browser.$("#fu-valuestate-test");
await browser.keys("Tab");
await browser.keys("Tab");
await browser.keys("Tab");

const valueState = await fileUploader.shadow$("ui5-popover");

assert.ok(await valueState.isExisting(), "Value state message exists.");
assert.ok(await valueState.getProperty("open"), "File Uploader in focus should have open value state message.");
});
});

0 comments on commit a73dd60

Please sign in to comment.