Skip to content

Commit

Permalink
A couple of quick and sketchy tests for setInherentSize.
Browse files Browse the repository at this point in the history
  • Loading branch information
Wilto committed Nov 26, 2014
1 parent 9accf78 commit 67df662
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,23 @@
equal(width, 500, "returns 500 when match media returns false");
});

test("setInherentSize", function() {
var fakeImg = document.createElement( "img" );

fakeImg[ pf.ns ] = {};
fakeImg.src = "../examples/images/small.jpg";

fakeImg.setAttribute( "width", 10 );

pf.setInherentSize( 2, fakeImg );
deepEqual( fakeImg.width, 10, "No natural width calculation is performed if a `width` attribute already exists." );

fakeImg.removeAttribute( "width" );
fakeImg[ pf.ns ].reeval = true;
pf.setInherentSize( 2, fakeImg );
deepEqual( fakeImg.width, 90, "width attribute is set to `naturalWidth / resolution`" );
});

test("parseSize", function() {
var size1 = "";
var expected1 = {
Expand Down

0 comments on commit 67df662

Please sign in to comment.