diff --git a/packages/react/src/PricingOptions/PricingOptions.test.tsx b/packages/react/src/PricingOptions/PricingOptions.test.tsx index f79472746..c6093c475 100644 --- a/packages/react/src/PricingOptions/PricingOptions.test.tsx +++ b/packages/react/src/PricingOptions/PricingOptions.test.tsx @@ -111,4 +111,37 @@ describe('PricingOptions.Item', () => { expect(getByText(mockFeatureListItem)).toBeInTheDocument() expect(getByText(mockFootnote)).toBeInTheDocument() }) + + it('renders markup in the expected order', () => { + const {getByTestId} = render( + + {mockFootnote} + {mockLabel} + {mockDescription} + {mockHeading} + + {mockFeaturedListHeading} + {mockFeatureListItem} + + , + ) + + const PricingOptionsItemEl = getByTestId(testId) + + const expectedOrder = [ + 'PricingOptions__heading', + 'PricingOptions__label', + 'PricingOptions__description', + 'PricingOptions__featureList', + 'PricingOptions__footnote', + ] + + const elementsWithTestId = PricingOptionsItemEl.querySelectorAll('[data-testid]') + + const testIdsInOrder = Array.from(elementsWithTestId) + .map(el => el.getAttribute('data-testid')) + .filter(id => id && expectedOrder.includes(id)) + + expect(testIdsInOrder).toEqual(expectedOrder) + }) })