Merge "selenium: invoke jobs to enforce eventual consistency"
[lhc/web/wiklou.git] / tests / qunit / suites / resources / mediawiki / mediawiki.inspect.test.js
1 ( function () {
2
3 QUnit.module( 'mediawiki.inspect' );
4
5 QUnit.test( '.getModuleSize() - scripts', function ( assert ) {
6 mw.loader.implement(
7 'test.inspect.script',
8 function () { 'example'; }
9 );
10
11 return mw.loader.using( 'test.inspect.script' ).then( function () {
12 assert.strictEqual(
13 mw.inspect.getModuleSize( 'test.inspect.script' ),
14 // name, script function
15 43,
16 'test.inspect.script'
17 );
18 } );
19 } );
20
21 QUnit.test( '.getModuleSize() - scripts, styles', function ( assert ) {
22 mw.loader.implement(
23 'test.inspect.both',
24 function () { 'example'; },
25 { css: [ '.example {}' ] }
26 );
27
28 return mw.loader.using( 'test.inspect.both' ).then( function () {
29 assert.strictEqual(
30 mw.inspect.getModuleSize( 'test.inspect.both' ),
31 // name, script function, styles object
32 64,
33 'test.inspect.both'
34 );
35 } );
36 } );
37
38 QUnit.test( '.getModuleSize() - scripts, messages', function ( assert ) {
39 mw.loader.implement(
40 'test.inspect.scriptmsg',
41 function () { 'example'; },
42 {},
43 { example: 'Hello world.' }
44 );
45
46 return mw.loader.using( 'test.inspect.scriptmsg' ).then( function () {
47 assert.strictEqual(
48 mw.inspect.getModuleSize( 'test.inspect.scriptmsg' ),
49 // name, script function, empty styles object, messages object
50 74,
51 'test.inspect.scriptmsg'
52 );
53 } );
54 } );
55
56 QUnit.test( '.getModuleSize() - scripts, styles, messages, templates', function ( assert ) {
57 mw.loader.implement(
58 'test.inspect.all',
59 function () { 'example'; },
60 { css: [ '.example {}' ] },
61 { example: 'Hello world.' },
62 { 'example.html': '<p>Hello world.<p>' }
63 );
64
65 return mw.loader.using( 'test.inspect.all' ).then( function () {
66 assert.strictEqual(
67 mw.inspect.getModuleSize( 'test.inspect.all' ),
68 // name, script function, styles object, messages object, templates object
69 126,
70 'test.inspect.all'
71 );
72 } );
73 } );
74 }() );