import { expect } from "chai" ; import { stubClassNames , stubStyles } from "../fakes.test" ; import { AbsoluteSizeSchema } from "../Sizing" ; import { stubAreasFaker , stubContainerSize } from "./fakes.test" ; describe ( "AreasFaker" , ( ) => { describe ( "createAndAppendMenuArea" , ( ) => { it ( "creates an outer area with the outer area class name" , async ( ) => { const areasFaker = stubAreasFaker ( ) ; const { menuArea } = await areasFaker . createAndAppendMenuArea ( stubContainerSize ) ; expect ( menuArea . className ) . to . be . equal ( stubClassNames . menusOuterArea ) ; } ) ; it ( "creates an inner area with the inner area fake class name and styles" , async ( ) => { const areasFaker = stubAreasFaker ( ) ; const { menuArea } = await areasFaker . createAndAppendMenuArea ( stubContainerSize ) ; const innerArea = menuArea . children [ 0 ] as HTMLElement ; expect ( innerArea . className ) . to . be . equal ( [ stubClassNames . menusInnerArea , stubClassNames . menusInnerAreaFake ] . join ( " " ) ) ; expect ( innerArea . style ) . to . contain ( { ... stubStyles . menusInnerArea , ... stubStyles . menusInnerAreaFake , } ) ; } ) ; it ( "creates stub menu titles when provided menu schemas" , async ( ) => { const areasFaker = stubAreasFaker ( { menus : [ { options : [ ] , title : "abc" , } , { options : [ ] , title : "def" , } , ] , } ) ; const { menuArea } = await areasFaker . createAndAppendMenuArea ( stubContainerSize ) ; expect ( menuArea . textContent ) . to . be . equal ( "abcdef" ) ; } ) ; } ) ; describe ( "createContentArea" , ( ) => { it ( "vertically fills the content size to the container excluding the menu area" , ( ) => { const areasFaker = stubAreasFaker ( ) ; const containerSize = { height : 350 , width : 490 , } ; const menuAreaSize = { height : 140 , width : 210 , } ; const { contentSize } = areasFaker . createContentArea ( containerSize , menuAreaSize ) ; expect ( contentSize ) . to . be . deep . equal ( { height : 210 , width : 490 , } ) ; } ) ; it ( "matches its content area size style to the returned content size" , ( ) => { const areasFaker = stubAreasFaker ( ) ; const containerSize = { height : 350 , width : 490 , } ; const menuAreaSize = { height : 140 , width : 210 , } ; const { contentArea , contentSize } = areasFaker . createContentArea ( containerSize , menuAreaSize ) ; expect ( contentArea . style ) . to . contain ( { height : `${ contentSize . height }px` , width : `${ contentSize . width }px` , } ) ; } ) ; } ) ; } ) ;