From 798f5e22a910f11fdd2b1573bc633ad24474196c Mon Sep 17 00:00:00 2001 From: Topher Fangio Date: Tue, 5 Jan 2016 15:46:18 -0600 Subject: [PATCH] test(toolbar): Fix failing unit tests in 1.3.x. In Angular 1.3.20/19, some of the toolbar unit tests fail due to not properly calling `$timeout.flush()` within the test. Add the proper timeout flush to the tests. --- src/components/toolbar/toolbar.spec.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/toolbar/toolbar.spec.js b/src/components/toolbar/toolbar.spec.js index facdd675f7..f87d257e13 100644 --- a/src/components/toolbar/toolbar.spec.js +++ b/src/components/toolbar/toolbar.spec.js @@ -118,7 +118,7 @@ describe('', function() { expect(element.find('md-toolbar').length).toBe(0); })); - it('works with ng-show', inject(function($$rAF) { + it('works with ng-show', inject(function($$rAF, $timeout) { var template = '
' + ' test' + @@ -154,6 +154,7 @@ describe('', function() { // Show the toolbar and ensure it is visible pageScope.$apply('shouldShowToolbar = true'); pageScope.$digest(); + $timeout.flush(); toolbarStyles = getComputedStyle(element.find('md-toolbar')[0]); contentStyles = getComputedStyle(element.find('md-content')[0]); @@ -170,7 +171,7 @@ describe('', function() { document.body.removeChild(element[0]); })); - it('works with ng-hide', inject(function($$rAF) { + it('works with ng-hide', inject(function($$rAF, $timeout) { var template = '
' + ' test' + @@ -206,6 +207,7 @@ describe('', function() { // Show the toolbar and ensure it is hidden pageScope.$apply('shouldNotShowToolbar = true'); pageScope.$digest(); + $timeout.flush(); toolbarStyles = getComputedStyle(element.find('md-toolbar')[0]); contentStyles = getComputedStyle(element.find('md-content')[0]);