Skip to content

Commit f0b170a

Browse files
committed
Fix trailing space
1 parent 9f87c19 commit f0b170a

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
## Unreleased
44

5+
## 0.5.9 - 2022-01-19
6+
7+
### Fixed
8+
9+
- Fix cosmetic trailing space issue
10+
511
## 0.5.8 - 2022-01-19
612

713
### Added

src/Block.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,9 @@ public function attrsAsString()
200200
$attrs[] = "$key=\"$value\"";
201201
}
202202

203-
return implode(' ', $attrs) . ' ';
203+
if (count($attrs)) {
204+
return implode(' ', $attrs) . ' ';
205+
}
204206
}
205207

206208
/**

tests/MiddlewareAndComponentTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,25 @@ public function it_sends_a_simple_request_with_style()
8888
);
8989
}
9090

91+
/** @test */
92+
public function no_attrs_no_trailing_space()
93+
{
94+
$this->fakeSuccessfulResponse('component', [
95+
'classes' => 'torchlight',
96+
'styles' => 'background-color: #292D3E;',
97+
'highlighted' => 'this is the highlighted response from the server',
98+
'attrs' => []
99+
]);
100+
101+
$response = $this->getView('simple-php-hello-world-with-style.blade.php');
102+
103+
$this->assertEquals(
104+
'<pre><code class="torchlight" style="display: none;background-color: #292D3E;">this is the highlighted response from the server</code></pre>',
105+
$response->content()
106+
);
107+
}
108+
109+
91110
/** @test */
92111
public function classes_get_merged()
93112
{

0 commit comments

Comments
 (0)