Skip to content

Commit

Permalink
Fix up badges for BS5.
Browse files Browse the repository at this point in the history
  • Loading branch information
dereuromark committed Nov 20, 2023
1 parent 77614fb commit 95ca5fe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/View/Helper/LogHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class LogHelper extends Helper {
* @var array<string, mixed>
*/
protected array $_defaultConfig = [
'typeTemplate' => '<span class="badge badge-%s">%s</span>',
'typeTemplate' => '<span class="badge badge-%s bg-%s">%s</span>',
'typeDefaultClass' => 'secondary',
'typeMap' => [
'error' => 'danger',
Expand Down Expand Up @@ -58,7 +58,7 @@ public function typeLabel($type) {

$template = $this->getConfig('typeTemplate');

return sprintf($template, $class, h($type));
return sprintf($template, $class, $class, h($type));
}

}
8 changes: 4 additions & 4 deletions tests/TestCase/View/Helper/LogHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,19 @@ public function tearDown(): void {
*/
public function testTypeLabel() {
$result = $this->Log->typeLabel('error');
$expected = '<span class="badge badge-danger">error</span>';
$expected = '<span class="badge badge-danger bg-danger">error</span>';
$this->assertSame($expected, $result);

$result = $this->Log->typeLabel('warning');
$expected = '<span class="badge badge-warning">warning</span>';
$expected = '<span class="badge badge-warning bg-warning">warning</span>';
$this->assertSame($expected, $result);

$result = $this->Log->typeLabel('info');
$expected = '<span class="badge badge-info">info</span>';
$expected = '<span class="badge badge-info bg-info">info</span>';
$this->assertSame($expected, $result);

$result = $this->Log->typeLabel('foooo');
$expected = '<span class="badge badge-secondary">foooo</span>';
$expected = '<span class="badge badge-secondary bg-secondary">foooo</span>';
$this->assertSame($expected, $result);
}

Expand Down

0 comments on commit 95ca5fe

Please sign in to comment.