/
BladeTest.php
76 lines (59 loc) · 2.12 KB
/
BladeTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
namespace Illuminate\Tests\Integration\View;
use Illuminate\Support\Facades\View;
use Orchestra\Testbench\TestCase;
/**
* @group integration
*/
class BladeTest extends TestCase
{
public function test_basic_blade_rendering()
{
$view = View::make('hello', ['name' => 'Taylor'])->render();
$this->assertSame('Hello Taylor', trim($view));
}
public function test_rendering_a_component()
{
$view = View::make('uses-panel', ['name' => 'Taylor'])->render();
$this->assertSame('<div class="ml-2">
Hello Taylor
</div>', trim($view));
}
public function test_rendering_a_dynamic_component()
{
$view = View::make('uses-panel-dynamically', ['name' => 'Taylor'])->render();
$this->assertSame('<div class="ml-2" wire:model="foo" wire:model.lazy="bar">
Hello Taylor
</div>', trim($view));
}
public function test_rendering_the_same_dynamic_component_with_different_attributes()
{
$view = View::make('varied-dynamic-calls')->render();
$this->assertSame('<span class="text-medium">
Hello Taylor
</span>
<span >
Hello Samuel
</span>', trim($view));
}
public function test_inline_link_type_attributes_dont_add_extra_spacing_at_end()
{
$view = View::make('uses-link')->render();
$this->assertSame('This is a sentence with a <a href="https://laravel.com">link</a>.', trim($view));
}
public function test_appendable_attributes()
{
$view = View::make('uses-appendable-panel', ['name' => 'Taylor', 'withInjectedValue' => true])->render();
$this->assertSame('<div class="mt-4 bg-gray-100" data-controller="inside-controller outside-controller" foo="bar">
Hello Taylor
</div>', trim($view));
$view = View::make('uses-appendable-panel', ['name' => 'Taylor', 'withInjectedValue' => false])->render();
$this->assertSame('<div class="mt-4 bg-gray-100" data-controller="inside-controller" foo="bar">
Hello Taylor
</div>', trim($view));
}
protected function getEnvironmentSetUp($app)
{
$app['config']->set('view.paths', [__DIR__.'/templates']);
}
}