Add test case for custom attributes

This commit is contained in:
Joseph Wynn 2014-12-06 01:21:53 +00:00
parent d32304c61c
commit 320e3955dd
2 changed files with 16 additions and 4 deletions

View File

@ -1,4 +1,4 @@
<img alt="{{ alt }}" src="/{{ path }}"{% if resized %} srcset=" <img alt="{{ alt }}" src="/{{ path }}" title="{{ title }}"{% if resized %} srcset="
{% for i in resized %} {% for i in resized %}
/{{ i.path }} {{ i.width }}w{% if forloop.last == false %},{% endif %} /{{ i.path }} {{ i.width }}w{% if forloop.last == false %},{% endif %}
{% endfor %} {% endfor %}

View File

@ -13,9 +13,21 @@ Feature: Jekyll responsive-image tag
{% responsive_image path: assets/test.png alt: Foobar %} {% responsive_image path: assets/test.png alt: Foobar %}
""" """
When I run Jekyll When I run Jekyll
Then I should see "<img alt=\"Foobar\" src=\"/assets/test.png\">" in "_site/index.html" Then I should see "<img alt=\"Foobar\" src=\"/assets/test.png\"" in "_site/index.html"
Scenario: UTF-8 alt attribute Scenario: Adding custom attributes
Given I have a responsive_image configuration with:
"""
template: _includes/responsive-image.html
"""
And I have a file "index.html" with:
"""
{% responsive_image path: assets/test.png alt: Foobar title: "Lorem Ipsum" %}
"""
When I run Jekyll
Then I should see "<img alt=\"Foobar\" src=\"/assets/test.png\" title=\"Lorem Ipsum\"" in "_site/index.html"
Scenario: UTF-8 attributes
Given I have a responsive_image configuration with: Given I have a responsive_image configuration with:
""" """
template: _includes/responsive-image.html template: _includes/responsive-image.html
@ -25,7 +37,7 @@ Feature: Jekyll responsive-image tag
{% responsive_image path: assets/test.png alt: " " %} {% responsive_image path: assets/test.png alt: " " %}
""" """
When I run Jekyll When I run Jekyll
Then I should see "<img alt=\"かっこいい! ジェケルが好きです!\" src=\"/assets/test.png\">" in "_site/index.html" Then I should see "<img alt=\" \" src=\"/assets/test.png\"" in "_site/index.html"
Scenario: Image with multiple sizes Scenario: Image with multiple sizes
Given I have a responsive_image configuration with: Given I have a responsive_image configuration with: