2010-08-24 22:59:22 +00:00
|
|
|
Feature: Editable elements
|
|
|
|
As a designer
|
|
|
|
I want to define content which will be edited by the website editor
|
|
|
|
|
|
|
|
Background:
|
|
|
|
Given I have the site: "test site" set up
|
|
|
|
|
|
|
|
Scenario: Simple short text element
|
|
|
|
Given a page named "hello-world" with the template:
|
|
|
|
"""
|
|
|
|
My application says {% editable_short_text 'a_sentence', hint: 'please enter a new sentence' %}Hello world{% endeditable_short_text %}
|
|
|
|
"""
|
|
|
|
When I view the rendered page at "/hello-world"
|
|
|
|
Then the rendered output should look like:
|
|
|
|
"""
|
|
|
|
My application says Hello world
|
|
|
|
"""
|
|
|
|
|
2010-08-27 15:40:03 +00:00
|
|
|
Scenario: Updating a page
|
|
|
|
Given a page named "hello-world" with the template:
|
|
|
|
"""
|
|
|
|
My application says {% editable_short_text 'a_sentence' %}Hello world{% endeditable_short_text %}
|
|
|
|
{% block main %}Main{% endblock %}
|
|
|
|
"""
|
|
|
|
When I update the "hello-world" page with the template:
|
|
|
|
"""
|
|
|
|
My application says {% editable_short_text 'a_sentence' %}Hello world{% endeditable_short_text %}
|
|
|
|
{% block main %}Main{% endblock %}
|
|
|
|
{% block sidebar %}{% editable_short_text 'title' %}Default sidebar title{% endeditable_short_text %}{% endblock %}
|
|
|
|
"""
|
|
|
|
And I view the rendered page at "/hello-world"
|
|
|
|
Then the rendered output should look like:
|
|
|
|
"""
|
|
|
|
My application says Hello world
|
|
|
|
Main
|
|
|
|
Default sidebar title
|
|
|
|
"""
|
|
|
|
|
2010-08-24 22:59:22 +00:00
|
|
|
Scenario: Modified short text element
|
|
|
|
Given a page named "hello-world" with the template:
|
|
|
|
"""
|
|
|
|
My application says {% editable_short_text 'a_sentence', hint: 'please enter a new sentence' %}Hello world{% endeditable_short_text %}
|
|
|
|
"""
|
2010-08-26 11:06:44 +00:00
|
|
|
And the editable element "a_sentence" in the "hello-world" page with the content "Bonjour"
|
2010-08-24 22:59:22 +00:00
|
|
|
When I view the rendered page at "/hello-world"
|
|
|
|
Then the rendered output should look like:
|
|
|
|
"""
|
|
|
|
My application says Bonjour
|
|
|
|
"""
|
|
|
|
|
|
|
|
Scenario: Short text element inside a block
|
|
|
|
Given a page named "hello-world" with the template:
|
|
|
|
"""
|
|
|
|
{% block main %}My application says {% editable_short_text 'a_sentence' %}Hello world{% endeditable_short_text %}{% endblock %}
|
|
|
|
"""
|
|
|
|
When I view the rendered page at "/hello-world"
|
|
|
|
Then the rendered output should look like:
|
|
|
|
"""
|
|
|
|
My application says Hello world
|
|
|
|
"""
|
|
|
|
|
|
|
|
Scenario: Not modified short text element inside a block and with page inheritance
|
|
|
|
Given a page named "hello-world" with the template:
|
|
|
|
"""
|
|
|
|
{% block main %}My application says {% editable_short_text 'a_sentence' %}Hello world{% endeditable_short_text %}{% endblock %}
|
|
|
|
"""
|
|
|
|
Given a page named "another-hello-world" with the template:
|
|
|
|
"""
|
|
|
|
{% extends hello-world %}
|
|
|
|
"""
|
|
|
|
When I view the rendered page at "/another-hello-world"
|
|
|
|
Then the rendered output should look like:
|
|
|
|
"""
|
|
|
|
My application says Hello world
|
2010-08-26 11:06:44 +00:00
|
|
|
"""
|
|
|
|
|
|
|
|
Scenario: Modified short text element inside a block and with page inheritance
|
|
|
|
Given a page named "hello-world" with the template:
|
|
|
|
"""
|
|
|
|
{% block main %}My application says {% editable_short_text 'a_sentence' %}Hello world{% endeditable_short_text %}{% endblock %}
|
|
|
|
"""
|
|
|
|
Given a page named "another-hello-world" with the template:
|
|
|
|
"""
|
|
|
|
{% extends hello-world %}
|
|
|
|
"""
|
|
|
|
And the editable element "a_sentence" for the "main" block in the "another-hello-world" page with the content "Bonjour"
|
|
|
|
When I view the rendered page at "/another-hello-world"
|
|
|
|
Then the rendered output should look like:
|
|
|
|
"""
|
|
|
|
My application says Bonjour
|
2010-08-27 15:40:03 +00:00
|
|
|
"""
|
|
|
|
|
|
|
|
Scenario: Combine inheritance and update
|
|
|
|
Given a page named "hello-world" with the template:
|
|
|
|
"""
|
|
|
|
My application says {% editable_short_text 'a_sentence' %}Hello world{% endeditable_short_text %}
|
|
|
|
{% block main %}Main{% endblock %}
|
|
|
|
"""
|
|
|
|
Given a page named "another-hello-world" with the template:
|
|
|
|
"""
|
|
|
|
{% extends hello-world %}
|
|
|
|
{% block main %}Another Main{% endblock %}
|
|
|
|
"""
|
|
|
|
When I update the "hello-world" page with the template:
|
|
|
|
"""
|
|
|
|
My application says {% editable_short_text 'a_sentence' %}Hello world{% endeditable_short_text %}
|
|
|
|
{% block main %}Main{% endblock %}
|
|
|
|
{% block sidebar %}{% editable_short_text 'title' %}Default sidebar title{% endeditable_short_text %}{% endblock %}
|
|
|
|
"""
|
|
|
|
And I view the rendered page at "/another-hello-world"
|
|
|
|
Then the rendered output should look like:
|
|
|
|
"""
|
|
|
|
My application says Hello world
|
|
|
|
Another Main
|
|
|
|
Default sidebar title
|
2010-08-31 21:53:30 +00:00
|
|
|
"""
|
|
|
|
|
|
|
|
Scenario: Insert editable files
|
|
|
|
Given a page named "hello-world" with the template:
|
|
|
|
"""
|
|
|
|
My application file is {% editable_file 'a_file', hint: 'please enter a new file' %}/default.pdf{% endeditable_file %}
|
|
|
|
"""
|
|
|
|
When I view the rendered page at "/hello-world"
|
|
|
|
Then the rendered output should look like:
|
|
|
|
"""
|
|
|
|
My application file is /default.pdf
|
|
|
|
"""
|
2011-07-06 16:47:28 +00:00
|
|
|
|
|
|
|
Scenario: Render liquid variable used as default editable file name
|
|
|
|
Given a page named "hello-world" with the template:
|
|
|
|
"""
|
|
|
|
{% assign default_file_name = '/different-default.pdf' %}
|
|
|
|
My application file is {% editable_file 'a_file', hint: 'please enter a new file' %}{{ default_file_name }}{% endeditable_file %}
|
|
|
|
"""
|
|
|
|
When I view the rendered page at "/hello-world"
|
|
|
|
Then the rendered output should look like:
|
|
|
|
"""
|
|
|
|
|
|
|
|
My application file is /different-default.pdf
|
|
|
|
"""
|
2010-08-31 21:53:30 +00:00
|
|
|
|