From f415144a3063a46d74ec2180f8ec830fc1641201 Mon Sep 17 00:00:00 2001 From: Tamara Date: Wed, 7 Aug 2024 16:11:05 -0500 Subject: [PATCH] Add a test confirming readOnly stops interaction --- .../__tests__/interactive-graph.test.tsx | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/packages/perseus/src/widgets/__tests__/interactive-graph.test.tsx b/packages/perseus/src/widgets/__tests__/interactive-graph.test.tsx index 1194c92e16..d1e9468a67 100644 --- a/packages/perseus/src/widgets/__tests__/interactive-graph.test.tsx +++ b/packages/perseus/src/widgets/__tests__/interactive-graph.test.tsx @@ -266,6 +266,26 @@ describe("a mafs graph", () => { {timeout: 5000}, ); }); + + it("is marked invalid when readOnly set to true", async () => { + const {renderer} = renderQuestion(question, { + ...apiOptions, + readOnly: true, + }); + + await userEvent.tab(); + + // Act + await userEvent.keyboard("{arrowup}{arrowdown}"); + + // Assert + await waitFor( + () => { + expect(renderer).toHaveInvalidInput(); + }, + {timeout: 5000}, + ); + }); }, );