Skip to content

Commit 28e6cfa

Browse files
committed
tests: add x-code test
1 parent 31e42d2 commit 28e6cfa

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

tests/Unit/Components/CodeTest.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
namespace Tests\Unit\Components;
4+
5+
use App\Http\Livewire\Documentation\GetStarted;
6+
use Illuminate\Support\Facades\Route;
7+
use Tests\TestCase;
8+
9+
class CodeTest extends TestCase
10+
{
11+
public function setUp(): void
12+
{
13+
parent::setUp();
14+
15+
$this->fakeTorchlight();
16+
}
17+
18+
/** @test */
19+
public function it_should_make_the_code_blocks()
20+
{
21+
$this->blade('<x-code language="php">echo "hello world";</x-code>')
22+
->assertSee('<pre >##PRE_TL_COMPONENT##<code __torchlight-block', escape: false)
23+
->assertSee('</code>##POST_TL_COMPONENT##</pre>', escape: false);
24+
}
25+
26+
/** @test */
27+
public function it_should_render_the_highlighted_code()
28+
{
29+
Route::get('test-code', GetStarted::class);
30+
31+
$this->get('/test-code')
32+
->assertSee('<pre ><code data-theme="material-theme-palenight" data-lang="shell" class="torchlight" style="background-color: #000000;"><div class="highlighted">// torchlight! {"lineNumbers":false}', escape: false)
33+
->assertSee('composer require wireui/wireui</div></code></pre>', escape: false);
34+
}
35+
}

0 commit comments

Comments
 (0)