Skip to content

Commit

Permalink
Flush those timeouts!
Browse files Browse the repository at this point in the history
  • Loading branch information
Bargs committed Dec 19, 2016
1 parent cd58a4f commit b642ba6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/ui/public/directives/__tests__/fixed_scroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ import Promise from 'bluebird';
describe('FixedScroll directive', function () {

let compile;
let timeout;
const trash = [];

beforeEach(ngMock.module('kibana'));
beforeEach(ngMock.inject(function ($compile, $rootScope) {
beforeEach(ngMock.inject(function ($compile, $rootScope, $timeout) {
timeout = $timeout;

compile = function (ratioY, ratioX) {
if (ratioX == null) ratioX = ratioY;
Expand Down Expand Up @@ -42,6 +44,7 @@ describe('FixedScroll directive', function () {

$compile($parent)($rootScope);
$rootScope.$digest();
$timeout.flush();

return {
$container: $el,
Expand Down Expand Up @@ -93,6 +96,7 @@ describe('FixedScroll directive', function () {
expect(off.callCount).to.be(0);
els.$container.width(els.$container.prop('scrollWidth'));
els.$container.scope().$digest();
timeout.flush();
expect(off.callCount).to.be(2);
checkThisVals('$.fn.off', off);

Expand Down

0 comments on commit b642ba6

Please sign in to comment.