Fixed: Order sizes from top to bottom
This commit is contained in:
parent
bfb3ac206a
commit
d8dacc6546
|
@ -128,6 +128,9 @@ class TagGenerator {
|
||||||
|
|
||||||
$sizes = collect(explode('|', $sizes));
|
$sizes = collect(explode('|', $sizes));
|
||||||
$minSize = $sizes->shift();
|
$minSize = $sizes->shift();
|
||||||
|
$sizes = $sizes->sortByDesc(function($size) {
|
||||||
|
return explode(':', $size)[0];
|
||||||
|
});
|
||||||
|
|
||||||
return $sizes->map(function($size) {
|
return $sizes->map(function($size) {
|
||||||
$components = explode(':', $size);
|
$components = explode(':', $size);
|
||||||
|
|
|
@ -181,7 +181,7 @@ class ImageTagTest extends TestCase
|
||||||
|
|
||||||
$output = app(Twig::class)->parse('{{ "/pages/test.jpg" | resize("original", "1rem|200:10px|500:20px") }}');
|
$output = app(Twig::class)->parse('{{ "/pages/test.jpg" | resize("original", "1rem|200:10px|500:20px") }}');
|
||||||
|
|
||||||
$this->assertStringContainsString('sizes="(min-width: 200px) 10px, (min-width: 500px) 20px, 1rem"', $output);
|
$this->assertStringContainsString('sizes="(min-width: 500px) 20px, (min-width: 200px) 10px, 1rem"', $output);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testItGeneratesOnlySingleImage()
|
public function testItGeneratesOnlySingleImage()
|
||||||
|
|
Loading…
Reference in New Issue