Skip to content
This repository was archived by the owner on Mar 5, 2023. It is now read-only.

Commit b725b25

Browse files
authored
Merge pull request #36 from 8fold/8fold-sites
use ESArray for simple image
2 parents 6912012 + 562aa7e commit b725b25

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/UIKit/Elements/Simple/Image.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,9 @@ public function schemaProp(string $property): Image
2929

3030
public function unfold(): string
3131
{
32-
$attr = array_merge(
33-
$this->getAttr(),
34-
["src ". $this->src],
35-
["alt ". $this->alt]
32+
$attr = $this->getAttr()->plus(
33+
"src ". $this->src,
34+
"alt ". $this->alt
3635
);
3736
return Html::img()->attr(...$attr)->unfold();
3837
}

tests/UIKit/SimpleTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,11 @@ public function testSimpleDLWithDefinedTerms()
9292
)->description(1, 3)->unfold();
9393
$this->assertEquals($expected, $result);
9494
}
95+
96+
public function testSimpleImage()
97+
{
98+
$expected = '<img src="https://path.to/image.jpg" alt="Alt text">';
99+
$actual = UIKit::image("Alt text", "https://path.to/image.jpg");
100+
$this->assertEquals($expected, $actual->unfold());
101+
}
95102
}

0 commit comments

Comments
 (0)