@@ -29,7 +29,6 @@ import { runAxeCheck } from '@instructure/ui-axe-check'
2929import '@testing-library/jest-dom'
3030
3131import { FormFieldGroup } from '../index'
32- import { FormMessage } from '../../FormPropTypes'
3332
3433describe ( '<FormFieldGroup />' , ( ) => {
3534 let consoleWarningMock : ReturnType < typeof vi . spyOn >
@@ -66,7 +65,7 @@ describe('<FormFieldGroup />', () => {
6665 )
6766
6867 const formFieldGroup = container . querySelector (
69- "span[class$='-formFieldLabel ']"
68+ "span[class$='-formFieldLayout__label ']"
7069 )
7170 const firstNameInput = screen . getByLabelText ( 'First:' )
7271 const middleNameInput = screen . getByLabelText ( 'Middle:' )
@@ -99,40 +98,6 @@ describe('<FormFieldGroup />', () => {
9998 expect ( formFieldGroup ) . toBeInTheDocument ( )
10099 } )
101100
102- it ( 'links the messages to the group via aria-describedby' , ( ) => {
103- const messages : FormMessage [ ] = [ { text : 'Invalid name' , type : 'error' } ]
104-
105- const { container } = render (
106- < FormFieldGroup
107- description = "Please enter your full name"
108- messages = { messages }
109- >
110- < label >
111- First: < input />
112- </ label >
113- < label >
114- Middle: < input />
115- </ label >
116- < label >
117- Last: < input />
118- </ label >
119- </ FormFieldGroup >
120- )
121-
122- const formFieldGroup = container . querySelector (
123- "span[class$='-formFieldLayout']"
124- )
125- const message = container . querySelector ( "span[class$='-formFieldMessages']" )
126- expect ( message ) . toBeInTheDocument ( )
127- expect ( formFieldGroup ) . toBeInTheDocument ( )
128- expect ( formFieldGroup ) . toHaveAttribute ( 'aria-describedby' )
129-
130- const messagesId = formFieldGroup ! . getAttribute ( 'aria-describedby' )
131-
132- expect ( message ) . toHaveTextContent ( 'Invalid name' )
133- expect ( message ) . toHaveAttribute ( 'id' , messagesId )
134- } )
135-
136101 it ( 'displays description message inside the label' , ( ) => {
137102 const description = 'Please enter your full name'
138103
@@ -150,7 +115,9 @@ describe('<FormFieldGroup />', () => {
150115 </ FormFieldGroup >
151116 )
152117
153- const legend = container . querySelector ( "span[class$='-formFieldLabel']" )
118+ const legend = container . querySelector (
119+ "span[class$='-formFieldLayout__label']"
120+ )
154121
155122 expect ( legend ) . toBeInTheDocument ( )
156123 expect ( legend ) . toHaveTextContent ( description )
0 commit comments