import { expect } from "chai" ; import { createElement } from "./CreateElement" ; describe ( "createElement" , ( ) => { it ( "creates an element when given a tag name" , ( ) => { const tagName = "div" ; const element = createElement ( tagName ) ; expect ( element . tagName ) . to . be . equal ( "DIV" ) ; } ) ; it ( "appends children to the element when given children" , ( ) => { const children = [ createElement ( "p" ) , createElement ( "span" ) ] ; const element = createElement ( "div" , { children } ) ; expect ( [ ] . slice . call ( element . children ) ) . to . be . deep . equal ( children ) ; } ) ; it ( "sets the className of the element when given a className" , ( ) => { const className = "abc def" ; const element = createElement ( "div" , { className } ) ; expect ( element . className ) . to . be . equal ( className ) ; } ) ; it ( "sets the textContent of the element when given a textContent" , ( ) => { const textContent = "abc def" ; const element = createElement ( "div" , { textContent } ) ; expect ( element . textContent ) . to . be . equal ( textContent ) ; } ) ; it ( "adds style properties to the element when given a style" , ( ) => { const style = { backgroundColor : "blue" , color : "red" , } ; const element = createElement ( "div" , { style } ) ; expect ( element . style ) . to . contain ( style ) ; } ) ; } ) ;