g idle period', function() {
  var whenIdle = window.requestIdleCallback ? window.requestIdleCallback : function(fn) { setTimeout(fn, 16); };

  test('The queued function runs.', function(done) {
    var callback = sinon.spy();
    idlePeriod.run(callback);
    whenIdle(function() {
      assert.isTrue(callback.calledOnce);
      done();
    });
  });

  test('Functions queued multiple times are run multiple times.', function(done) {
    var callback = sinon.spy();
    idlePeriod.run(callback);
    idlePeri