Merge "SpecialMovepage: Convert form to use OOUI controls"
[lhc/web/wiklou.git] / tests / qunit / suites / resources / mediawiki / mediawiki.ForeignStructuredUpload.test.js
1 ( function ( mw ) {
2 QUnit.module( 'mediawiki.ForeignStructuredUpload', QUnit.newMwEnvironment( {} ) );
3
4 QUnit.test( 'Constructor check', function ( assert ) {
5 QUnit.expect( 3 );
6 var upload = new mw.ForeignStructuredUpload();
7
8 assert.ok( upload, 'The ForeignUpload constructor is working.' );
9 assert.ok( upload.descriptions, 'The descriptions array was initialized properly' );
10 assert.ok( upload.categories, 'The categories array was initialized properly' );
11 } );
12
13 QUnit.test( 'getText', function ( assert ) {
14 QUnit.expect( 1 );
15
16 var upload = new mw.ForeignStructuredUpload();
17
18 // Set basic information
19 upload.addDescription( 'en', 'Test description one two three' );
20 upload.addDescription( 'en-x-piglatin', 'Esttay escriptionday unway ootay eethray' );
21 upload.setDate( '1776-07-04' );
22 upload.addCategories( [ 'Test 1', 'Test 2' ] );
23 upload.addCategories( [ 'Test 3' ] );
24
25 // Fake the user
26 this.sandbox.stub( upload, 'getUser' ).returns( 'Test user' );
27
28 assert.strictEqual( upload.getText().trim(), '{{Information\n|description={{en|Test description one two three}}\n{{en-x-piglatin|Esttay escriptionday unway ootay eethray}}\n|date=1776-07-04\n|source=Test user\n|author=Test user\n}}\n\n\n\n[[Category:Test 1]]\n[[Category:Test 2]]\n[[Category:Test 3]]' );
29 } );
30 }( mediaWiki ) );