Skip to content

Commit

Permalink
test: add test using selector for readOnly
Browse files Browse the repository at this point in the history
  • Loading branch information
AnirudhMani-okta committed Aug 22, 2024
1 parent 975cf0e commit 58ff20c
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
import { Meta, StoryObj } from "@storybook/react";
import { userEvent, within } from "@storybook/testing-library";
import { expect } from "@storybook/jest";
// import { queryOdysseySelector } from "@okta/odyssey-react-mui/test-selectors";
import { queryOdysseySelector } from "@okta/odyssey-react-mui/test-selectors";

import { fieldComponentPropsMetaData } from "../../../fieldComponentPropsMetaData";
import { MuiThemeDecorator } from "../../../../.storybook/components";
Expand Down Expand Up @@ -268,6 +268,17 @@ export const ReadOnly: StoryObj<typeof Checkbox> = {
},
play: async ({ canvasElement, step }) => {
await checkTheBox({ canvasElement, step })("ReadOnly Checkbox");
await step("has aria read only set", async () => {
const element = queryOdysseySelector({
canvas: within(canvasElement),
componentName: "Checkbox",
templateArgs: {
label: "Automatically assign Okta Admin Console",
},
}).element;

expect(element?.ariaReadOnly).toBeTruthy();
});
},
};

Expand Down

0 comments on commit 58ff20c

Please sign in to comment.