Skip to content

Commit

Permalink
Add AST Test with multiple List Items
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanzweifel committed Nov 18, 2023
1 parent fd71733 commit 5bda202
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions tests/Renderer/Block/ListBlockRendererTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,44 @@ public function it_renders_unordered_list_block(): void
$this->assertIsString($result);
$this->assertEquals("- List Item Value\n \n", $result);
}

#[Test]
public function it_renders_unordered_list_with_multiple_list_item_values_correctly(): void
{
// Build up Children
$data = new ListData();
$data->type = ListBlock::TYPE_BULLET;
$data->padding = 2;
$data->bulletChar = '-';

$listItem = new ListItem($data);

$paragraph = new Paragraph();
$paragraph->appendChild(new Text('List Item Value'));
$listItem->appendChild($paragraph);

$block = new ListBlock($data);
$block->appendChild($listItem);
$block->appendChild(clone $listItem);
$block->appendChild(clone $listItem);

// Build up Child Renderer
$environment = new Environment();
$environment->addExtension(new MarkdownRendererExtension());
$childRenderer = new MarkdownRenderer($environment);

// Render AST
$result = $this->renderer->render($block, $childRenderer);

$this->assertIsString($result);
$this->assertEquals(<<<'TXT'
- List Item Value
- List Item Value
- List Item Value
TXT, $result);
}
}

0 comments on commit 5bda202

Please sign in to comment.