 
 
   beforeEach ->
+    modal       = null
+    overlay     = null
+    modalId     = "modal#{spark.utils.getUid()}"
+    overlayId   = "overlay#{spark.utils.getUid()}"
     modal       = new spark.components.Modal
+      'domId'   : modalId
       'title'   : 'Are you sure you want to logout?'
       'content' : 'Your session will be ended and you will not be able to restore your cart.'
       'buttons' : spark.components.Modal.Buttons.YES_NO
 
-    overlay   = modal.getOverlay()
-    overlay.setDomId 'modal-overlay'
+    overlay = modal.getOverlay()
+    overlay.setDomId overlayId
 
 
   afterEach ->



  it 'should remove itself when overlay is clicked', ->
    modal.setDomId 'modally'

    expect(document.getElementById('modally')).toBeDefined()

    fireClick(overlay)

    expect(document.getElementById('modally')).toBeNull()


  it 'should emit event for preset buttons', ->

    m = new spark.components.Modal blocking: yes
    o = m.getOverlay()

    fireClick o.getElement()

    expect(document.getElementById(overlayId)).not.toBeNull()

    m.removeFromDocument()

