import * as React from 'react'
import { Section } from '../src'
import { LayoutWrapper } from './setup'
/**
* @component
* Section
*
* @tests
* - Render with defaults
* - Option: `content.maxWidthSection`
* - Prop: `className`, `maxWidth`, `background`, `color`
* - Prop: `css`, `_css`
* - Behavior: applies `css` to root when container = false
*/
describe('Section', () => {
/* Render with defaults */
it('renders a Section with default props', () => {
cy.mount()
cy.get('.section .container').should('exist')
cy.get('.section .container').should(
'have.css',
'max-width',
format(defaults.content.maxWidthSection)
)
})
/* Option: `content.maxWidthSection` */
it('renders with user-generated options', () => {
cy.mount(
)
cy.get('.section .container').should('have.css', 'max-width', '300px')
})
/* Prop: `className`, `maxWidth`, `background`, `color` */
it('renders with prop values', () => {
cy.mount(
)
cy.get('.section').should('have.backgroundColor', '#000')
cy.get('.section').should('have.color', '#333')
cy.get('.section .container').should('have.css', 'max-width', '700px')
})
/* Prop: `css`, `_css` */
it('applies _css to root and css to the container', () => {
cy.mount(
)
cy.get('.section').should('have.css', 'margin', '20px')
cy.get('.section .container').should('have.css', 'padding', '10px')
})
/* Behavior: applies `css` to root when container = false */
it('applies css to root when container is false', () => {
cy.mount(
)
cy.get('.section .container').should('not.exist')
cy.get('.section').should('have.css', 'margin', '20px')
cy.get('.section').should('have.css', 'padding', '10px')
})
})