mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-03 06:47:33 +00:00
TypeScript conversion groundwork (#163)
* ContextMenu ES6 class conversion * Fix compat with extensions * CurveEditor ES6 class conversion * Split most of the LiteGraph global out to a class * Move remainder of LiteGraph global to class file * Remove IIFE wrapper * Fix jest tests throwing due to type narrowing
This commit is contained in:
1071
src/LiteGraphGlobal.ts
Normal file
1071
src/LiteGraphGlobal.ts
Normal file
File diff suppressed because it is too large
Load Diff
1045
src/litegraph.js
1045
src/litegraph.js
File diff suppressed because it is too large
Load Diff
@@ -12,13 +12,16 @@ describe("LegacyLGraph Compatibility Layer", () => {
|
||||
|
||||
test("LGraph can be extended via prototype", () => {
|
||||
const graph = new LGraph();
|
||||
// @ts-expect-error Should always be an error.
|
||||
LGraph.prototype.newMethod = function () {
|
||||
return "New method added via prototype";
|
||||
};
|
||||
// @ts-expect-error Should always be an error.
|
||||
expect(graph.newMethod()).toBe("New method added via prototype");
|
||||
});
|
||||
|
||||
test("LegacyLGraph is correctly assigned to LiteGraph", () => {
|
||||
// @ts-expect-error Fixed later in the TS conversion process.
|
||||
expect(LiteGraph.LGraph).toBe(LGraph);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -5,7 +5,9 @@ import {
|
||||
describe("LGraphNode", () => {
|
||||
it("should serialize position correctly", () => {
|
||||
const node = new LGraphNode("TestNode");
|
||||
// @ts-expect-error Expected - not a TS class yet.
|
||||
node.pos = [10, 10];
|
||||
// @ts-expect-error JS tests in TS format
|
||||
expect(node.pos).toEqual(new Float32Array([10, 10]));
|
||||
expect(node.serialize().pos).toEqual(new Float32Array([10, 10]));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user