Blame view

framework/thirdparty/jasmine/spec/suites/QueueSpec.js 751 Bytes
0084d336   Administrator   Importers CRUD
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  describe("jasmine.Queue", function() {
    it("should not call itself recursively, so we don't get stack overflow errors", function() {
      var queue = new jasmine.Queue(new jasmine.Env());
      queue.add(new jasmine.Block(null, function() {}));
      queue.add(new jasmine.Block(null, function() {}));
      queue.add(new jasmine.Block(null, function() {}));
      queue.add(new jasmine.Block(null, function() {}));
  
      var nestCount = 0;
      var maxNestCount = 0;
      var nextCallCount = 0;
      queue.next_ = function() {
        nestCount++;
        if (nestCount > maxNestCount) maxNestCount = nestCount;
  
        jasmine.Queue.prototype.next_.apply(queue, arguments);
        nestCount--;
      };
  
      queue.start();
      expect(maxNestCount).toEqual(1);
    });
  });