-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Test Selector for Checkbox #2302
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +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 { fieldComponentPropsMetaData } from "../../../fieldComponentPropsMetaData"; | ||
import { MuiThemeDecorator } from "../../../../.storybook/components"; | ||
|
@@ -267,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(); | ||
}); | ||
}, | ||
}; | ||
|
||
|
@@ -284,6 +296,18 @@ export const Hint: StoryObj<typeof Checkbox> = { | |
}, | ||
play: async ({ canvasElement, step }) => { | ||
await checkTheBox({ canvasElement, step })("Checkbox Hint"); | ||
// This is commented because there's a separate ticket to cover this work: OKTA-793465 | ||
// await step("has visible hint", async () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bryancunningham-okta We'll want this noted in a ticket. For some reason, the hint is setup as part of the label and not the description in Checkbox. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @AnirudhMani-okta Can you put a comment above it saying "This is commented because there's a separate ticket to cover this work: OKTA-XXXXXX". There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressed, added ticket: https://oktainc.atlassian.net/browse/OKTA-793465 |
||
// const element = queryOdysseySelector({ | ||
// canvas: within(canvasElement), | ||
// componentName: "Checkbox", | ||
// templateArgs: { | ||
// label:"I agree to the terms and conditions", | ||
// } | ||
// }).element; | ||
|
||
// expect(element).toHaveAccessibleDescription(/Really helpful hint/); | ||
// }); | ||
}, | ||
}; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
leaving as comment because we will eventually convert this as either a label or a different selector as discussed with @KevinGhadyani-Okta
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we commented this as:
That'll make it easier in the future because the API won't match the feature API.