2021-10-13 13:21:04 +00:00
|
|
|
{
|
2021-09-09 07:16:37 +00:00
|
|
|
QUnit.module( 've.dm.MWTransclusionContentModel' );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return {ve.dm.MWTransclusionModel} but it's a mock
|
|
|
|
*/
|
2021-10-13 13:21:04 +00:00
|
|
|
const createTransclusionModel = function () {
|
2021-09-09 07:16:37 +00:00
|
|
|
return {
|
2021-12-22 12:03:01 +00:00
|
|
|
nextUniquePartId: () => 0
|
2021-09-09 07:16:37 +00:00
|
|
|
};
|
2021-10-13 13:21:04 +00:00
|
|
|
};
|
2021-09-09 07:16:37 +00:00
|
|
|
|
|
|
|
[
|
|
|
|
[ 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 );
|
|
|
|
} )
|
|
|
|
);
|
|
|
|
|
2021-10-13 13:21:04 +00:00
|
|
|
}
|