Feature: Repeated and optional content
Scenario: The if tag
Given a file named "example.dryml" with:
"""
<% some_var = 'foo' %>
some_var is true some_other_var is true
some_var is true
""" Scenario: The else tag Given a file named "example.dryml" with: """ <% some_var = 'foo' %>some_var is true
some_var is false
some_other_var is true
some_other_var is false
some_var is true
some_other_var is false
""" Scenario: The unless tag Given a file named "example.dryml" with: """ <% some_var = 'foo' %>some_var is false
some_other_var is false
some_other_var is false
""" Scenario: The if tag with a field Given a file named "example.dryml" with: """author name is not blank
<% this.author.name = '' %>author name is still not blank
now it is
author name is not blank
now it is
""" Scenario: The if parameter Given a file named "example.dryml" with: """ <% some_var = 'foo' %>some_var is true
<% some_other_var = '' %>some_other_var is true
""" When I render "example.dryml" Then the output DOM should be: """some_var is true
""" Scenario: The unless parameter Given a file named "example.dryml" with: """ <% some_var = 'foo' %>some_var is false
<% some_other_var = '' %>some_other_var is false
""" When I render "example.dryml" Then the output DOM should be: """some_other_var is false
""" Scenario: The if parameter with a field - NOTE NO & Given a file named "example.dryml" with: """author name is not blank
<% this.author.name = '' %>author name is still not blank
now it is
author name is not blank
now it is
""" Scenario: The if parameter without an argument Given a file named "example.dryml" with: """author name is not blank
<% this.author.name = '' %>author name is still not blank
now it is
author name is not blank
now it is
""" Scenario: The if parameter without an argument applies to the surrounding context Given a file named "example.dryml" with: """ <% this.author = '' %>first if is true
second if is true
first if is true
""" Scenario: repeat tag Given a file named "example.dryml" with: """<%= this %>
1
2
3
4
""" Scenario: repeat attribute Given a file named "example.dryml" with: """<%= this %>
""" When I render "example.dryml" Then the output DOM should be: """1
2
3
4
""" Scenario: attributes on a repeated tag are re-evaluated at each iteration Given a file named "example.dryml" with: """<%= this %>
""" When I render "example.dryml" Then the output DOM should be: """1
2
3
4
""" Scenario: even-odd scoped variable Given a file named "example.dryml" with: """<%= this %>
""" When I render "example.dryml" Then the output DOM should be: """1
2
3
4
""" Scenario: repeating the implicit context with if Given a file named "example.dryml" with: """<%= this %>
<%= this %>
1
2
4
""" Scenario: first_item? helper Given a file named "example.dryml" with: """<%= first_item? ? this*10 : this %>
""" When I render "example.dryml" Then the output DOM should be: """10
2
3
4
""" Scenario: repeating over a hash sets this_key (not reliable on Ruby < 1.9) Given a file named "example.dryml" with: """<%= this %>
""" When I render "example.dryml" Then the output DOM should be: """1
2
3
"""