diff --git a/features/step_definitions/aspects_steps.rb b/features/step_definitions/aspects_steps.rb index 58770a5558dfab760ef5eda50904b2c0e621d8de..fca442f408565d9c41659844fab0e75d4a98bf62 100644 --- a/features/step_definitions/aspects_steps.rb +++ b/features/step_definitions/aspects_steps.rb @@ -39,3 +39,7 @@ When /^I should see "([^"]*)" aspect unselected$/ do |aspect_name| page.has_css?("li[data-aspect_id='#{aspect.id}']:not(.active)").should be_true end end + +When /^"([^"]*)" should render with the "([^"]*)" template$/ do |post_text, template_name| + within find_post_by_text(post_text) { assert_template(template_name) } +end \ No newline at end of file diff --git a/features/step_definitions/trumpeter_steps.rb b/features/step_definitions/trumpeter_steps.rb index 96908ff5711c2ac52e8dc82b29a3cfa9762e509d..fc717ecf45f724fc661a810a36753603524c5055 100644 --- a/features/step_definitions/trumpeter_steps.rb +++ b/features/step_definitions/trumpeter_steps.rb @@ -25,18 +25,26 @@ def finalize_frame click_button "done" end +def post_div + find(".post") +end + def within_frame_preview - within ".post-view .post" do + within post_div do yield end end +def assert_template(template_name) + post_div["data-template"].should == template_name +end + When /^I trumpet$/ do visit new_post_path end When /^I write "([^"]*)"$/ do |text| - fill_in :text, :with => text + fill_in 'text', :with => text end Then /I mention "([^"]*)"$/ do |text| @@ -90,7 +98,14 @@ Then /^"([^"]*)" should have (\d+) pictures$/ do |post_text, number_of_pictures| find_post_by_text(post_text).all(".photo_attachments img").size.should == number_of_pictures.to_i end - Then /^I should see "([^"]*)" in the framer preview$/ do |post_text| within_frame_preview { page.should have_content(post_text) } +end + +When /^I select the template "([^"]*)"$/ do |template_name| + select template_name, :from => 'template' +end + +Then /^I should see an "([^"]*)" framer preview$/ do |template_name| + assert_template(template_name) end \ No newline at end of file diff --git a/features/trumpeter.feature b/features/trumpeter.feature index 8bc295765d5997f2c294b00f24bbc7f9ae94a7fe..e2ff6dc0761eaabb5d09510c89e91d3eed44d7fa 100644 --- a/features/trumpeter.feature +++ b/features/trumpeter.feature @@ -44,7 +44,10 @@ Feature: Creating a new post And I upload a fixture picture with filename "button.gif" And I start the framing process Then I should see "This is hella customized" in the framer preview + When I select the template "awesome" + Then I should see an "awesome" framer preview When I finalize my frame And I go to "/stream" Then "This is hella customized" should be post 1 + And "This is hella customized" should render with the "awesome" template diff --git a/public/javascripts/app/templates/framer.handlebars b/public/javascripts/app/templates/framer.handlebars index 0be8d4488fe02f8d7c954d09c9290c62e0329c69..ca3e884d346f737f1f9312851db95b6b0df5fa65 100644 --- a/public/javascripts/app/templates/framer.handlebars +++ b/public/javascripts/app/templates/framer.handlebars @@ -1,2 +1,5 @@ -<button class="done btn-primary">done</button> +<div class="controls"> + <div class='template-picker'></div> + <button class="done btn-primary">done</button> +</div> <div class="post-view"></div> \ No newline at end of file diff --git a/public/javascripts/app/templates/post-form.handlebars b/public/javascripts/app/templates/post-form.handlebars index 519433e646f4d03a8273ecff50e9df84688a77e3..e9f0ee4b608d895d57976bdf86b3ab50c1a31767 100644 --- a/public/javascripts/app/templates/post-form.handlebars +++ b/public/javascripts/app/templates/post-form.handlebars @@ -8,7 +8,10 @@ <legend> New Post </legend> - <textarea class="text span8"/> + <label> + text + <textarea class="text span8"/> + </label> <textarea id="text_with_markup" style="display:none;"/> <div class="aspect_selector"></div> diff --git a/public/javascripts/app/templates/template-picker.handlebars b/public/javascripts/app/templates/template-picker.handlebars new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391