mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-02-15 16:02:32 +08:00
move to describe
This commit is contained in:
parent
a2fafda0e0
commit
8040581506
@ -4,16 +4,18 @@
|
|||||||
const { start } = require("../utils");
|
const { start } = require("../utils");
|
||||||
const lg = require("../utils/litegraph");
|
const lg = require("../utils/litegraph");
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
lg.setup(global);
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(() => {
|
describe("widget inputs", () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
lg.setup(global);
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
lg.teardown(global);
|
lg.teardown(global);
|
||||||
jest.resetModules();
|
jest.resetModules();
|
||||||
});
|
});
|
||||||
|
|
||||||
[
|
[
|
||||||
{ name: "int", type: "INT", widget: "number", control: true },
|
{ name: "int", type: "INT", widget: "number", control: true },
|
||||||
{ name: "float", type: "FLOAT", widget: "number", control: true },
|
{ name: "float", type: "FLOAT", widget: "number", control: true },
|
||||||
{ name: "text", type: "STRING" },
|
{ name: "text", type: "STRING" },
|
||||||
@ -24,7 +26,7 @@ afterEach(() => {
|
|||||||
},
|
},
|
||||||
{ name: "toggle", type: "BOOLEAN" },
|
{ name: "toggle", type: "BOOLEAN" },
|
||||||
{ name: "combo", type: ["a", "b", "c"], control: true },
|
{ name: "combo", type: ["a", "b", "c"], control: true },
|
||||||
].forEach((c) => {
|
].forEach((c) => {
|
||||||
test(`widget conversion + primitive works on ${c.name}`, async () => {
|
test(`widget conversion + primitive works on ${c.name}`, async () => {
|
||||||
/**
|
/**
|
||||||
* Test node with widgets of each type
|
* Test node with widgets of each type
|
||||||
@ -74,10 +76,9 @@ afterEach(() => {
|
|||||||
// Ensure we dont have other widgets
|
// Ensure we dont have other widgets
|
||||||
expect(p1.node.widgets).toHaveLength(1 + +!!c.control);
|
expect(p1.node.widgets).toHaveLength(1 + +!!c.control);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("converted widget works after reload", async () => {
|
||||||
test("converted widget works after reload", async () => {
|
|
||||||
const { graph, ez } = await start();
|
const { graph, ez } = await start();
|
||||||
let n = ez.CheckpointLoaderSimple();
|
let n = ez.CheckpointLoaderSimple();
|
||||||
|
|
||||||
@ -133,9 +134,9 @@ test("converted widget works after reload", async () => {
|
|||||||
expect(n.widgets.ckpt_name.isConvertedToInput).toBeFalsy();
|
expect(n.widgets.ckpt_name.isConvertedToInput).toBeFalsy();
|
||||||
expect(n.inputs.ckpt_name).toBeFalsy();
|
expect(n.inputs.ckpt_name).toBeFalsy();
|
||||||
expect(n.inputs.length).toEqual(inputCount);
|
expect(n.inputs.length).toEqual(inputCount);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("converted widget works on clone", async () => {
|
test("converted widget works on clone", async () => {
|
||||||
const { graph, ez } = await start();
|
const { graph, ez } = await start();
|
||||||
let n = ez.CheckpointLoaderSimple();
|
let n = ez.CheckpointLoaderSimple();
|
||||||
|
|
||||||
@ -163,4 +164,5 @@ test("converted widget works on clone", async () => {
|
|||||||
clone.widgets.ckpt_name.convertToWidget();
|
clone.widgets.ckpt_name.convertToWidget();
|
||||||
expect(clone.widgets.ckpt_name.isConvertedToInput).toBeFalsy();
|
expect(clone.widgets.ckpt_name.isConvertedToInput).toBeFalsy();
|
||||||
expect(clone.inputs.ckpt_name).toBeFalsy();
|
expect(clone.inputs.ckpt_name).toBeFalsy();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
Loading…
Reference in New Issue
Block a user