Preserve drafts on empty clear directives
This commit is contained in:
parent
23eaf32eae
commit
af05248af5
3 changed files with 16 additions and 2 deletions
2
packages/eve-browser-lowering/dist/index.js
vendored
2
packages/eve-browser-lowering/dist/index.js
vendored
|
|
@ -16,7 +16,7 @@ export class EveBrowserDraftStore {
|
|||
this.values.set(this.key(providerId, surfaceId, bindingName), value);
|
||||
}
|
||||
clear(providerId, surfaceId, bindingNames) {
|
||||
if (bindingNames?.length) {
|
||||
if (bindingNames !== undefined) {
|
||||
for (const name of bindingNames)
|
||||
this.values.delete(this.key(providerId, surfaceId, name));
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ export class EveBrowserDraftStore {
|
|||
}
|
||||
|
||||
clear(providerId: string, surfaceId: string, bindingNames?: readonly string[]): void {
|
||||
if (bindingNames?.length) {
|
||||
if (bindingNames !== undefined) {
|
||||
for (const name of bindingNames) this.values.delete(this.key(providerId, surfaceId, name));
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -265,6 +265,20 @@ test("editable bindings preserve local drafts across authoritative refresh and o
|
|||
}
|
||||
});
|
||||
|
||||
test("an explicit empty draft directive clears no unrelated bindings", () => {
|
||||
const drafts = new EveBrowserDraftStore();
|
||||
drafts.set("ghostlight", "ghostlight.play", "channel_id", "private:host");
|
||||
drafts.set("ghostlight", "ghostlight.play", "message", "still drafting");
|
||||
|
||||
drafts.clear("ghostlight", "ghostlight.play", []);
|
||||
assert.equal(drafts.get("ghostlight", "ghostlight.play", "channel_id"), "private:host");
|
||||
assert.equal(drafts.get("ghostlight", "ghostlight.play", "message"), "still drafting");
|
||||
|
||||
drafts.clear("ghostlight", "ghostlight.play");
|
||||
assert.equal(drafts.has("ghostlight", "ghostlight.play", "channel_id"), false);
|
||||
assert.equal(drafts.has("ghostlight", "ghostlight.play", "message"), false);
|
||||
});
|
||||
|
||||
test("operations capture untouched authored choice defaults", () => {
|
||||
const restoreDom = installDom();
|
||||
try {
|
||||
|
|
|
|||
Loading…
Reference in a new issue