@@ -230,46 +230,62 @@ describe('Backdrop', () => {
230230 } )
231231 } )
232232 } )
233-
234- describe ( 'rootElement initialization' , ( ) => {
235- it ( 'Should be appended on "document.body" by default' , done => {
236- const instance = new Backdrop ( {
237- isVisible : true
238- } )
239- const getElement = ( ) => document . querySelector ( CLASS_BACKDROP )
240- instance . show ( ( ) => {
241- expect ( getElement ( ) . parentElement ) . toEqual ( document . body )
242- done ( )
233+ describe ( 'Config' , ( ) => {
234+ describe ( 'rootElement initialization' , ( ) => {
235+ it ( 'Should be appended on "document.body" by default' , done => {
236+ const instance = new Backdrop ( {
237+ isVisible : true
238+ } )
239+ const getElement = ( ) => document . querySelector ( CLASS_BACKDROP )
240+ instance . show ( ( ) => {
241+ expect ( getElement ( ) . parentElement ) . toEqual ( document . body )
242+ done ( )
243+ } )
243244 } )
244- } )
245245
246- it ( 'Should find the rootElement if passed as a string' , done => {
247- const instance = new Backdrop ( {
248- isVisible : true ,
249- rootElement : 'body'
250- } )
251- const getElement = ( ) => document . querySelector ( CLASS_BACKDROP )
252- instance . show ( ( ) => {
253- expect ( getElement ( ) . parentElement ) . toEqual ( document . body )
254- done ( )
246+ it ( 'Should find the rootElement if passed as a string' , done => {
247+ const instance = new Backdrop ( {
248+ isVisible : true ,
249+ rootElement : 'body'
250+ } )
251+ const getElement = ( ) => document . querySelector ( CLASS_BACKDROP )
252+ instance . show ( ( ) => {
253+ expect ( getElement ( ) . parentElement ) . toEqual ( document . body )
254+ done ( )
255+ } )
255256 } )
256- } )
257257
258- it ( 'Should appended on any element given by the proper config' , done => {
259- fixtureEl . innerHTML = [
260- '<div id="wrapper">' ,
261- '</div>'
262- ] . join ( '' )
258+ it ( 'Should appended on any element given by the proper config' , done => {
259+ fixtureEl . innerHTML = [
260+ '<div id="wrapper">' ,
261+ '</div>'
262+ ] . join ( '' )
263263
264- const wrapper = fixtureEl . querySelector ( '#wrapper' )
265- const instance = new Backdrop ( {
266- isVisible : true ,
267- rootElement : wrapper
264+ const wrapper = fixtureEl . querySelector ( '#wrapper' )
265+ const instance = new Backdrop ( {
266+ isVisible : true ,
267+ rootElement : wrapper
268+ } )
269+ const getElement = ( ) => document . querySelector ( CLASS_BACKDROP )
270+ instance . show ( ( ) => {
271+ expect ( getElement ( ) . parentElement ) . toEqual ( wrapper )
272+ done ( )
273+ } )
268274 } )
269- const getElement = ( ) => document . querySelector ( CLASS_BACKDROP )
270- instance . show ( ( ) => {
271- expect ( getElement ( ) . parentElement ) . toEqual ( wrapper )
272- done ( )
275+ } )
276+
277+ describe ( 'ClassName' , ( ) => {
278+ it ( 'Should be able to have different classNames than default' , done => {
279+ const instance = new Backdrop ( {
280+ isVisible : true ,
281+ className : 'foo'
282+ } )
283+ const getElement = ( ) => document . querySelector ( '.foo' )
284+ instance . show ( ( ) => {
285+ expect ( getElement ( ) ) . toEqual ( instance . _getElement ( ) )
286+ instance . dispose ( )
287+ done ( )
288+ } )
273289 } )
274290 } )
275291 } )
0 commit comments