assets/a.svg
'; + + self::assertSame($html, (new InlineExampleAssetRebaser)->rebase($html, ['assets/a.svg'], '/_docara/examples/x/')); + self::assertSame($html, (new InlineExampleAssetRebaser)->rebase($html, [], '/_docara/examples/x/')); + } +} diff --git a/tests/Unit/ProjectExampleRepositoryTest.php b/tests/Unit/ProjectExampleRepositoryTest.php index a846b0ac..98a16eb4 100644 --- a/tests/Unit/ProjectExampleRepositoryTest.php +++ b/tests/Unit/ProjectExampleRepositoryTest.php @@ -93,6 +93,45 @@ public function an_html_only_project_example_renders_inline_inside_a_boundary_ro ], $reasons); } + #[Test] + public function an_inline_project_example_points_its_own_assets_at_the_published_folder(): void + { + $this->createSource([ + 'content/ru/page.md' => '# Page', + 'examples/components/card/index.html' => '<div data-picture="assets/place-01-4x3.svg"', $html);
+ self::assertStringContainsString('<base href="/docs/_docara/examples/components/card/">', $html);
+ self::assertSame(['inline', 'admitted_html'], [
+ $repository->receipt()['previews'][0]['resolved_preview'],
+ $repository->receipt()['previews'][0]['reason'],
+ ]);
+ }
+
#[Test]
public function it_rejects_inline_body_with_id_and_unsafe_project_files(): void
{