Merge "Add unit tests for mw.format()"
[lhc/web/wiklou.git] / tests / qunit / suites / resources / mediawiki / mediawiki.test.js
index f7c8d17..ed3f2cd 100644 (file)
                } );
        } );
 
-       QUnit.asyncTest( 'mw.loader.using( .. ).promise', 2, function ( assert ) {
+       QUnit.asyncTest( 'mw.loader.using( .. ) Promise', 2, function ( assert ) {
                var isAwesomeDone;
 
                mw.loader.testCallback = function () {
        } );
 
        // @import (bug 31676)
-       QUnit.asyncTest( 'mw.loader.implement( styles has @import)', 7, function ( assert ) {
+       QUnit.asyncTest( 'mw.loader.implement( styles has @import )', 7, function ( assert ) {
                var isJsExecuted, $element;
 
                mw.loader.implement(
                } );
        } );
 
-       QUnit.test( 'mw.loader erroneous indirect dependency', 4, function ( assert ) {
+       QUnit.test( 'mw.loader with broken indirect dependency', 4, function ( assert ) {
                // don't emit an error event
                this.sandbox.stub( mw, 'track' );
 
                assert.strictEqual( mw.track.callCount, 1 );
        } );
 
+       QUnit.test( 'mw.loader with circular dependency', 1, function ( assert ) {
+               mw.loader.register( [
+                       [ 'test.circle1', '0', [ 'test.circle2' ] ],
+                       [ 'test.circle2', '0', [ 'test.circle3' ] ],
+                       [ 'test.circle3', '0', [ 'test.circle1' ] ]
+               ] );
+               assert.throws( function () {
+                       mw.loader.using( 'test.circle3' );
+               }, /Circular/, 'Detect circular dependency' );
+       } );
+
        QUnit.test( 'mw.loader out-of-order implementation', 9, function ( assert ) {
                mw.loader.register( [
                        [ 'test.module4', '0' ],