File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
packages/smart-forms-renderer/src/stories/sdc Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 1616 */
1717
1818import type { Meta , StoryObj } from '@storybook/react-vite' ;
19+ import { expect , within } from 'storybook/test' ;
1920import BuildFormWrapperForStorybook from '../storybookWrappers/BuildFormWrapperForStorybook' ;
2021import {
2122 qDisplayCategoryInstructions ,
@@ -103,6 +104,19 @@ export const RenderingAnswerOptionValueString: Story = createStory({
103104export const DisplayCategoryInstructions : Story = createStory ( {
104105 args : {
105106 questionnaire : qDisplayCategoryInstructions
107+ } ,
108+ play : async ( { canvasElement } ) => {
109+ const expectedText = 'Have not claimed a health check in the past nine months' ;
110+ const canvas = within ( canvasElement ) ;
111+
112+ const instructionsTextElement = await canvas . findByText ( expectedText , { exact : true } ) ;
113+ expect ( instructionsTextElement . textContent ) . toBe ( expectedText ) ;
114+
115+ const computedStyle = window . getComputedStyle ( instructionsTextElement ) ;
116+ expect ( computedStyle . fontSize ) . toBe ( '12px' ) ;
117+ expect ( computedStyle . fontWeight ) . toBe ( '500' ) ;
118+ expect ( computedStyle . lineHeight ) . toBe ( '18px' ) ;
119+ expect ( computedStyle . color ) . toBe ( 'rgb(66, 66, 66)' ) ;
106120 }
107121} ) as Story ;
108122
You can’t perform that action at this time.
0 commit comments