mediawiki-extensions-Visual.../modules/ve-mw/tests/dm/models/ve.dm.MWTransclusionContentModel.test.js
Thiemo Kreuz 58e27f56d6 Remove not needed self = this indirections
These are only needed when we need to access a specific `this` from
within another `function () {}` context. This is not the case in the
situations here.

This is split from Ibf25d7e to make it smaller and easier to argue
about.

Change-Id: Ide1476de91fc343aa992ad92a1321d3a38b06dd0
2022-02-21 10:52:24 +01:00

29 lines
618 B
JavaScript

{
QUnit.module( 've.dm.MWTransclusionContentModel' );
/**
* @return {ve.dm.MWTransclusionModel} but it's a mock
*/
const createTransclusionModel = function () {
return {
nextUniquePartId: () => 0
};
};
[
[ undefined, false ],
[ null, false ],
[ '', false ],
[ ' ', true ],
[ '0', true ],
[ '\nfoo', true ]
].forEach( ( [ wikitext, expected ] ) =>
QUnit.test( 'containsValuableData: ' + wikitext, ( assert ) => {
const model = new ve.dm.MWTransclusionContentModel( createTransclusionModel(), wikitext );
assert.strictEqual( model.containsValuableData(), expected );
} )
);
}