@@ -20,6 +20,9 @@ public function getEnvironmentSetUp($app)
20
20
21
21
protected function getView ($ view )
22
22
{
23
+ // When testing multiple versions locally, this helps.
24
+ $ this ->artisan ('view:clear ' );
25
+
23
26
Route::get ('/torchlight ' , function () use ($ view ) {
24
27
return View::file (__DIR__ . '/Support/ ' . $ view );
25
28
})->middleware (RenderTorchlight::class);
@@ -60,8 +63,8 @@ public function it_sends_a_simple_request_with_no_response()
60
63
$ response = $ this ->getView ('simple-php-hello-world.blade.php ' );
61
64
62
65
$ this ->assertEquals (
63
- '<code class="" style="">echo "hello world";</code> ' ,
64
- rtrim ( $ response ->content () )
66
+ '<pre>< code class="" style="">echo "hello world";</code></pre > ' ,
67
+ $ response ->content ()
65
68
);
66
69
67
70
Http::assertSent (function ($ request ) {
@@ -83,9 +86,8 @@ public function it_sends_a_simple_request_with_highlighted_response()
83
86
$ response = $ this ->getView ('simple-php-hello-world.blade.php ' );
84
87
85
88
$ this ->assertEquals (
86
- '<code class="torchlight" style="background-color: #292D3E;">this is the highlighted response from the server</code> ' ,
87
- // See https://github.com/laravel/framework/pull/35874/files for the rtrim reasoning.
88
- rtrim ($ response ->content ())
89
+ '<pre><code class="torchlight" style="background-color: #292D3E;">this is the highlighted response from the server</code></pre> ' ,
90
+ $ response ->content ()
89
91
);
90
92
}
91
93
@@ -98,7 +100,7 @@ public function classes_get_merged()
98
100
99
101
$ this ->assertEquals (
100
102
'<code class="torchlight mt-4" style="background-color: #292D3E;">this is the highlighted response from the server</code> ' ,
101
- rtrim ( $ response ->content () )
103
+ $ response ->content ()
102
104
);
103
105
}
104
106
@@ -111,7 +113,20 @@ public function attributes_are_preserved()
111
113
112
114
$ this ->assertEquals (
113
115
'<code class="torchlight" style="background-color: #292D3E;" x-data="{}">this is the highlighted response from the server</code> ' ,
114
- rtrim ($ response ->content ())
116
+ $ response ->content ()
117
+ );
118
+ }
119
+
120
+ /** @test */
121
+ public function inline_keeps_its_spaces ()
122
+ {
123
+ $ this ->legitApiResponse ();
124
+
125
+ $ response = $ this ->getView ('an-inline-component.blade.php ' );
126
+
127
+ $ this ->assertEquals (
128
+ 'this is <code class="torchlight" style="background-color: #292D3E;">this is the highlighted response from the server</code> inline ' ,
129
+ $ response ->content ()
115
130
);
116
131
}
117
132
@@ -177,18 +192,11 @@ public function two_components_work()
177
192
$ response = $ this ->getView ('two-simple-php-hello-world.blade.php ' );
178
193
179
194
$ expected = <<<EOT
180
- <code class="torchlight1" style="background-color: #111111;">response 1</code>
181
- <code class="torchlight2" style="background-color: #222222;">response 2</code>
182
- EOT ;
183
-
184
- // See https://github.com/laravel/framework/pull/35874/files for reasoning.
185
- $ expected = str_replace ("\n" , '' , $ expected );
195
+ <pre><code class="torchlight1" style="background-color: #111111;">response 1</code></pre>
186
196
187
- // Covering bugfixes from earlier versions of Laravel
188
- // https://github.com/laravel/framework/pull/35874/files.
189
- $ actual = rtrim (str_replace ("\n" , '' , $ response ->content ()));
190
- $ actual = str_replace ('</code> <code ' , '</code><code ' , $ actual );
197
+ <pre><code class="torchlight2" style="background-color: #222222;">response 2</code></pre>
198
+ EOT ;
191
199
192
- $ this ->assertEquals ($ expected , $ actual );
200
+ $ this ->assertEquals ($ expected , $ response -> content () );
193
201
}
194
202
}
0 commit comments