Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 120 additions & 3 deletions client-admin/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions client-admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"html-webpack-tags-plugin": "~3.0.2",
"identity-obj-proxy": "^3.0.0",
"jest": "^30.2.0",
"jest-axe": "^11.0.0",
"jest-environment-jsdom": "^30.2.0",
"jest-transform-stub": "^2.0.0",
"prettier": "^3.7.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ const ModerateCommentsSeed = ({ params }) => {
border: '1px solid',
borderColor: 'mediumGray'
}}
aria-label="Seed comment text"
onChange={handleTextareaChange}
maxLength="400"
data-testid="seed_form"
Expand Down Expand Up @@ -150,7 +151,12 @@ const ModerateCommentsSeed = ({ params }) => {
</>
)}
<Box sx={{ mt: 2, display: 'block' }}>
<input onChange={handleFileChange} type="file" id="csvFile" accept=".csv"></input>
<input
onChange={handleFileChange}
type="file"
id="csvFile"
accept=".csv"
aria-label="Upload seed comments from a CSV file"></input>
<Button
disabled={loading || !csvText}
onClick={handleSubmitSeedBulk}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@ import { configureStore } from '@reduxjs/toolkit'
import { Provider } from 'react-redux'
import { render, screen, fireEvent, waitFor } from '@testing-library/react'
import { ThemeUIProvider } from 'theme-ui'
import { axe, toHaveNoViolations } from 'jest-axe'

import ModerateCommentsSeed from './ModerateCommentSeed'
import * as actions from '../../actions'
import theme from '../../theme'

expect.extend(toHaveNoViolations)

// Mock actions
jest.mock('../../actions', () => ({
handleSeedCommentSubmit: jest.fn(),
Expand Down Expand Up @@ -388,4 +391,21 @@ describe('ModerateCommentsSeed', () => {
expect(screen.getAllByText('Success!').length).toBeGreaterThan(0)
})
})

describe('Accessibility', () => {
it('has no axe violations', async () => {
const { container } = renderWithProviders(<ModerateCommentsSeed {...defaultProps} />)
expect(await axe(container)).toHaveNoViolations()
})

it('labels the seed comment textarea', () => {
renderWithProviders(<ModerateCommentsSeed {...defaultProps} />)
expect(screen.getByRole('textbox')).toHaveAccessibleName('Seed comment text')
})

it('labels the CSV upload input', () => {
renderWithProviders(<ModerateCommentsSeed {...defaultProps} />)
expect(screen.getByLabelText('Upload seed comments from a CSV file')).toBeInTheDocument()
})
})
})