import { DefaultDOMElement } from 'substance'

export default function getMountPoint (t) {
  // when running with substance-test we get
  // a sandbox for each test
  if (t.sandbox) return t.sandbox
  // otherwise we create our own DOM
  let htmlDoc = DefaultDOMElement.parseHTML('<html><body></body></html>')
  return htmlDoc.find('body')
}

@@ -19,16 +19,26 @@
 MElement
+, platform
  %7D from 
@@ -49,16 +49,16 @@
 stance'%0A
-
 %0Aexport 
@@ -211,40 +211,303 @@
  // 
-otherwise we create our own
+if we are in the browser we append an element to the body%0A  if (platform.inBrowser) %7B%0A    let body = DefaultDOMElement.wrap(window.document.body)%0A    let sandboxEl = body.createElement('div')%0A    body.append(sandboxEl)%0A    return sandboxEl%0A  %7D else %7B%0A    // otherwise we create a detached
  DOM%0A
+  
   le
@@ -576,16 +576,18 @@
 html%3E')%0A
+  
   return
@@ -608,10 +608,14 @@
 'body')%0A
+  %7D%0A
 %7D%0A

Make getMountPoint() compatible with karma like environments.