Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
Fix content report form unit test (#2228)
Olga Bulate56dcd2c95f2
diff --git a/frontend/test/unit/specs/components/v-content-report-form.spec.js b/frontend/test/unit/specs/components/v-content-report-form.spec.jsindex 269350abd..2731b33f6 100644--- a/frontend/test/unit/specs/components/v-content-report-form.spec.js+++ b/frontend/test/unit/specs/components/v-content-report-form.spec.js@@ -156,15 +156,21 @@ describe("VContentReportForm", () => {})})- // https://github.com/WordPress/openverse/issues/2221- // eslint-disable-next-line jest/no-disabled-tests- it.skip("should not send other report if description is short", async () => {+ it("submit button on other form should only be enabled if input is longer than 20 characters", async () => {ReportService.sendReport = jest.fn()render(VContentReportForm, options)await fireEvent.click(getOtherInput())- const description = "less than 20 chars"+ // The minimum length for report description is 20 characters. This is invalid+ const description = "1234567890123456789"await fireEvent.update(getDescriptionTextarea(), description)++ // The button is not fully disabled, it uses `aria-disabled` attribute so that+ // it remains focusable for screen readers to access the context.+ expect(await getReportButton()).toHaveAttribute("aria-disabled", "true")++ await fireEvent.update(getDescriptionTextarea(), description + "0") // Valid, 20 characters+ expect(getReportButton()).not.toHaveAttribute("aria-disabled")})})