@@ -20,6 +20,9 @@ public function getEnvironmentSetUp($app)
2020
2121 protected function getView ($ view )
2222 {
23+ // When testing multiple versions locally, this helps.
24+ $ this ->artisan ('view:clear ' );
25+
2326 Route::get ('/torchlight ' , function () use ($ view ) {
2427 return View::file (__DIR__ . '/Support/ ' . $ view );
2528 })->middleware (RenderTorchlight::class);
@@ -60,8 +63,8 @@ public function it_sends_a_simple_request_with_no_response()
6063 $ response = $ this ->getView ('simple-php-hello-world.blade.php ' );
6164
6265 $ 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 ()
6568 );
6669
6770 Http::assertSent (function ($ request ) {
@@ -83,9 +86,8 @@ public function it_sends_a_simple_request_with_highlighted_response()
8386 $ response = $ this ->getView ('simple-php-hello-world.blade.php ' );
8487
8588 $ 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 ()
8991 );
9092 }
9193
@@ -98,7 +100,7 @@ public function classes_get_merged()
98100
99101 $ this ->assertEquals (
100102 '<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 ()
102104 );
103105 }
104106
@@ -111,7 +113,20 @@ public function attributes_are_preserved()
111113
112114 $ this ->assertEquals (
113115 '<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 ()
115130 );
116131 }
117132
@@ -177,18 +192,11 @@ public function two_components_work()
177192 $ response = $ this ->getView ('two-simple-php-hello-world.blade.php ' );
178193
179194 $ 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>
186196
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 ;
191199
192- $ this ->assertEquals ($ expected , $ actual );
200+ $ this ->assertEquals ($ expected , $ response -> content () );
193201 }
194202}
0 commit comments