Skip to content

armgit / peach

Public Imported from GitHub
0

Peach: Local-first video metadata scraper and media manager.

test(wants): 添加键是蓝色主按钮,空着时是主按钮的禁用形态

longmeidao291861e5d973
diff --git a/frontend/test/react/want-list.test.tsx b/frontend/test/react/want-list.test.tsx
index 397fbd796..cb849a4ce 100644
--- a/frontend/test/react/want-list.test.tsx
+++ b/frontend/test/react/want-list.test.tsx
@@ -77,6 +77,16 @@ it('一条都没有就是空态,不画空的分段', async () => {
expect(host.querySelector('section[data-want-phase]')).toBeNull();
});
+it('添加键是蓝色主按钮:输入框空着时是主按钮的禁用形态,填了番号就能点', async () => {
+ serve(listed([]));
+ const { host } = await open();
+ const addKey = () => buttonNamed('添加', host)!;
+ expect([addKey().classList.contains('bg-button-primary'), addKey().disabled]).toEqual([true, true]);
+ await type(host.querySelector<HTMLInputElement>('input[aria-label="番号"]'), 'SSIS-950');
+ await settle();
+ expect([addKey().classList.contains('bg-button-primary'), addKey().disabled]).toEqual([true, false]);
+});
+
it('按番号添加:回车就发,回执报番号,输入框清空、清单重取', async () => {
const fetcher = serve(listed([]), listed([want(99, { code: 'SSIS-950' })]));
const { host, toast } = await open();