X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fqunit%2Fsuites%2Fresources%2Fjquery%2Fjquery.hidpi.test.js;h=8c6287658ead61124a50c27e8ad98019c3da3f7b;hb=59ebff658ce912c1b0e7ef8d8f9bfec5a4e17b39;hp=140da384d90ce49c803da12d791ff70240dfb8af;hpb=aeae4fedda78715690ce50236f4f38f0b9c2a9f9;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/qunit/suites/resources/jquery/jquery.hidpi.test.js b/tests/qunit/suites/resources/jquery/jquery.hidpi.test.js index 140da384d9..8c6287658e 100644 --- a/tests/qunit/suites/resources/jquery/jquery.hidpi.test.js +++ b/tests/qunit/suites/resources/jquery/jquery.hidpi.test.js @@ -1,12 +1,28 @@ ( function ( $ ) { QUnit.module( 'jquery.hidpi', QUnit.newMwEnvironment() ); - QUnit.test( 'devicePixelRatio', function ( assert ) { + QUnit.test( 'devicePixelRatio', 1, function ( assert ) { var devicePixelRatio = $.devicePixelRatio(); assert.equal( typeof devicePixelRatio, 'number', '$.devicePixelRatio() returns a number' ); } ); - QUnit.test( 'matchSrcSet', function ( assert ) { + QUnit.test( 'bracketedDevicePixelRatio', 1, function ( assert ) { + var devicePixelRatio = $.devicePixelRatio(); + assert.equal( typeof devicePixelRatio, 'number', '$.bracketedDevicePixelRatio() returns a number' ); + } ); + + QUnit.test( 'bracketDevicePixelRatio', 8, function ( assert ) { + assert.equal( $.bracketDevicePixelRatio( 0.75 ), 1, '0.75 gives 1' ); + assert.equal( $.bracketDevicePixelRatio( 1 ), 1, '1 gives 1' ); + assert.equal( $.bracketDevicePixelRatio( 1.25 ), 1.5, '1.25 gives 1.5' ); + assert.equal( $.bracketDevicePixelRatio( 1.5 ), 1.5, '1.5 gives 1.5' ); + assert.equal( $.bracketDevicePixelRatio( 1.75 ), 2, '1.75 gives 2' ); + assert.equal( $.bracketDevicePixelRatio( 2 ), 2, '2 gives 2' ); + assert.equal( $.bracketDevicePixelRatio( 2.5 ), 2, '2.5 gives 2' ); + assert.equal( $.bracketDevicePixelRatio( 3 ), 2, '3 gives 2' ); + } ); + + QUnit.test( 'matchSrcSet', 6, function ( assert ) { var srcset = 'onefive.png 1.5x, two.png 2x'; // Nice exact matches