Skip to content

Commit

Permalink
Merge pull request #112
Browse files Browse the repository at this point in the history
Fix(111): Fix color contrast for fields error message

* fix(111): change the color of the fields' error message to address co…

* test(111): fix mocks

* test(111): fix accessibility tests

* chore(111): add retries to Cypress (flake detection)
  • Loading branch information
vanch3d authored Sep 18, 2023
1 parent 4ba6f84 commit d7decc1
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 17 deletions.
1 change: 1 addition & 0 deletions hivemq-edge/src/frontend/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { defineConfig } from 'cypress'
import installLogsPrinter from 'cypress-terminal-report/src/installLogsPrinter'

export default defineConfig({
retries: { runMode: 2, openMode: 0 },
e2e: {
baseUrl: 'http://localhost:3000',
setupNodeEvents(on) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe('SubscriptionsPanel', () => {

cy.checkAccessibility(undefined, {
rules: {
// TODO[NVL] Font too small.
// TODO[#111] Color-contrast fixed but still not passing. Flaky with expandable panel
'color-contrast': { enabled: false },
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,7 @@ describe('NodeAdapter', () => {
cy.injectAxe()
cy.mountWithProviders(mockReactFlow(<NodeAdapter {...MOCK_NODE_ADAPTER} />))

cy.checkAccessibility(undefined, {
rules: {
// TODO[16486] Font too small. See https://hivemq.kanbanize.com/ctrl_board/57/cards/16486/details/
'color-contrast': { enabled: false },
},
})
cy.checkAccessibility()
cy.percySnapshot('Component: NodeAdapter')
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { FieldTemplateProps } from '@rjsf/utils'
import { RenderFieldTemplate } from './RenderFieldTemplate.tsx'
import { FormLabel, Input, Text } from '@chakra-ui/react'
import { FormErrorMessage, FormLabel, Input } from '@chakra-ui/react'

const MOCK_TEXT = 'You will have to type something'
const MOCK_ERROR = 'This is an error message'
Expand All @@ -15,7 +15,7 @@ const makeMockProps = (props: Partial<FieldTemplateProps>): Partial<FieldTemplat
<Input value={'a dumb value'} />
</>
),
errors: <Text>{props.rawErrors?.join(', ')}</Text>,
errors: <FormErrorMessage>{props.rawErrors?.join(', ')}</FormErrorMessage>,
description: <div>{props.rawDescription}</div>,
}
}
Expand All @@ -42,12 +42,7 @@ describe('CustomFieldTemplate', () => {
cy.mountWithProviders(<RenderFieldTemplate {...rest} children={children} />)
cy.get('[role="group"]').should('not.contain.text', MOCK_TEXT)
cy.get('[role="group"]').should('contain.text', MOCK_ERROR)
cy.checkAccessibility(undefined, {
rules: {
// TODO[93] Need to change the default colour of the error message. See https://discord.com/channels/660863154703695893/1150880181356089374
'color-contrast': { enabled: false },
},
})
cy.checkAccessibility()
})

it('should render the helper text', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ const { defineMultiStyleConfig, definePartsStyle } = createMultiStyleConfigHelpe

const hivemq = definePartsStyle({
text: {
color: 'red.700',
// Fix "color-contrast" (WCAG)
color: 'red.600',
},
})

Expand Down
2 changes: 1 addition & 1 deletion hivemq-edge/src/frontend/src/modules/Theme/themeHiveMQ.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,6 @@ export const themeHiveMQ = extendTheme({
Stat: statTheme,
Drawer: drawerTheme,
Form: formControlTheme,
FormErrorMessage: formErrorMessageTheme,
FormError: formErrorMessageTheme,
},
})

0 comments on commit d7decc1

Please sign in to comment.