mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 18:39:52 +00:00
58e27f56d6
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
29 lines
618 B
JavaScript
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 );
|
|
} )
|
|
);
|
|
|
|
}
|