@instructure/quiz-interactions
Version:
A React UI component Library for quiz interaction types.
45 lines (39 loc) • 1.21 kB
JavaScript
import React from 'react'
import runAxeCheck from '@instructure/ui-axe-check'
import {screen} from '@testing-library/react'
import {renderWithDnd} from '../../../../../tests/util/dndTestUtils'
import Wordbank from '../Wordbank'
describe('Wordbank', () => {
const blankId = '72'
const props = {
blanks: [
{
id: blankId,
answerType: 'wordbank',
choices: [{id: '22'}],
},
],
returnChoiceToWordbank: () => {},
wordBankChoices: [
{id: '1', itemBody: 'foo'},
{id: '2', itemBody: 'bar'},
],
}
it('should render', () => {
const {container} = renderWithDnd(<Wordbank {...props} />)
expect(container.firstChild).toBeDefined()
})
describe('blank choices', () => {
it('renders a DraggableBlankChoice for each item in wordBankChoices', () => {
renderWithDnd(<Wordbank {...props} />)
expect(screen.getByText('foo')).toBeDefined()
expect(screen.getByText('bar')).toBeDefined()
})
})
describe('a11y tests', () => {
it('should meet a11y standards', async () => {
const {container} = renderWithDnd(<Wordbank {...props} />)
expect(await runAxeCheck(container)).toBe(true)
})
})
})