Add tests for bullet indentation

Bug: T259864
Change-Id: If38016564b67ee7217fe7328b40973aa244ff467
This commit is contained in:
Bartosz Dziewoński 2022-01-12 01:18:27 +01:00
parent 1ce3d7ab7e
commit b7cbd714ca
6 changed files with 6024 additions and 3 deletions

View file

@ -330,9 +330,11 @@
"cases/linearWalk/simple.html", "cases/linearWalk/simple.html",
"cases/en-big-oldparser/en-big-oldparser.html", "cases/en-big-oldparser/en-big-oldparser.html",
"cases/en-big-oldparser/en-big-oldparser-modified.html", "cases/en-big-oldparser/en-big-oldparser-modified.html",
"cases/en-big-oldparser/en-big-oldparser-modified-bullet.html",
"cases/en-big-oldparser/en-big-oldparser-reply.html", "cases/en-big-oldparser/en-big-oldparser-reply.html",
"cases/en-big-parsoid/en-big-parsoid.html", "cases/en-big-parsoid/en-big-parsoid.html",
"cases/en-big-parsoid/en-big-parsoid-modified.html", "cases/en-big-parsoid/en-big-parsoid-modified.html",
"cases/en-big-parsoid/en-big-parsoid-modified-bullet.html",
"cases/ckb-big-oldparser/ckb-big-oldparser.html", "cases/ckb-big-oldparser/ckb-big-oldparser.html",
"cases/ckb-big-parsoid/ckb-big-parsoid.html", "cases/ckb-big-parsoid/ckb-big-parsoid.html",
"cases/en-bigafd-parsoid/en-bigafd-parsoid.html", "cases/en-bigafd-parsoid/en-bigafd-parsoid.html",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -31,6 +31,24 @@
"config": "../data/enwiki-config.json", "config": "../data/enwiki-config.json",
"data": "../data/enwiki-data.json" "data": "../data/enwiki-data.json"
}, },
{
"name": "enwiki oldparser (bullet indentation)",
"title": "Wikipedia:Village pump (technical)/Archive 175",
"dom": "cases/en-big-oldparser/en-big-oldparser.html",
"expected": "cases/en-big-oldparser/en-big-oldparser-modified-bullet.html",
"config": "../data/enwiki-config.json",
"data": "../data/enwiki-data.json",
"replyIndentation": "bullet"
},
{
"name": "enwiki parsoid (bullet indentation)",
"title": "Wikipedia:Village pump (technical)/Archive 175",
"dom": "cases/en-big-parsoid/en-big-parsoid.html",
"expected": "cases/en-big-parsoid/en-big-parsoid-modified-bullet.html",
"config": "../data/enwiki-config.json",
"data": "../data/enwiki-data.json",
"replyIndentation": "bullet"
},
{ {
"name": "arwiki no-paragraph oldparser", "name": "arwiki no-paragraph oldparser",
"title": "نقاش المستخدم:Khaled", "title": "نقاش المستخدم:Khaled",

View file

@ -19,7 +19,8 @@ class CommentModifierTest extends IntegrationTestCase {
* @covers ::addListItem * @covers ::addListItem
*/ */
public function testAddListItem( public function testAddListItem(
string $name, string $title, string $dom, string $expected, string $config, string $data string $name, string $title, string $dom, string $expected, string $config, string $data,
string $replyIndentation = 'invisible'
): void { ): void {
$title = Title::newFromText( $title ); $title = Title::newFromText( $title );
$origPath = $dom; $origPath = $dom;
@ -39,7 +40,7 @@ class CommentModifierTest extends IntegrationTestCase {
$nodes = []; $nodes = [];
foreach ( $comments as $comment ) { foreach ( $comments as $comment ) {
$node = CommentModifier::addListItem( $comment, 'invisible' ); $node = CommentModifier::addListItem( $comment, $replyIndentation );
$node->textContent = 'Reply to ' . $comment->getId(); $node->textContent = 'Reply to ' . $comment->getId();
$nodes[] = $node; $nodes[] = $node;
} }

View file

@ -34,7 +34,7 @@ require( '../cases/modified.json' ).forEach( function ( caseItem, i ) {
// every reply would be super slow. // every reply would be super slow.
var nodes = []; var nodes = [];
comments.forEach( function ( comment ) { comments.forEach( function ( comment ) {
var node = modifier.addListItem( comment, 'invisible' ); var node = modifier.addListItem( comment, caseItem.replyIndentation || 'invisible' );
node.textContent = 'Reply to ' + comment.id; node.textContent = 'Reply to ' + comment.id;
nodes.push( node ); nodes.push( node );
} ); } );