diff --git a/components/button/src/button/__tests__/Button.test.js b/components/button/src/button/__tests__/Button.test.js index 9126fb798f..b36146c492 100644 --- a/components/button/src/button/__tests__/Button.test.js +++ b/components/button/src/button/__tests__/Button.test.js @@ -4,6 +4,52 @@ import React from 'react' import { Button } from '../button.js' describe(') + + expect(consoleSpy).not.toHaveBeenCalled() + }) + + it('does not warn if aria-label and title is present', () => { + render( + + ) + + expect(consoleSpy).not.toHaveBeenCalled() + }) + + it('warns if no children are present with no arial-label and title', () => { + render() + + expect(consoleSpy).toHaveBeenCalledWith( + 'Button component has no children but is missing title and ariaLabel attribute.' + ) + }) + + it('No warning if there are no children but arial label and title', () => { + render( + + ) + + expect(consoleSpy).not.toHaveBeenCalled() + }) + }) + it('renders a default data-test attribute', () => { const dataTest = 'dhis2-uicore-button' const wrapper = mount(