diff --git a/components/loader/src/circular-loader/__tests__/circular-loader.test.js b/components/loader/src/circular-loader/__tests__/circular-loader.test.js new file mode 100644 index 0000000000..bc34f5f735 --- /dev/null +++ b/components/loader/src/circular-loader/__tests__/circular-loader.test.js @@ -0,0 +1,26 @@ +import { mount } from 'enzyme' +import React from 'react' +import { CircularLoader } from '../circular-loader.js' + +describe('Circular Loader', () => { + it('renders the circular loader with aria label', () => { + const wrapper = mount( + + ) + const actual = wrapper.find({ 'data-test': 'circular-loader-test' }) + expect(actual.prop('role')).toBe('progressbar') + expect(actual.prop('aria-label')).toBe('Circular Loader') + }) + + it('renders the circular loader without aria label', () => { + const wrapper = mount( + + ) + const actual = wrapper.find({ 'data-test': 'circular-loader-test' }) + expect(actual.prop('aria-label')).toBe(undefined) + expect(actual.prop('role')).toBe('progressbar') + }) +}) diff --git a/components/loader/src/circular-loader/circular-loader.js b/components/loader/src/circular-loader/circular-loader.js index 2ede281513..a512c321ff 100644 --- a/components/loader/src/circular-loader/circular-loader.js +++ b/components/loader/src/circular-loader/circular-loader.js @@ -10,6 +10,7 @@ const CircularLoader = ({ invert, className, dataTest, + 'aria-label': ariaLabel, }) => (