Skip to content
This repository has been archived by the owner on Sep 6, 2022. It is now read-only.

Commit

Permalink
srcset parsing tests for days, some of which currently fail.
Browse files Browse the repository at this point in the history
  • Loading branch information
Wilto committed Apr 24, 2014
1 parent fea12d7 commit a4c5e4a
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions tests/tests.js
Expand Up @@ -213,6 +213,46 @@
resolution: 320
}];
deepEqual(pf.getCandidatesFromSourceSet(srcset2), expectedresult2, srcset2 + " is parsed correctly" );

var srcset3 = "foo.png 1x, bar.png -2x";
var expectedresult3 = [{
url: "foo.png",
resolution: 1
},{
url: "bar.png",
resolution: -2
}];
deepEqual(pf.getCandidatesFromSourceSet(srcset3), expectedresult3, srcset3 + " is parsed correctly" );

var srcset4 = "foo.png 1x, bar.png 2q";
var expectedresult4 = [{
url: "foo.png",
resolution: 1
},{
url: "bar.png",
resolution: 1
}];
deepEqual(pf.getCandidatesFromSourceSet(srcset4), expectedresult4, srcset4 + " is parsed correctly" );

var srcset5 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUg 1x, bar.png 2x";
var expectedresult5 = [{
url: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUg",
resolution: 1
},{
url: "bar.png",
resolution: 2
}];
deepEqual(pf.getCandidatesFromSourceSet(srcset5), expectedresult5, srcset5 + " is parsed correctly" );

var srcset6 = "2.png 1x,1.png 2x";
var expectedresult6 = [{
url: "2.png",
resolution: 1
},{
url: "1.png",
resolution: 2
}];
deepEqual(pf.getCandidatesFromSourceSet(srcset6), expectedresult6, srcset6 + " is parsed correctly" );
});

test("verifyTypeSupport", function() {
Expand Down

0 comments on commit a4c5e4a

Please sign in to comment.