X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/pie.php?a=blobdiff_plain;f=tests%2Fqunit%2Fsuites%2Fresources%2Fmediawiki%2Fmediawiki.loader.test.js;h=9dc9e5d66134f0b5146db3e9b7d5679816fb6ecb;hb=37df7415141208a7365759160e69bf11d4cccfa0;hp=06ea9bc58f2324adf79a9242f6bc4c054bfa0744;hpb=2632183a49f6f8845fdbd77bceaccb6aafe4003f;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/qunit/suites/resources/mediawiki/mediawiki.loader.test.js b/tests/qunit/suites/resources/mediawiki/mediawiki.loader.test.js index 06ea9bc58f..9dc9e5d661 100644 --- a/tests/qunit/suites/resources/mediawiki/mediawiki.loader.test.js +++ b/tests/qunit/suites/resources/mediawiki/mediawiki.loader.test.js @@ -191,14 +191,30 @@ } ); QUnit.test( '.load() - Error: Circular dependency', function ( assert ) { + var capture = []; mw.loader.register( [ [ 'test.circleA', '0', [ 'test.circleB' ] ], [ 'test.circleB', '0', [ 'test.circleC' ] ], [ 'test.circleC', '0', [ 'test.circleA' ] ] ] ); - assert.throws( function () { - mw.loader.load( 'test.circleC' ); - }, /Circular/, 'Detect circular dependency' ); + this.sandbox.stub( mw, 'track', function ( topic, data ) { + capture.push( { + topic: topic, + error: data.exception && data.exception.message, + source: data.source + } ); + } ); + + mw.loader.load( 'test.circleC' ); + assert.deepEqual( + [ { + topic: 'resourceloader.exception', + error: 'Circular reference detected: test.circleB -> test.circleC', + source: 'resolve' + } ], + capture, + 'Detect circular dependency' + ); } ); QUnit.test( '.using() - Error: Unregistered', function ( assert ) { @@ -219,6 +235,32 @@ mw.loader.load( 'test.using.unreg2' ); } ); + // Regression test for T36853 + QUnit.test( '.load() - Error: Missing dependency', function ( assert ) { + var capture = []; + this.sandbox.stub( mw, 'track', function ( topic, data ) { + capture.push( { + topic: topic, + error: data.exception && data.exception.message, + source: data.source + } ); + } ); + + mw.loader.register( [ + [ 'test.load.missingdep1', '0', [ 'test.load.missingdep2' ] ], + [ 'test.load.missingdep', '0', [ 'test.load.missingdep1' ] ] + ] ); + mw.loader.load( 'test.load.missingdep' ); + assert.deepEqual( + [ { + topic: 'resourceloader.exception', + error: 'Unknown dependency: test.load.missingdep2', + source: 'resolve' + } ], + capture + ); + } ); + QUnit.test( '.implement( styles={ "css": [text, ..] } )', function ( assert ) { var $element = $( '
' ).appendTo( '#qunit-fixture' );