From b713524989276b134cd030d66454a840db0b5726 Mon Sep 17 00:00:00 2001 From: wrenny-ko Date: Tue, 27 Aug 2024 19:29:41 -0400 Subject: [PATCH] setting up test --- assets/js/__tests__/upload.spec.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/assets/js/__tests__/upload.spec.ts b/assets/js/__tests__/upload.spec.ts index 233bcd83..f58132f1 100644 --- a/assets/js/__tests__/upload.spec.ts +++ b/assets/js/__tests__/upload.spec.ts @@ -25,6 +25,8 @@ const errorResponse = { }; /* eslint-enable camelcase */ +const tagSets = ['safe', 'one, two, three', 'safe, expicit', 'safe, two, three']; + describe('Image upload form', () => { let mockPng: File; let mockWebm: File; @@ -87,7 +89,7 @@ describe('Image upload form', () => { -
+
@@ -212,6 +214,14 @@ describe('Image upload form', () => { }); it('should prevent form submission if tag checks fail', async () => { + tagSets.forEach(tags => { + taginputEl.value = tags; + //TODO fire submit event + // check whether the form fully submitted or was prevented by tag checks + // verify the number of error help blocks added + // check if the submit button is enabled/disabled + }); + await new Promise(resolve => { form.addEventListener('submit', event => { event.preventDefault();