mirror of
https://github.com/Elysola/WebHooker.git
synced 2026-11-21 01:23:40 +00:00
feat(console): confirm removing filled editor rows
Filter conditions and groups, delivery targets, saved fragments and forge hosts vanished on a single click, taking whatever had been typed with them. Rows holding content now ask first, while empty, never-filled rows (`isBlankNode`: default operator, no path, no values, not negated) are still removed directly.
This commit is contained in:
1 parent
85f8cb74bc
commit
84fc63663e
8 files changed
+104
-12
No files matched your search
@@ -0,0 +1,27 @@
|
||||
import { describe, it, expect } from "bun:test";
|
||||
import { blankNode, isBlankNode } from "../app/composables/useFilterNode";
|
||||
|
||||
describe("isBlankNode", () => {
|
||||
it("treats untouched conditions and groups as blank", () => {
|
||||
expect(isBlankNode(blankNode("leaf"))).toBe(true);
|
||||
expect(isBlankNode(blankNode("all"))).toBe(true);
|
||||
expect(isBlankNode(blankNode("not"))).toBe(true);
|
||||
});
|
||||
|
||||
it("treats any value, path or negation as content", () => {
|
||||
const withValue = blankNode("all");
|
||||
withValue.children[0]!.leaf.values = ["push"];
|
||||
expect(isBlankNode(withValue)).toBe(false);
|
||||
const negated = blankNode("leaf");
|
||||
negated.leaf.exclude = true;
|
||||
expect(isBlankNode(negated)).toBe(false);
|
||||
const withPath = blankNode("leaf");
|
||||
withPath.leaf.path = "sender.login";
|
||||
expect(isBlankNode(withPath)).toBe(false);
|
||||
// `exists` is a complete condition without any value.
|
||||
const exists = blankNode("all");
|
||||
exists.children[0]!.leaf.type = "branch";
|
||||
exists.children[0]!.leaf.op = "exists";
|
||||
expect(isBlankNode(exists)).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user