diff --git a/spec/LayoutSpec.js b/spec/LayoutSpec.js index 0432a430..92319b8a 100755 --- a/spec/LayoutSpec.js +++ b/spec/LayoutSpec.js @@ -1,25 +1,27 @@ -function setupIframe(callback) { + +var iframe = (function() { var iframe = document.createElement('iframe'); document.body.appendChild(iframe); var doc = iframe.contentDocument; - var link = document.createElement('link'); - link.setAttribute('rel', 'stylesheet'); - link.setAttribute('type', 'text/css'); - link.setAttribute('href', 'style.css'); - doc.head.appendChild(link); + var style = document.createElement('style'); + style.innerText = (function() {/* + body, div { + box-sizing: border-box; - requestAnimationFrame(function wait() { - if (doc.styleSheets.length) { - callback(iframe); - } else { - requestAnimationFrame(wait); + display: flex; + flex-direction: column; + align-items: flex-start; + + margin: 0; + padding: 0; } - }) -} + */} + '').slice(15, -4); + doc.head.appendChild(style); -var iframe = null; + return iframe; +})(); function computeDOMLayout(node) { var body = iframe.contentDocument.body; @@ -97,14 +99,6 @@ function testLayout(node, expectedLayout) { } describe('Layout', function() { - beforeEach(function(done) { - if (iframe) { - done(); - } else { - setupIframe(function(ifrm) { iframe = ifrm; done(); }); - } - }); - it('should layout a single node with width and height', function() { testLayout({ style: {width: 100, height: 200} @@ -474,7 +468,6 @@ describe('Layout', function() { }); }); - it('should layout randomly', function() { function RNG(seed) { this.state = seed; diff --git a/style.css b/style.css deleted file mode 100644 index 073ce0db..00000000 --- a/style.css +++ /dev/null @@ -1,10 +0,0 @@ -* { - box-sizing: border-box; - - display: flex; - flex-direction: column; - align-items: flex-start; - - margin: 0; - padding: 0; -}