3bd15c49b2a8fa3749f03570a70f3db07003bee0
2 // Whitespace and serialisation of function bodies
3 // different in browsers.
4 var functionSize
= String( function () {} ).length
;
6 QUnit
.module( 'mediawiki.inspect' );
8 QUnit
.test( '.getModuleSize() - scripts', function ( assert
) {
10 'test.inspect.script',
11 function () { 'example'; }
14 return mw
.loader
.using( 'test.inspect.script' ).then( function () {
16 mw
.inspect
.getModuleSize( 'test.inspect.script' ) - functionSize
,
17 // name, script function
24 QUnit
.test( '.getModuleSize() - scripts, styles', function ( assert
) {
27 function () { 'example'; },
28 { css
: [ '.example {}' ] }
31 return mw
.loader
.using( 'test.inspect.both' ).then( function () {
33 mw
.inspect
.getModuleSize( 'test.inspect.both' ) - functionSize
,
34 // name, script function, styles object
41 QUnit
.test( '.getModuleSize() - scripts, messages', function ( assert
) {
43 'test.inspect.scriptmsg',
44 function () { 'example'; },
46 { example
: 'Hello world.' }
49 return mw
.loader
.using( 'test.inspect.scriptmsg' ).then( function () {
51 mw
.inspect
.getModuleSize( 'test.inspect.scriptmsg' ) - functionSize
,
52 // name, script function, empty styles object, messages object
54 'test.inspect.scriptmsg'
59 QUnit
.test( '.getModuleSize() - scripts, styles, messages, templates', function ( assert
) {
62 function () { 'example'; },
63 { css
: [ '.example {}' ] },
64 { example
: 'Hello world.' },
65 { 'example.html': '<p>Hello world.<p>' }
68 return mw
.loader
.using( 'test.inspect.all' ).then( function () {
70 mw
.inspect
.getModuleSize( 'test.inspect.all' ) - functionSize
,
71 // name, script function, styles object, messages object, templates object