Skip to content

Commit

Permalink
Synchronized canvas render to happen for testing
Browse files Browse the repository at this point in the history
Using mock infrastructure
  • Loading branch information
aashish24 committed Apr 13, 2016
1 parent 0efdbc0 commit ac1daf0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/cases/heatmap.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Test geo.core.osmLayer
var geo = require('../test-utils').geo;
var $ = require('jquery');

Expand All @@ -13,6 +14,10 @@ afterEach(function () {
describe('canvas heatmap feature', function () {
'use strict';

var mockAnimationFrame = require('../test-utils').mockAnimationFrame;
var stepAnimationFrame = require('../test-utils').stepAnimationFrame;
var unmockAnimationFrame = require('../test-utils').unmockAnimationFrame;

var map, width = 800, height = 600, layer, feature1, feature2,
testData = "Strength, Lat,Lon\
0.6,42.8584,-70.9301\
Expand Down Expand Up @@ -47,8 +52,11 @@ describe('canvas heatmap feature', function () {
.style('blurRadius', 15)
.style('opacity', 1.0);

mockAnimationFrame();
map.draw();
expect(layer.children().length).toBe(1);
stepAnimationFrame(new Date().getTime());
expect(layer.children().length).toBe(1)
unmockAnimationFrame();
});

it('Validate selection API option', function () {
Expand Down

0 comments on commit ac1daf0

Please sign in to comment.