Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make playbook generation work even with an empty outline #1518

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/webview/apps/common/editableList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class EditableList {
values.push(node.textContent.trim());
}
});
return values;
return values.length === 0 ? [""] : values;
}

setToUI(values: string[]) {
Expand Down Expand Up @@ -71,9 +71,6 @@ export class EditableList {
}

isChanged() {
if (!this.savedValues) {
return true;
}
const values = this.getFromUI();
if (this.savedValues.length !== values.length) {
return true;
Expand Down
2 changes: 1 addition & 1 deletion src/webview/apps/lightspeed/playbookGeneration/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ window.addEventListener("load", () => {
outline = new EditableList("outline-list");
outline.element.addEventListener("input", () => {
setButtonEnabled("reset-button", outline.isChanged());
setButtonEnabled("generate-button", !outline.isEmpty());
// setButtonEnabled("generate-button", !outline.isEmpty());
});

// Detect whether a dark or a light color theme is used.
Expand Down
2 changes: 2 additions & 0 deletions test/units/lightspeed/editableList.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ describe("Test EditableList", () => {
domWithEmptyList.window,
);
assert.equal(emptyEditableList.isEmpty(), true);
assert.equal(emptyEditableList.getFromUI().length, 1);
assert.equal(emptyEditableList.getFromUI()[0], "");
});

it("Test constructor", async () => {
Expand Down