Skip to content

Commit

Permalink
Added check of number of calls in AJAX test
Browse files Browse the repository at this point in the history
  • Loading branch information
verlok committed Apr 1, 2014
1 parent 4329dae commit 131736f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/picturePolyfill.qunit.js
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,8 @@ test("parse() after a DOM injection (without MQ support)", function(){
<noscript><img src="http://placehold.it/1x1" alt="A beautiful responsive image"/></noscript>\
</picture>');

this.spy(picturePolyfill, "parse");

picturePolyfill.initialize();

// Media query support: no, pixel density: indifferent
Expand All @@ -553,6 +555,8 @@ test("parse() after a DOM injection (without MQ support)", function(){
picturePolyfill._mqSupport = false;
picturePolyfill.parse();

strictEqual(picturePolyfill.parse.getCalls().length, 1, "Parse has not been called exactly once");

images = document.getElementsByTagName('img');
strictEqual(images.length, 1);

Expand All @@ -564,6 +568,8 @@ test("parse() after a DOM injection (without MQ support)", function(){
var ajaxSection = document.getElementById('ajaxSection');
picturePolyfill.parse(ajaxSection);

strictEqual(picturePolyfill.parse.getCalls().length, 2, "Parse has not been called exactly twice");

images = document.getElementsByTagName('img');
strictEqual(images.length, 2);

Expand Down

0 comments on commit 131736f

Please sign in to comment.