test: require command palette controls · openclaw/openclaw@e101ca9
shakkernerd
·
2026-05-08
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -180,7 +180,8 @@ describe("command palette", () => {
|
180 | 180 | bubbles: true, |
181 | 181 | cancelable: true, |
182 | 182 | }); |
183 | | -input?.dispatchEvent(tab); |
| 183 | +expect(input).toBeInstanceOf(HTMLInputElement); |
| 184 | +input!.dispatchEvent(tab); |
184 | 185 | expect(tab.defaultPrevented).toBe(true); |
185 | 186 | expect(document.activeElement).toBe(input); |
186 | 187 | |
@@ -189,7 +190,7 @@ describe("command palette", () => {
|
189 | 190 | bubbles: true, |
190 | 191 | cancelable: true, |
191 | 192 | }); |
192 | | -input?.dispatchEvent(escape); |
| 193 | +input!.dispatchEvent(escape); |
193 | 194 | expect(escape.defaultPrevented).toBe(true); |
194 | 195 | expect(onToggle).toHaveBeenCalledTimes(1); |
195 | 196 | |
@@ -204,16 +205,17 @@ describe("command palette", () => {
|
204 | 205 | const dialog = container.querySelector<HTMLDialogElement>("dialog.cmd-palette-overlay"); |
205 | 206 | const input = container.querySelector<HTMLInputElement>("#cmd-palette-input"); |
206 | 207 | expect(dialog?.open).toBe(true); |
207 | | -expect(input?.id).toBe("cmd-palette-input"); |
| 208 | +expect(input).toBeInstanceOf(HTMLInputElement); |
208 | 209 | |
209 | | -input?.dispatchEvent( |
| 210 | +input!.dispatchEvent( |
210 | 211 | new KeyboardEvent("keydown", { |
211 | 212 | key: "Escape", |
212 | 213 | bubbles: true, |
213 | 214 | cancelable: true, |
214 | 215 | }), |
215 | 216 | ); |
216 | | -dialog?.dispatchEvent(new Event("cancel", { cancelable: true })); |
| 217 | +expect(dialog).toBeInstanceOf(HTMLDialogElement); |
| 218 | +dialog!.dispatchEvent(new Event("cancel", { cancelable: true })); |
217 | 219 | |
218 | 220 | expect(onToggle).toHaveBeenCalledTimes(1); |
219 | 221 | }); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。