import { Typography } from '@mui/material'; import { Tabs } from '.'; import { TabPanel } from './TabPanel'; const initialize = (withTabListProps = false): void => { cy.mount({ Component: ( Tab 0 Tab 1 ) }); }; describe('Tabs', () => { it('displays tabs and their content when a tab is selected', () => { initialize(); cy.get('[data-TabPanel="tab 0"]').should('not.have.attr', 'hidden'); cy.get('[data-TabPanel="tab 1"]').should('have.attr', 'hidden'); cy.findByLabelText('Tab 0') .should('have.attr', 'aria-selected') .and('equals', 'true'); cy.findByLabelText('Tab 1') .should('have.attr', 'aria-selected') .and('equals', 'false'); cy.contains('Tab 1').click(); cy.get('[data-TabPanel="tab 0"]').should('have.attr', 'hidden'); cy.get('[data-TabPanel="tab 1"]').should('not.have.attr', 'hidden'); cy.findByLabelText('Tab 0') .should('have.attr', 'aria-selected') .and('equals', 'false'); cy.findByLabelText('Tab 1') .should('have.attr', 'aria-selected') .and('equals', 'true'); cy.makeSnapshot(); }); it('displays tabs when tabList props are set', () => { initialize(true); cy.get('[data-TabPanel="tab 0"]').should('not.have.attr', 'hidden'); cy.get('[data-TabPanel="tab 1"]').should('have.attr', 'hidden'); cy.makeSnapshot(); }); });