2015-12-27 05:11:05 +11:00
|
|
|
Feature: Responsive image generation
|
|
|
|
As a Jekyll user
|
2016-12-29 20:19:48 +11:00
|
|
|
I want to resize my images
|
|
|
|
In order to render them on my pages
|
2015-12-27 05:11:05 +11:00
|
|
|
|
|
|
|
Scenario: Resizing images
|
|
|
|
Given I have a responsive_image configuration with:
|
|
|
|
"""
|
|
|
|
template: _includes/responsive-image.html
|
|
|
|
sizes:
|
|
|
|
- width: 100
|
|
|
|
"""
|
2016-09-02 17:53:29 +10:00
|
|
|
And I have a file "index.html" with "{% responsive_image path: assets/everybody-loves-jalapeño-pineapple-cornbread.png alt: Foobar %}"
|
2015-12-27 05:11:05 +11:00
|
|
|
When I run Jekyll
|
2016-09-02 17:53:29 +10:00
|
|
|
Then the image "assets/resized/everybody-loves-jalapeño-pineapple-cornbread-100x50.png" should have the dimensions "100x50"
|
2016-09-26 05:23:06 +10:00
|
|
|
And the file "_site/assets/resized/everybody-loves-jalapeño-pineapple-cornbread-100x50.png" should exist
|
2015-12-27 05:11:05 +11:00
|
|
|
|
|
|
|
Scenario: Handling subdirectories
|
|
|
|
Given I have a responsive_image configuration with:
|
|
|
|
"""
|
|
|
|
template: _includes/responsive-image.html
|
2015-12-28 09:41:04 +11:00
|
|
|
output_path_format: assets/resized/%{dirname}/%{filename}-%{width}.%{extension}
|
2015-12-27 05:11:05 +11:00
|
|
|
sizes:
|
|
|
|
- width: 100
|
|
|
|
"""
|
|
|
|
And I have a file "index.html" with:
|
|
|
|
"""
|
2016-09-02 17:53:29 +10:00
|
|
|
{% responsive_image path: assets/everybody-loves-jalapeño-pineapple-cornbread.png %}
|
2015-12-27 05:11:05 +11:00
|
|
|
{% responsive_image path: assets/subdir/test.png %}
|
2016-09-02 17:53:29 +10:00
|
|
|
{% responsive_image path: assets/everybody-loves-jalapeño-pineapple-cornbread.png cache: true %}
|
2015-12-27 05:11:05 +11:00
|
|
|
"""
|
|
|
|
When I run Jekyll
|
2016-09-02 17:53:29 +10:00
|
|
|
Then the file "assets/resized/everybody-loves-jalapeño-pineapple-cornbread-100.png" should exist
|
2016-09-26 05:23:06 +10:00
|
|
|
And the file "_site/assets/resized/everybody-loves-jalapeño-pineapple-cornbread-100.png" should exist
|
2015-12-28 09:41:04 +11:00
|
|
|
And the file "assets/resized/subdir/test-100.png" should exist
|
2016-09-26 05:23:06 +10:00
|
|
|
And the file "_site/assets/resized/subdir/test-100.png" should exist
|
|
|
|
|
2016-12-28 21:14:13 +11:00
|
|
|
Scenario: Honouring source image interlace mode
|
|
|
|
Given I have a responsive_image configuration with:
|
|
|
|
"""
|
|
|
|
template: _includes/responsive-image.html
|
|
|
|
sizes:
|
|
|
|
- width: 100
|
|
|
|
"""
|
|
|
|
And I have a file "index.html" with "{% responsive_image path: assets/progressive.jpeg %}"
|
|
|
|
When I run Jekyll
|
|
|
|
Then the image "assets/resized/progressive-100x50.jpeg" should be interlaced
|
|
|
|
|
2016-09-26 05:23:06 +10:00
|
|
|
Scenario: Honouring Jekyll 'source' configuration
|
2016-09-28 04:59:35 +10:00
|
|
|
Given I have copied my site to "my-site-copy/src"
|
2016-09-26 05:23:06 +10:00
|
|
|
And I have a configuration with:
|
|
|
|
"""
|
2016-09-28 04:59:35 +10:00
|
|
|
source: my-site-copy/src
|
2016-09-26 05:23:06 +10:00
|
|
|
responsive_image:
|
2016-10-12 07:21:11 +11:00
|
|
|
base_path: assets
|
2016-09-26 05:23:06 +10:00
|
|
|
template: _includes/responsive-image.html
|
2016-09-28 04:59:35 +10:00
|
|
|
output_path_format: assets/resized/%{dirname}/%{width}/%{basename}
|
2016-09-26 05:23:06 +10:00
|
|
|
sizes:
|
|
|
|
- width: 100
|
|
|
|
"""
|
2016-09-28 04:59:35 +10:00
|
|
|
And I have a file "my-site-copy/src/index.html" with "{% responsive_image path: assets/subdir/test.png %}"
|
2016-09-26 05:23:06 +10:00
|
|
|
When I run Jekyll
|
2016-10-12 07:21:11 +11:00
|
|
|
Then the image "my-site-copy/src/assets/resized/subdir/100/test.png" should have the dimensions "100x50"
|
|
|
|
And the file "_site/assets/resized/subdir/100/test.png" should exist
|