\ No newline at end of file
diff --git a/app/assets/templates/post-form.jst.hbs b/app/assets/templates/post-form.jst.hbs
index b1d1d1571..aa0857dcf 100644
--- a/app/assets/templates/post-form.jst.hbs
+++ b/app/assets/templates/post-form.jst.hbs
@@ -4,7 +4,7 @@
-
+
diff --git a/app/assets/templates/services-selector.jst.hbs b/app/assets/templates/services-selector.jst.hbs
index 34ea91b0f..59540451d 100644
--- a/app/assets/templates/services-selector.jst.hbs
+++ b/app/assets/templates/services-selector.jst.hbs
@@ -1,10 +1,9 @@
-
+
-
+
diff --git a/features/step_definitions/trumpeter_steps.rb b/features/step_definitions/trumpeter_steps.rb
index 6aedd13a8..badebb462 100644
--- a/features/step_definitions/trumpeter_steps.rb
+++ b/features/step_definitions/trumpeter_steps.rb
@@ -155,4 +155,8 @@ end
Then /^"([^"]*)" should be the first canvas frame$/ do |post_text|
find(".canvas-frame").should have_content(post_text)
-end
\ No newline at end of file
+end
+
+When /^I go back to the composer$/ do
+ click_button "Back"
+end
\ No newline at end of file
diff --git a/features/trumpeter.feature b/features/trumpeter.feature
index 634171b9c..1e7db9547 100644
--- a/features/trumpeter.feature
+++ b/features/trumpeter.feature
@@ -51,17 +51,24 @@ Feature: Creating a new post
Then the post's default mood should be "Wallpaper"
Then it should be a wallpaper frame with the background "button.gif"
Then I should see "This is hella customized" in the framer preview
- When I select the mood "Day"
- Then the post's mood should be "Day"
+
+ When I select the mood "Newspaper"
+ Then the post's mood should be "Newspaper"
And "button.gif" should be in the post's picture viewer
And I should see "This is hella customized" in the framer preview
+ And I go back to the composer
+ And I write "It sure is a beautiful Day"
+ And I start the framing process
+ Then the post's mood should be "Newspaper"
+ And I should see "It sure is a beautiful Day" in the framer preview
+
When I finalize my frame
#on stream
- Then "This is hella customized" should be the first canvas frame
- When I click the "This is hella customized" post
+ Then "It sure is a beautiful Day" should be the first canvas frame
+ When I click the "It sure is a beautiful Day" post
#on show page
- And the post's mood should still be "Day"
+ And the post's mood should still be "Newspaper"
Scenario: The Wallpaper mood
When I write "This is a pithy status" with body "And this is a long body"
diff --git a/spec/javascripts/app/forms/picture_form_spec.js b/spec/javascripts/app/forms/picture_form_spec.js
index 3d1abe557..21a95ff83 100644
--- a/spec/javascripts/app/forms/picture_form_spec.js
+++ b/spec/javascripts/app/forms/picture_form_spec.js
@@ -5,7 +5,7 @@ describe("app.forms.Picture", function(){
"content" : "supersecrettokenlol"
}).prependTo("head")
- this.form = new app.forms.Picture().render()
+ this.form = new app.forms.Picture({model: factory.statusMessage()}).render()
});
it("sets the authenticity token from the meta tag", function(){
diff --git a/spec/javascripts/app/pages/composer_spec.js b/spec/javascripts/app/pages/composer_spec.js
index 438c5abc6..c1b59eca7 100644
--- a/spec/javascripts/app/pages/composer_spec.js
+++ b/spec/javascripts/app/pages/composer_spec.js
@@ -22,29 +22,16 @@ describe("app.pages.Composer", function(){
beforeEach(function(){
this.page.$("form .text").val("Oh My")
this.page.$("input.aspect_ids").val("public")
-
- /* appending checkboxes */
- this.page.$(".service-selector").append($("", {
- value : "fakeBook",
- checked : "checked",
- "class" : "service",
- "type" : "checkbox"
- }))
-
- this.page.$(".service-selector").append($("", {
- value : "twitter",
- checked : "checked",
- "class" : "service",
- "type" : "checkbox"
- }))
+ this.page.$("input.services[value=facebook]").attr("checked", "checked")
+ this.page.$("input.services[value=twitter]").attr("checked", "checked")
})
it("instantiates a post on form submit", function(){
this.page.$("button.next").click()
waitsFor(function(){ return this.navigateSpy.wasCalled })
runs(function(){
- expect(this.page.model.get("aspect_ids")).toBe("public")
- expect(this.page.model.get("services").length).toBe(2)
+ expect(this.page.model.get("aspect_ids")).toEqual(["public"])
+ expect(this.page.model.get("services")).toEqual(["facebook", "twitter"])
expect(this.page.model.get("text")).toBe("Oh My")
})
})
diff --git a/spec/javascripts/app/views/aspects_dropdown_view_spec.js b/spec/javascripts/app/views/aspects_dropdown_view_spec.js
index c8b649240..b1a43a66d 100644
--- a/spec/javascripts/app/views/aspects_dropdown_view_spec.js
+++ b/spec/javascripts/app/views/aspects_dropdown_view_spec.js
@@ -1,122 +1,123 @@
-describe("app.views.AspectsDropdown", function(){
- beforeEach(function(){
+describe("app.views.AspectsDropdown", function () {
+ function selectedAspects(view){
+ return _.pluck(view.$("input.aspect_ids").serializeArray(), "value")
+ }
+
+ beforeEach(function () {
loginAs({
- aspects : [
- { id : 3, name : "sauce" },
- { id : 5, name : "conf" },
- { id : 7, name : "lovers" }
+ aspects:[
+ { id:3, name:"sauce" },
+ { id:5, name:"conf" },
+ { id:7, name:"lovers" }
]
})
- this.view = new app.views.AspectsDropdown
+ this.view = new app.views.AspectsDropdown({model:factory.statusMessage({aspect_ids:undefined})})
})
- describe("rendering", function(){
- beforeEach(function(){
+ describe("rendering", function () {
+ beforeEach(function () {
this.view.render()
})
+ it("sets aspect_ids to 'public' by default", function () {
+ expect(this.view.$("input.aspect_ids:checked").val()).toBe("public")
+ })
- it("defaults to Public Visibility", function(){
- expect(this.view.$("input.aspect_ids").val()).toBe("public")
+ it("defaults to Public Visibility", function () {
+ expect(this.view.$("input.aspect_ids.public")).toBeChecked()
expect($.trim(this.view.$(".dropdown-toggle .text").text())).toBe("Public")
})
- describe("selecting Public", function(){
- beforeEach(function(){
- this.link = this.view.$("a[data-visibility='public']")
- this.link.click()
- })
-
- it("sets aspect_ids to 'public'", function(){
- expect(this.view.$("input.aspect_ids").val()).toBe("public")
- })
-
- it("sets the dropdown title to 'public'", function(){
- expect(this.view.$(".dropdown-toggle .text").text()).toBe("Public")
- })
-
- it("adds the selected class to the link", function(){
- expect(this.link.parent().hasClass("selected")).toBeTruthy();
- })
+ it("sets aspect_ids to 'public'", function () {
+ expect(selectedAspects(this.view)).toEqual(["public"])
})
- describe("selecting All Aspects", function(){
- beforeEach(function(){
- this.link = this.view.$("a[data-visibility='all-aspects']")
- this.link.click()
- })
-
- it("calls set aspect_ids to 'all'", function(){
- expect(this.view.$("input.aspect_ids").val()).toBe("all_aspects")
- })
-
- it("sets the dropdown title to 'public'", function(){
- expect($.trim(this.view.$(".dropdown-toggle .text").text())).toBe("All Aspects")
- })
-
- it("adds the selected class to the link", function(){
- expect(this.link.parent().hasClass("selected")).toBeTruthy();
- })
+ it("sets the dropdown title to 'public'", function () {
+ expect(this.view.$(".dropdown-toggle .text").text()).toBe("Public")
})
+ describe("setVisibility", function () {
+ function checkInput(input){
+ input.attr("checked", "checked")
+ input.trigger("change")
+ }
- describe("selecting An Aspect", function(){
- beforeEach(function(){
- this.link = this.view.$("a:contains('lovers')")
- this.link.click()
- })
+ function uncheckInput(input){
+ input.attr("checked", false)
+ input.trigger("change")
+ }
- it("sets the dropdown title to the aspect title", function(){
- expect($.trim(this.view.$(".dropdown-toggle .text").text())).toBe("lovers")
- })
-
- it("adds the selected class to the link", function(){
- expect(this.link.parent().hasClass("selected")).toBeTruthy();
- })
-
- it("sets aspect_ids to to the aspect id", function(){
- expect(this.view.$("input.aspect_ids").val()).toBe("7")
- })
-
- describe("selecting another aspect", function(){
- beforeEach(function(){
- this.view.$("a:contains('sauce')").click()
+ describe("selecting All Aspects", function () {
+ beforeEach(function () {
+ this.input = this.view.$("input#aspect_ids_all_aspects")
+ checkInput(this.input)
})
- it("sets aspect_ids to the selected aspects", function(){
- expect(this.view.$("input.aspect_ids").val()).toBe("3,7")
+ it("calls set aspect_ids to 'all'", function () {
+ expect(selectedAspects(this.view)).toEqual(["all_aspects"])
})
- it("sets the button text to the number of selected aspects", function(){
- expect($.trim(this.view.$(".dropdown-toggle .text").text())).toBe("In 2 aspects")
- this.view.$("a:contains('conf')").click()
- expect($.trim(this.view.$(".dropdown-toggle .text").text())).toBe("In 3 aspects")
- this.view.$("a:contains('conf')").click()
- expect($.trim(this.view.$(".dropdown-toggle .text").text())).toBe("In 2 aspects")
+ it("sets the dropdown title to 'public'", function () {
+ expect($.trim(this.view.$(".dropdown-toggle .text").text())).toBe("All Aspects")
+ })
+ })
+ describe("selecting An Aspect", function () {
+ beforeEach(function () {
+ this.input = this.view.$("input[name='lovers']")
+ checkInput(this.input)
})
- describe("deselecting another aspect", function(){
- it("removes the clicked aspect", function(){
- expect(this.view.$("input.aspect_ids").val()).toBe("3,7")
+ it("sets the dropdown title to the aspect title", function () {
+ expect($.trim(this.view.$(".dropdown-toggle .text").text())).toBe("lovers")
+ })
+
+ it("sets aspect_ids to to the aspect id", function () {
+ expect(selectedAspects(this.view)).toEqual(["7"])
+ })
+
+ describe("selecting another aspect", function () {
+ beforeEach(function () {
+ this.input = this.view.$("input[name='sauce']")
+ checkInput(this.input)
+ })
+
+ it("sets aspect_ids to the selected aspects", function () {
+ expect(selectedAspects(this.view)).toEqual(["3", "7"])
+ })
+
+ it("sets the button text to the number of selected aspects", function () {
+ expect($.trim(this.view.$(".dropdown-toggle .text").text())).toBe("In 2 aspects")
+ checkInput(this.view.$("input[name='conf']"))
+ expect($.trim(this.view.$(".dropdown-toggle .text").text())).toBe("In 3 aspects")
+ uncheckInput(this.view.$("input[name='conf']"))
expect($.trim(this.view.$(".dropdown-toggle .text").text())).toBe("In 2 aspects")
- this.view.$("a:contains('lovers')").click()
- expect(this.view.$("input.aspect_ids").val()).toBe("3")
- expect($.trim(this.view.$(".dropdown-toggle .text").text())).toBe("sauce")
})
- })
- describe("selecting all_aspects", function(){
- it("sets aspect_ids to all_aspects", function(){
- this.view.$("a[data-visibility='all-aspects']").click()
- expect(this.view.$("input.aspect_ids").val()).toBe("all_aspects")
+ describe("deselecting another aspect", function () {
+ it("removes the clicked aspect", function () {
+ expect(selectedAspects(this.view)).toEqual(["3", "7"])
+ expect($.trim(this.view.$(".dropdown-toggle .text").text())).toBe("In 2 aspects")
+ uncheckInput(this.view.$("input[name='lovers']"))
+ expect(selectedAspects(this.view)).toEqual(["3"])
+ expect($.trim(this.view.$(".dropdown-toggle .text").text())).toBe("sauce")
+ })
})
- })
- describe("selecting public", function(){
- it("sets aspect_ids to public", function(){
- this.view.$("a[data-visibility='public']").click()
- expect(this.view.$("input.aspect_ids").val()).toBe("public")
+ describe("selecting all_aspects", function () {
+ it("sets aspect_ids to all_aspects", function () {
+ expect(selectedAspects(this.view)).toEqual(["3", "7"])
+ checkInput(this.view.$("input[name='All Aspects']"))
+ expect(selectedAspects(this.view)).toEqual(["all_aspects"])
+ })
+ })
+
+ describe("selecting public", function () {
+ it("sets aspect_ids to public", function () {
+ expect(selectedAspects(this.view)).toEqual(["3", "7"])
+ checkInput(this.view.$("input[name='Public']"))
+ expect(selectedAspects(this.view)).toEqual(["public"])
+ })
})
})
})
diff --git a/spec/javascripts/app/views/services_selector_view_spec.js b/spec/javascripts/app/views/services_selector_view_spec.js
index 93b8f4328..2857825d2 100644
--- a/spec/javascripts/app/views/services_selector_view_spec.js
+++ b/spec/javascripts/app/views/services_selector_view_spec.js
@@ -6,7 +6,7 @@ describe("app.views.ServicesSelector", function(){
]
});
- this.view = new app.views.ServicesSelector();
+ this.view = new app.views.ServicesSelector({model : factory.statusMessage()});
});
describe("rendering", function(){
@@ -23,10 +23,10 @@ describe("app.views.ServicesSelector", function(){
// this tests the crazy css we have in a bassackwards way
// check out toggling the services on the new publisher and make sure it works if you change stuff.
it("selects the checkbox when the image is clicked", function(){
- expect($("label[for=service_toggle_facebook] img").is(".magic-service-selector input:not(:checked) + label img")).toBeTruthy();
+ expect($("label[for='services[facebook]'] img").is(".magic-service-selector input:not(:checked) + label img")).toBeTruthy();
this.view.$("input[value='facebook']").select()
- expect($("label[for=service_toggle_facebook] img").is(".magic-service-selector input:not(:checked) + label img")).toBeFalsy();
+ expect($("label[for='services[facebook]'] img").is(".magic-service-selector input:not(:checked) + label img")).toBeFalsy();
});
});
diff --git a/spec/javascripts/app/views/template_picker_view_spec.js b/spec/javascripts/app/views/template_picker_view_spec.js
index 0481f70b2..fe015d216 100644
--- a/spec/javascripts/app/views/template_picker_view_spec.js
+++ b/spec/javascripts/app/views/template_picker_view_spec.js
@@ -5,8 +5,9 @@ describe("app.views.TemplatePicker", function(){
})
describe("initialization", function(){
- it("calls setFrameName on the model", function(){
+ it("calls setFrameName on the model when there is no frame_name", function(){
spyOn(this.model, 'setFrameName')
+ this.model.unset("frame_name")
new app.views.TemplatePicker({model:this.model})
expect(this.model.setFrameName).toHaveBeenCalled()
})