fix: don't allow whitespaces for bound text (#5939)

* fix: don't allow whitespaces for bound text

* fix

* remove

* remove empty else

* fix

* fix

* fix
This commit is contained in:
Aakansha Doshi 2022-12-02 16:47:50 +05:30 committed by GitHub
parent 8b33ca3a1a
commit 1933116261
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 2 deletions

View file

@ -1196,5 +1196,18 @@ describe("textWysiwyg", () => {
]);
expect(text.containerId).toBe(rectangle.id);
});
it("should not allow bound text with only whitespaces", async () => {
Keyboard.keyPress(KEYS.ENTER);
const editor = document.querySelector(
".excalidraw-textEditorContainer > textarea",
) as HTMLTextAreaElement;
await new Promise((r) => setTimeout(r, 0));
fireEvent.change(editor, { target: { value: " " } });
editor.blur();
expect(rectangle.boundElements).toBeNull();
expect(h.elements[1].isDeleted).toBe(true);
});
});
});