2014-12-08 00:06:28 +11:00
Feature : Jekyll responsive_image_block tag
Scenario : Simple image tag
2014-12-08 00:14:40 +11:00
Given I h a v e a r e s p o n s i v e _ i m a g e c o n f i g u r a t i o n w i t h " t e m p l a t e " s e t t o " _ i n c l u d e s / r e s p o n s i v e - i m a g e . h t m l "
2014-12-08 00:06:28 +11:00
And I h a v e a f i l e " i n d e x . h t m l " w i t h :
"""
2016-09-02 17:53:29 +10:00
{ % a s s i g n p a t h = ' a s s e t s / e v e r y b o d y - l o v e s - j a l a p e ñ o - p i n e a p p l e - c o r n b r e a d . p n g ' % }
2014-12-08 00:06:28 +11:00
{ % r e s p o n s i v e _ i m a g e _ b l o c k % }
p a t h : { { p a t h } }
t i t l e : M a g i c r a i n b o w a d v e n t u r e !
2016-12-29 20:19:48 +11:00
a l t : L o r e m i p s u m
2014-12-08 00:06:28 +11:00
{ % e n d r e s p o n s i v e _ i m a g e _ b l o c k % }
"""
When I r u n J e k y l l
2016-09-02 17:53:29 +10:00
Then I s h o u l d s e e " < i m g a l t = \ " L o r e m i p s u m \ " s r c = \ " / a s s e t s / e v e r y b o d y - l o v e s - j a l a p e ñ o - p i n e a p p l e - c o r n b r e a d . p n g \ " t i t l e = \ " M a g i c r a i n b o w a d v e n t u r e ! \ " " i n " _ s i t e / i n d e x . h t m l "
2014-12-08 00:06:28 +11:00
2015-11-05 20:18:53 +11:00
Scenario : Global variables available in templates
Given I h a v e a f i l e " i n d e x . h t m l " w i t h :
"""
{ % r e s p o n s i v e _ i m a g e _ b l o c k % }
2016-09-02 17:53:29 +10:00
p a t h : a s s e t s / e v e r y b o d y - l o v e s - j a l a p e ñ o - p i n e a p p l e - c o r n b r e a d . p n g
2015-11-05 20:18:53 +11:00
{ % e n d r e s p o n s i v e _ i m a g e _ b l o c k % }
"""
And I h a v e a c o n f i g u r a t i o n w i t h :
"""
b a s e u r l : h t t p s : / / w i l d l y i n a c c u r a t e . c o m
r e s p o n s i v e _ i m a g e :
t e m p l a t e : _ i n c l u d e s / b a s e - u r l . h t m l
"""
When I r u n J e k y l l
2016-09-02 17:53:29 +10:00
Then I s h o u l d s e e " <img src=\"https://wildlyinaccurate.com/assets/everybody-loves-jalapeño-pineapple-cornbread.png\"> " i n " _ s i t e / i n d e x . h t m l "
2015-11-05 20:18:53 +11:00
2014-12-08 00:06:28 +11:00
Scenario : More complex logic in the block tag
2014-12-08 00:14:40 +11:00
Given I h a v e a r e s p o n s i v e _ i m a g e c o n f i g u r a t i o n w i t h " t e m p l a t e " s e t t o " _ i n c l u d e s / r e s p o n s i v e - i m a g e . h t m l "
2014-12-08 00:06:28 +11:00
And I h a v e a f i l e " i n d e x . h t m l " w i t h :
"""
2016-09-02 17:53:29 +10:00
{ % a s s i g n p a t h = ' a s s e t s / e v e r y b o d y - l o v e s - j a l a p e ñ o - p i n e a p p l e - c o r n b r e a d . p n g ' % }
2014-12-08 00:06:28 +11:00
{ % a s s i g n a l t = ' L o r e m i p s u m ' % }
{ % r e s p o n s i v e _ i m a g e _ b l o c k % }
p a t h : { { p a t h } }
{ % i f a n o t h e r _ a l t % }
a l t : { { a n o t h e r _ a l t } }
{ % e l s e % }
a l t : { { a l t } }
{ % e n d i f % }
{ % e n d r e s p o n s i v e _ i m a g e _ b l o c k % }
"""
When I r u n J e k y l l
2016-09-02 17:53:29 +10:00
Then I s h o u l d s e e " < i m g a l t = \ " L o r e m i p s u m \ " s r c = \ " / a s s e t s / e v e r y b o d y - l o v e s - j a l a p e ñ o - p i n e a p p l e - c o r n b r e a d . p n g \ " " i n " _ s i t e / i n d e x . h t m l "
2014-12-08 09:33:14 +11:00
Scenario : Handling a nil path
Given I h a v e a r e s p o n s i v e _ i m a g e c o n f i g u r a t i o n w i t h " t e m p l a t e " s e t t o " _ i n c l u d e s / r e s p o n s i v e - i m a g e . h t m l "
And I h a v e a f i l e " i n d e x . h t m l " w i t h :
"""
{ % r e s p o n s i v e _ i m a g e _ b l o c k % }
p a t h : { { p a t h } }
{ % e n d r e s p o n s i v e _ i m a g e _ b l o c k % }
"""
Then J e k y l l s h o u l d t h r o w a " S y n t a x E r r o r "