parser.test.js: New test for each case, as in modifier.test.js

Explicitly skip the old parser tests as these are not yet working.

Change-Id: I1a8fbb9b177acd97db9c42250dd6f5226f879ac0
This commit is contained in:
Ed Sanders 2022-10-11 17:23:40 +01:00
parent 045b020ca4
commit 6d03608b7c

View file

@ -53,11 +53,39 @@ QUnit.test( '#getTimestampParser (at DST change)', function ( assert ) {
} ); } );
} ); } );
QUnit.test( '#getThreads', function ( assert ) { require( '../cases/comments.json' ).forEach( function ( caseItem ) {
var cases = require( '../cases/comments.json' );
var testName = '#getThreads (' + caseItem.name + ')';
// Old parser tests are currently broken
var skipTests = [
'plwiki oldparser',
'enwiki oldparser',
'ckbwiki oldparser',
'arwiki no-paragraph oldparser',
'arwiki nbsp-timezone oldparser',
'frwiki fr-unsigned oldparser',
'itwiki it-unsigned oldparser',
'srwiki sr-ec variant',
'srwiki sr-el variant',
'Accidental dt tags (old parser)',
'Single comment, heading',
'Single comment with heading',
'Manually added signature with LRM',
'Signature which is just a selflink',
'Comments inside references (old parser)',
'Link using fallback 8-bit encoding (invalid UTF-8)',
'Fake headings using \';\' syntax in wikitext (<dt> tags)',
'Signatures in funny places',
'Timestamp format switch behavior'
];
if ( skipTests.indexOf( caseItem.name ) !== -1 ) {
QUnit.skip( testName );
return;
}
QUnit.test( testName, function ( assert ) {
var fixture = document.getElementById( 'qunit-fixture' ); var fixture = document.getElementById( 'qunit-fixture' );
cases.forEach( function ( caseItem ) {
var $dom = mw.template.get( 'test.DiscussionTools', caseItem.dom ).render(), var $dom = mw.template.get( 'test.DiscussionTools', caseItem.dom ).render(),
expected = require( caseItem.expected ), expected = require( caseItem.expected ),
config = require( caseItem.config ), config = require( caseItem.config ),