Use interwiki cache directly to resolve transwiki import sources
[lhc/web/wiklou.git] / tests / qunit / suites / resources / jquery / jquery.hidpi.test.js
1 ( function ( $ ) {
2 QUnit.module( 'jquery.hidpi', QUnit.newMwEnvironment() );
3
4 QUnit.test( 'devicePixelRatio', 1, function ( assert ) {
5 var devicePixelRatio = $.devicePixelRatio();
6 assert.equal( typeof devicePixelRatio, 'number', '$.devicePixelRatio() returns a number' );
7 } );
8
9 QUnit.test( 'matchSrcSet', 6, function ( assert ) {
10 var srcset = 'onefive.png 1.5x, two.png 2x';
11
12 // Nice exact matches
13 assert.equal( $.matchSrcSet( 1, srcset ), null, '1.0 gives no match' );
14 assert.equal( $.matchSrcSet( 1.5, srcset ), 'onefive.png', '1.5 gives match' );
15 assert.equal( $.matchSrcSet( 2, srcset ), 'two.png', '2 gives match' );
16
17 // Non-exact matches; should return the next-biggest specified
18 assert.equal( $.matchSrcSet( 1.25, srcset ), null, '1.25 gives no match' );
19 assert.equal( $.matchSrcSet( 1.75, srcset ), 'onefive.png', '1.75 gives match to 1.5' );
20 assert.equal( $.matchSrcSet( 2.25, srcset ), 'two.png', '2.25 gives match to 2' );
21 } );
22 }( jQuery ) );