|
| 1 | +import { Separator } from './separator'; |
| 2 | + |
| 3 | +describe('Critical Functionality', () => { |
| 4 | + it('INIT', () => { |
| 5 | + cy.mount(<Separator />); |
| 6 | + |
| 7 | + cy.checkA11yForComponent(); |
| 8 | + }); |
| 9 | + |
| 10 | + it('GIVEN no orientation prop THEN aria-orientation is set unset', () => { |
| 11 | + cy.mount(<Separator />); |
| 12 | + |
| 13 | + cy.findByRole('separator').should('not.have.attr', 'aria-orientation'); |
| 14 | + }); |
| 15 | + |
| 16 | + it("GIVEN orientation prop 'horizontal' THEN aria-orientation is unset", () => { |
| 17 | + cy.mount(<Separator orientation="horizontal" />); |
| 18 | + |
| 19 | + cy.findByRole('separator').should('not.have.attr', 'aria-orientation'); |
| 20 | + }); |
| 21 | + |
| 22 | + it("GIVEN orientation prop 'vertical' THEN aria-orientation is set to 'vertical'", () => { |
| 23 | + cy.mount(<Separator orientation="vertical" />); |
| 24 | + |
| 25 | + cy.findByRole('separator').should('have.attr', 'aria-orientation', 'vertical'); |
| 26 | + }); |
| 27 | + |
| 28 | + it("GIVEN no orientation prop THEN data-orientation is set to 'horizontal'", () => { |
| 29 | + cy.mount(<Separator />); |
| 30 | + |
| 31 | + cy.findByRole('separator').should('not.have.attr', 'aria-orientation'); |
| 32 | + }); |
| 33 | + |
| 34 | + it("GIVEN orientation prop 'horizontal' THEN data-orientation is set to 'horizontal'", () => { |
| 35 | + cy.mount(<Separator orientation="horizontal" />); |
| 36 | + |
| 37 | + cy.findByRole('separator').should('not.have.attr', 'aria-orientation'); |
| 38 | + }); |
| 39 | + |
| 40 | + it("GIVEN orientation prop 'vertical' THEN data-orientation is set to 'vertical'", () => { |
| 41 | + cy.mount(<Separator orientation="vertical" />); |
| 42 | + |
| 43 | + cy.findByRole('separator').should('have.attr', 'aria-orientation', 'vertical'); |
| 44 | + }); |
| 45 | + |
| 46 | + it("GIVEN decorative prop THEN role is set to 'none' AND aria-orientation is unset", () => { |
| 47 | + cy.mount(<Separator decorative />); |
| 48 | + |
| 49 | + cy.findByRole('none').should('not.have.attr', 'aria-orientation'); |
| 50 | + }); |
| 51 | + |
| 52 | + it('GIVEN invalid orientation prop THEN console.warn is called', () => { |
| 53 | + const consoleSpy = cy.spy(console, 'warn'); |
| 54 | + cy.mount(<Separator orientation={'invalid' as any} />); |
| 55 | + |
| 56 | + cy.wrap(consoleSpy).should('have.been.calledWithMatch', /Invalid prop 'orientation'/); |
| 57 | + }); |
| 58 | +}); |
0 commit comments