groupnode imageupload test

give widget unique name
This commit is contained in:
pythongosssss 2023-11-15 20:31:13 +00:00
parent 31bc856aa3
commit 3ef9395a96
2 changed files with 12 additions and 1 deletions

View File

@ -627,4 +627,14 @@ describe("group node", () => {
expect(decode.outputs[0].connections[0].targetNode.id).toBe(preview1.id);
expect(decode.outputs[0].connections[1].targetNode.id).toBe(preview2.id);
});
test("works with IMAGEUPLOAD widget", async () => {
const { ez, graph, app } = await start();
const img = ez.LoadImage();
const preview1 = ez.PreviewImage(img.outputs[0]);
const group = await convertToGroup(app, graph, "test", [img, preview1]);
const widget = group.widgets["LoadImage upload"];
expect(widget).toBeTruthy();
expect(widget.widget.type).toBe("button");
});
});

View File

@ -490,9 +490,10 @@ export const ComfyWidgets = {
document.body.append(fileInput);
// Create the button widget for selecting the files
uploadWidget = node.addWidget("button", "choose file to upload", "image", () => {
uploadWidget = node.addWidget("button", inputName, "image", () => {
fileInput.click();
});
uploadWidget.label = "choose file to upload";
uploadWidget.serialize = false;
// Add handler to check if an image is being dragged over our node