summaryrefslogtreecommitdiff
path: root/www/wiki/tests/qunit/suites/resources/mediawiki/mediawiki.inspect.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'www/wiki/tests/qunit/suites/resources/mediawiki/mediawiki.inspect.test.js')
-rw-r--r--www/wiki/tests/qunit/suites/resources/mediawiki/mediawiki.inspect.test.js74
1 files changed, 74 insertions, 0 deletions
diff --git a/www/wiki/tests/qunit/suites/resources/mediawiki/mediawiki.inspect.test.js b/www/wiki/tests/qunit/suites/resources/mediawiki/mediawiki.inspect.test.js
new file mode 100644
index 00000000..1f7a5ece
--- /dev/null
+++ b/www/wiki/tests/qunit/suites/resources/mediawiki/mediawiki.inspect.test.js
@@ -0,0 +1,74 @@
+( function ( mw ) {
+
+ QUnit.module( 'mediawiki.inspect' );
+
+ QUnit.test( '.getModuleSize() - scripts', function ( assert ) {
+ mw.loader.implement(
+ 'test.inspect.script',
+ function () { 'example'; }
+ );
+
+ return mw.loader.using( 'test.inspect.script' ).then( function () {
+ assert.equal(
+ mw.inspect.getModuleSize( 'test.inspect.script' ),
+ // name, script function
+ 43,
+ 'test.inspect.script'
+ );
+ } );
+ } );
+
+ QUnit.test( '.getModuleSize() - scripts, styles', function ( assert ) {
+ mw.loader.implement(
+ 'test.inspect.both',
+ function () { 'example'; },
+ { css: [ '.example {}' ] }
+ );
+
+ return mw.loader.using( 'test.inspect.both' ).then( function () {
+ assert.equal(
+ mw.inspect.getModuleSize( 'test.inspect.both' ),
+ // name, script function, styles object
+ 64,
+ 'test.inspect.both'
+ );
+ } );
+ } );
+
+ QUnit.test( '.getModuleSize() - scripts, messages', function ( assert ) {
+ mw.loader.implement(
+ 'test.inspect.scriptmsg',
+ function () { 'example'; },
+ {},
+ { example: 'Hello world.' }
+ );
+
+ return mw.loader.using( 'test.inspect.scriptmsg' ).then( function () {
+ assert.equal(
+ mw.inspect.getModuleSize( 'test.inspect.scriptmsg' ),
+ // name, script function, empty styles object, messages object
+ 74,
+ 'test.inspect.scriptmsg'
+ );
+ } );
+ } );
+
+ QUnit.test( '.getModuleSize() - scripts, styles, messages, templates', function ( assert ) {
+ mw.loader.implement(
+ 'test.inspect.all',
+ function () { 'example'; },
+ { css: [ '.example {}' ] },
+ { example: 'Hello world.' },
+ { 'example.html': '<p>Hello world.<p>' }
+ );
+
+ return mw.loader.using( 'test.inspect.all' ).then( function () {
+ assert.equal(
+ mw.inspect.getModuleSize( 'test.inspect.all' ),
+ // name, script function, styles object, messages object, templates object
+ 126,
+ 'test.inspect.all'
+ );
+ } );
+ } );
+}( mediaWiki ) );