diff --git a/src/wrappers/Window.js b/src/wrappers/Window.js index f2abbdd..2c00323 100644 --- a/src/wrappers/Window.js +++ b/src/wrappers/Window.js @@ -11,6 +11,7 @@ var unwrap = scope.unwrap; var unwrapIfNeeded = scope.unwrapIfNeeded; var wrap = scope.wrap; + var renderAllPending = scope.renderAllPending; var OriginalWindow = window.Window; @@ -21,6 +22,7 @@ var originalGetComputedStyle = window.getComputedStyle; OriginalWindow.prototype.getComputedStyle = function(el, pseudo) { + renderAllPending(); return originalGetComputedStyle.call(this || window, unwrapIfNeeded(el), pseudo); }; diff --git a/test/js/Window.js b/test/js/Window.js index 1f9a1f1..4778cd4 100644 --- a/test/js/Window.js +++ b/test/js/Window.js @@ -56,4 +56,15 @@ suite('Window', function() { assert.isTrue(cs != null); }); + test('getComputedStyleShadow', function() { + var host = document.createElement('div'); + var root = host.createShadowRoot(); + var elt = document.createElement('div'); + root.appendChild(elt); + document.body.appendChild(host); + elt.style.padding = '4px'; + assert.equal(getComputedStyle(elt).paddingLeft, '4px'); + document.body.removeChild(host); + }); + });