loop/webui: add prettier
diff --git a/loop/webui/src/web-components/sketch-chat-input.test.ts b/loop/webui/src/web-components/sketch-chat-input.test.ts
index 7d93c17..2c5dde3 100644
--- a/loop/webui/src/web-components/sketch-chat-input.test.ts
+++ b/loop/webui/src/web-components/sketch-chat-input.test.ts
@@ -1,4 +1,11 @@
-import { html, fixture, expect, oneEvent, elementUpdated, fixtureCleanup } from "@open-wc/testing";
+import {
+ html,
+ fixture,
+ expect,
+ oneEvent,
+ elementUpdated,
+ fixtureCleanup,
+} from "@open-wc/testing";
import "./sketch-chat-input";
import { SketchChatInput } from "./sketch-chat-input";
@@ -13,7 +20,9 @@
`);
expect(el.content).to.equal("");
- const textarea = el.shadowRoot!.querySelector("#chatInput") as HTMLTextAreaElement;
+ const textarea = el.shadowRoot!.querySelector(
+ "#chatInput",
+ ) as HTMLTextAreaElement;
expect(textarea.value).to.equal("");
});
@@ -24,7 +33,9 @@
`);
expect(el.content).to.equal(testContent);
- const textarea = el.shadowRoot!.querySelector("#chatInput") as HTMLTextAreaElement;
+ const textarea = el.shadowRoot!.querySelector(
+ "#chatInput",
+ ) as HTMLTextAreaElement;
expect(textarea.value).to.equal(testContent);
});
@@ -33,12 +44,14 @@
<sketch-chat-input></sketch-chat-input>
`);
- const textarea = el.shadowRoot!.querySelector("#chatInput") as HTMLTextAreaElement;
+ const textarea = el.shadowRoot!.querySelector(
+ "#chatInput",
+ ) as HTMLTextAreaElement;
const newValue = "New message";
-
+
textarea.value = newValue;
textarea.dispatchEvent(new Event("input"));
-
+
expect(el.content).to.equal(newValue);
});
@@ -48,12 +61,14 @@
<sketch-chat-input .content=${testContent}></sketch-chat-input>
`);
- const button = el.shadowRoot!.querySelector("#sendChatButton") as HTMLButtonElement;
-
+ const button = el.shadowRoot!.querySelector(
+ "#sendChatButton",
+ ) as HTMLButtonElement;
+
// Setup listener for the send-chat event
setTimeout(() => button.click());
const { detail } = await oneEvent(el, "send-chat");
-
+
expect(detail.message).to.equal(testContent);
expect(el.content).to.equal("");
});
@@ -64,21 +79,23 @@
<sketch-chat-input .content=${testContent}></sketch-chat-input>
`);
- const textarea = el.shadowRoot!.querySelector("#chatInput") as HTMLTextAreaElement;
-
+ const textarea = el.shadowRoot!.querySelector(
+ "#chatInput",
+ ) as HTMLTextAreaElement;
+
// Setup listener for the send-chat event
setTimeout(() => {
const enterEvent = new KeyboardEvent("keydown", {
key: "Enter",
bubbles: true,
cancelable: true,
- shiftKey: false
+ shiftKey: false,
});
textarea.dispatchEvent(enterEvent);
});
-
+
const { detail } = await oneEvent(el, "send-chat");
-
+
expect(detail.message).to.equal(testContent);
expect(el.content).to.equal("");
});
@@ -89,26 +106,28 @@
<sketch-chat-input .content=${testContent}></sketch-chat-input>
`);
- const textarea = el.shadowRoot!.querySelector("#chatInput") as HTMLTextAreaElement;
-
+ const textarea = el.shadowRoot!.querySelector(
+ "#chatInput",
+ ) as HTMLTextAreaElement;
+
// Create a flag to track if the event was fired
let eventFired = false;
el.addEventListener("send-chat", () => {
eventFired = true;
});
-
+
// Dispatch the shift+enter keydown event
const shiftEnterEvent = new KeyboardEvent("keydown", {
key: "Enter",
bubbles: true,
cancelable: true,
- shiftKey: true
+ shiftKey: true,
});
textarea.dispatchEvent(shiftEnterEvent);
-
+
// Wait a short time to verify no event was fired
- await new Promise(resolve => setTimeout(resolve, 10));
-
+ await new Promise((resolve) => setTimeout(resolve, 10));
+
expect(eventFired).to.be.false;
expect(el.content).to.equal(testContent);
});
@@ -119,19 +138,21 @@
`);
const newContent = "Updated content";
-
+
// Dispatch the update-content event
const updateEvent = new CustomEvent("update-content", {
detail: { content: newContent },
- bubbles: true
+ bubbles: true,
});
el.dispatchEvent(updateEvent);
-
+
// Wait for the component to update
await elementUpdated(el);
-
+
expect(el.content).to.equal(newContent);
- const textarea = el.shadowRoot!.querySelector("#chatInput") as HTMLTextAreaElement;
+ const textarea = el.shadowRoot!.querySelector(
+ "#chatInput",
+ ) as HTMLTextAreaElement;
expect(textarea.value).to.equal(newContent);
});
});