Going back to the composer from the framer is happy via button

This commit is contained in:
Dennis Collinson 2012-05-17 13:24:21 -07:00
parent a28c90f7b9
commit 00f1adc8b2
19 changed files with 225 additions and 192 deletions

View file

@ -31,7 +31,7 @@ app.forms.Picture = app.forms.PictureBase.extend({
templateName : "picture-form", templateName : "picture-form",
initialize : function() { initialize : function() {
this.photos = new Backbone.Collection() this.photos = this.model.photos || new Backbone.Collection()
this.photos.bind("add", this.render, this) this.photos.bind("add", this.render, this)
}, },

View file

@ -7,7 +7,7 @@ app.forms.Post = app.views.Base.extend({
}, },
initialize : function() { initialize : function() {
this.pictureForm = new app.forms.Picture(); this.pictureForm = new app.forms.Picture({model: this.model});
}, },
postRenderTemplate : function() { postRenderTemplate : function() {

View file

@ -12,16 +12,21 @@ app.pages.Composer = app.views.Base.extend({
formAttrs : { formAttrs : {
"textarea#text_with_markup" : "text", "textarea#text_with_markup" : "text",
"input.aspect_ids" : "aspect_ids", "input.aspect_ids" : "aspect_ids[]",
"input.service:checked" : "services" "input.services" : "services[]"
}, },
initialize : function(){ initialize : function(){
app.frame = this.model = new app.models.StatusMessage(); app.frame = this.model = this.model || new app.models.StatusMessage();
this.postForm = new app.forms.Post({model : this.model}); this.postForm = new app.forms.Post({model : this.model});
this.composerControls = new app.views.ComposerControls({model : this.model}); this.composerControls = new app.views.ComposerControls({model : this.model});
}, },
unbind : function(){
this.model.off()
this.model.photos.off()
},
navigateNext : function(){ navigateNext : function(){
var self = this, var self = this,
textArea = this.$("form textarea.text") textArea = this.$("form textarea.text")
@ -46,14 +51,12 @@ app.pages.Composer = app.views.Base.extend({
this.model.set({"photos": this.model.photos.toJSON() }) this.model.set({"photos": this.model.photos.toJSON() })
this.model.set(overrides) this.model.set(overrides)
function setValueFromField(memo, attribute, selector){ function setValueFromField(memo, attribute, selector){
var selectors = form.find(selector); if(attribute.slice("-2") === "[]") {
if(selectors.length > 1) { memo[attribute.slice(0, attribute.length - 2)] = _.pluck(form.find(selector).serializeArray(), "value")
memo[attribute] = _.map(selectors, function(selector){
return this.$(selector).val()
})
} else { } else {
memo[attribute] = selectors.val(); memo[attribute] = form.find(selector).val();
} }
return memo return memo
} }
@ -69,7 +72,7 @@ app.views.ComposerControls = app.views.Base.extend({
}, },
initialize : function() { initialize : function() {
this.aspectsDropdown = new app.views.AspectsDropdown(); this.aspectsDropdown = new app.views.AspectsDropdown({model : this.model});
this.servicesSelector = new app.views.ServicesSelector(); this.servicesSelector = new app.views.ServicesSelector({model : this.model});
} }
}) })

View file

@ -18,6 +18,10 @@ app.pages.Framer = app.views.Base.extend({
this.framerControls = new app.views.framerControls({model : this.model}) this.framerControls = new app.views.framerControls({model : this.model})
}, },
unbind : function(){
this.model.off()
},
postView : function(){ postView : function(){
return new app.views.SmallFrame({model : this.model}) return new app.views.SmallFrame({model : this.model})
}, },
@ -45,7 +49,8 @@ app.views.framerControls = app.views.Base.extend({
templateName : 'framer-controls', templateName : 'framer-controls',
events : { events : {
"click button.done" : "saveFrame" "click button.done" : "saveFrame",
"click button.back" : "editFrame"
}, },
subviews : { subviews : {
@ -57,8 +62,12 @@ app.views.framerControls = app.views.Base.extend({
}, },
saveFrame : function(){ saveFrame : function(){
this.$('button').prop('disabled', 'disabled') this.$('button').prop('disabled', 'disabled').addClass('disabled')
.addClass('disabled')
this.model.save() this.model.save()
},
editFrame : function(){
app.router.renderPage(function(){return new app.pages.Composer({model : app.frame})})
app.router.navigate("/posts/new")
} }
}); });

View file

@ -1,55 +1,60 @@
app.views.AspectsDropdown = app.views.Base.extend({ app.views.AspectsDropdown = app.views.Base.extend({
templateName : "aspects-dropdown", templateName : "aspects-dropdown",
events : { events : {
"click .dropdown-menu a" : "setVisibility" "change .dropdown-menu input" : "setVisibility"
},
presenter : function(){
var selectedAspects = this.model.get("aspect_ids")
, parsedIds = _.map(selectedAspects, parseInt)
return {
aspects : _.map(app.currentUser.get('aspects'), function(aspect){
return _.extend({}, aspect, {checked :_.include(parsedIds, aspect.id) })
}),
public :_.include(selectedAspects, "public"),
'all-aspects' :_.include(selectedAspects, "all_aspects")
}
}, },
postRenderTemplate : function(){ postRenderTemplate : function(){
this.setVisibility({target : this.$("a[data-visibility='public']").first()}) if(this.model.get("aspect_ids")) {
this.setDropdownText()
} else {
this.setVisibility({target : this.$("input[value='public']").first()})
}
}, },
setVisibility : function(evt){ setVisibility : function(evt){
var self = this var input = $(evt.target).closest("input")
, link = $(evt.target).closest("a")
if(_.include(['public', 'all-aspects'], link.data('visibility'))) { if(_.include(['public', 'all_aspects'], input.val())) {
deselectAll() this.$("input").attr("checked", false)
link.parents("li").addClass("selected") input.attr("checked", "checked")
self.setDropdownText(link.text())
} else { } else {
deselectOverrides() this.$("input.public, input.all_aspects").attr("checked", false)
link.parents("li").toggleClass("selected")
evt.stopImmediatePropagation(); //stop dropdown from going awaay
var selectedAspects = this.$("li.selected")
if(selectedAspects.length > 1) {
self.setDropdownText("In " + this.$("li.selected").length + " aspects")
} else {
self.setDropdownText(selectedAspects.text() || "Private")
}
} }
this.setAspectIds() this.setDropdownText()
function deselectOverrides() {
self.$("a.public, a.all-aspects").parent().removeClass("selected")
}
function deselectAll() {
self.$("li.selected").removeClass("selected")
}
}, },
setDropdownText : function(text){ setDropdownText : function(){
var selected = this.$("input").serializeArray()
, text;
switch (selected.length) {
case 0:
text = "Private"
break
case 1:
text = selected[0].name
break
default:
text = ["In", selected.length, "aspects"].join(" ")
break
}
$.trim(this.$(".dropdown-toggle .text").text(text)) $.trim(this.$(".dropdown-toggle .text").text(text))
},
setAspectIds : function(){
var selectedAspects = this.$("li.selected a")
var aspectIds = _.map(selectedAspects, function(aspect){
return $(aspect).data("aspect-id")}
)
this.$("input.aspect_ids").val(aspectIds)
} }
}) })

View file

@ -15,7 +15,16 @@ app.views.ServicesSelector = app.views.Base.extend({
], ],
presenter : function() { presenter : function() {
return _.extend(this.defaultPresenter(), {services : this.services}) var selectedServices = this.model.get('services');
return _.extend(this.defaultPresenter(), {
services :_.map(this.services, function(service){
return {
name : service,
checked :_.include(selectedServices, service)
}
})
})
}, },
askForAuth : function(evt){ askForAuth : function(evt){

View file

@ -6,7 +6,7 @@ app.views.TemplatePicker = app.views.Base.extend({
}, },
initialize : function(){ initialize : function(){
this.model.setFrameName() if(!this.model.get('frame_name')) this.model.setFrameName()
}, },
postRenderTemplate : function(){ postRenderTemplate : function(){

View file

@ -53,22 +53,20 @@
.aspect-selector { .aspect-selector {
float: left; float: left;
i { i, input {
display: none; display: none;
} }
.selected i { input:checked + label i {
display: inline-block; display: inline-block;
position: absolute; position: absolute;
left : 3px; left : 3px;
margin-top : 1px; margin-top : 1px;
} }
a { label {
display : block;
span:not(.caret) { span:not(.caret) {
padding-left: 5px; padding-left: 21px;
} }
} }
} }

View file

@ -3,14 +3,23 @@
<span class="text"></span> <span class="caret"></span> <span class="text"></span> <span class="caret"></span>
</a> </a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li><a href="#" class="public" data-aspect-id="public" data-visibility="public"><i class='icon-ok'/><span>Public</span></a></li> <form class="necessaryForJS">
<li><a href="#" class="all-aspects" data-aspect-id="all_aspects" data-visibility="all-aspects"><i class='icon-ok'/><span>All Aspects</span></a></li> <li>
<input id="aspect_ids_public" type="checkbox" name="Public" class="aspect_ids public" value="public" {{#if public}}checked="checked"{{/if}}/>
<label for="aspect_ids_public"><i class='icon-ok'/><span>Public</span></label></li>
<li>
<input id="aspect_ids_all_aspects" type="checkbox" name="All Aspects" class="aspect_ids all_aspects" value="all_aspects" {{#if all-aspects}}checked="checked"{{/if}}/>
<label for="aspect_ids_all_aspects"><i class='icon-ok'/><span>All Aspects</span></label></li>
</li>
<li class="divider"></li> <li class="divider"></li>
{{#each current_user.aspects}} {{#each aspects}}
<li><a href="#" data-aspect-id="{{id}}" data-visibility="custom"><i class='icon-ok'/><span>{{name}}</span></a></li> <li>
<input id="aspect_ids_{{id}}" type="checkbox" name="{{name}}" class="aspect_ids" value="{{id}}" {{#if checked}}checked="checked"{{/if}}/>
<label for="aspect_ids_{{id}}"><i class='icon-ok'/><span>{{name}}</span></label>
</li>
{{/each}} {{/each}}
</form>
</ul> </ul>
</div> </div>

View file

@ -1,4 +1,5 @@
<div id='controls-wrapper'> <div id='controls-wrapper'>
<div class='template-picker'></div> <div class='template-picker'></div>
<button id='back' class="back btn">Back</button>
<button id='done' class="done btn btn-success">Post <i class='icon-white icon-ok-sign'></i></button> <button id='done' class="done btn btn-success">Post <i class='icon-white icon-ok-sign'></i></button>
</div> </div>

View file

@ -4,7 +4,7 @@
<legend> <legend>
Make Something! Make Something!
</legend> </legend>
<textarea name="text" id='post_text' class="text span8" placeholder="Add Text"/> <textarea name="text" id='post_text' class="text span8" placeholder="Add Text">{{text}}</textarea>
<textarea id="text_with_markup" style="display:none;"/> <textarea id="text_with_markup" style="display:none;"/>
</fieldset> </fieldset>
</form> </form>

View file

@ -1,10 +1,9 @@
<!--*CSS MAGIC* CHECKBOX IS HIDDEN AND IS CHECKED BY CLICKING THE LABEL, CHANGE THIS AT YOUR OWN PERIL, RUN JASMINE AFTER--> <!--*CSS MAGIC* CHECKBOX IS HIDDEN AND IS CHECKED BY CLICKING THE LABEL, CHANGE THIS AT YOUR OWN PERIL, RUN JASMINE AFTER-->
<div class="magic-service-selector"> <form class="magic-service-selector">
{{#each services}} {{#each services}}
<input id="service_toggle_{{this}}" type="checkbox" name="services" class="service" value="{{this}}"/> <input id="services[{{name}}]" type="checkbox" name="services[{{name}}]" class="services" value="{{name}}" {{#if checked}}checked="checked"{{/if}}/>
<label for="service_toggle_{{this}}"> <label for="services[{{name}}]">
<img class="legacy-provider-image" src="/assets/social_media_logos/{{this}}-32x32.png" data-provider="{{this}}" data-url="/auth/{{this}}" title="Share on {{this}}" /> <img class="legacy-provider-image" src="/assets/social_media_logos/{{name}}-32x32.png" data-provider="{{name}}" data-url="/auth/{{name}}" title="Share on {{name}}" />
</label> </label>
{{/each}} {{/each}}
</div> </form>

View file

@ -156,3 +156,7 @@ end
Then /^"([^"]*)" should be the first canvas frame$/ do |post_text| Then /^"([^"]*)" should be the first canvas frame$/ do |post_text|
find(".canvas-frame").should have_content(post_text) find(".canvas-frame").should have_content(post_text)
end end
When /^I go back to the composer$/ do
click_button "Back"
end

View file

@ -51,17 +51,24 @@ Feature: Creating a new post
Then the post's default mood should be "Wallpaper" Then the post's default mood should be "Wallpaper"
Then it should be a wallpaper frame with the background "button.gif" Then it should be a wallpaper frame with the background "button.gif"
Then I should see "This is hella customized" in the framer preview 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 "button.gif" should be in the post's picture viewer
And I should see "This is hella customized" in the framer preview 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 When I finalize my frame
#on stream #on stream
Then "This is hella customized" should be the first canvas frame Then "It sure is a beautiful Day" should be the first canvas frame
When I click the "This is hella customized" post When I click the "It sure is a beautiful Day" post
#on show page #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 Scenario: The Wallpaper mood
When I write "This is a pithy status" with body "And this is a long body" When I write "This is a pithy status" with body "And this is a long body"

View file

@ -5,7 +5,7 @@ describe("app.forms.Picture", function(){
"content" : "supersecrettokenlol" "content" : "supersecrettokenlol"
}).prependTo("head") }).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(){ it("sets the authenticity token from the meta tag", function(){

View file

@ -22,29 +22,16 @@ describe("app.pages.Composer", function(){
beforeEach(function(){ beforeEach(function(){
this.page.$("form .text").val("Oh My") this.page.$("form .text").val("Oh My")
this.page.$("input.aspect_ids").val("public") this.page.$("input.aspect_ids").val("public")
this.page.$("input.services[value=facebook]").attr("checked", "checked")
/* appending checkboxes */ this.page.$("input.services[value=twitter]").attr("checked", "checked")
this.page.$(".service-selector").append($("<input/>", {
value : "fakeBook",
checked : "checked",
"class" : "service",
"type" : "checkbox"
}))
this.page.$(".service-selector").append($("<input/>", {
value : "twitter",
checked : "checked",
"class" : "service",
"type" : "checkbox"
}))
}) })
it("instantiates a post on form submit", function(){ it("instantiates a post on form submit", function(){
this.page.$("button.next").click() this.page.$("button.next").click()
waitsFor(function(){ return this.navigateSpy.wasCalled }) waitsFor(function(){ return this.navigateSpy.wasCalled })
runs(function(){ runs(function(){
expect(this.page.model.get("aspect_ids")).toBe("public") expect(this.page.model.get("aspect_ids")).toEqual(["public"])
expect(this.page.model.get("services").length).toBe(2) expect(this.page.model.get("services")).toEqual(["facebook", "twitter"])
expect(this.page.model.get("text")).toBe("Oh My") expect(this.page.model.get("text")).toBe("Oh My")
}) })
}) })

View file

@ -1,122 +1,123 @@
describe("app.views.AspectsDropdown", function(){ describe("app.views.AspectsDropdown", function () {
beforeEach(function(){ function selectedAspects(view){
return _.pluck(view.$("input.aspect_ids").serializeArray(), "value")
}
beforeEach(function () {
loginAs({ loginAs({
aspects : [ aspects:[
{ id : 3, name : "sauce" }, { id:3, name:"sauce" },
{ id : 5, name : "conf" }, { id:5, name:"conf" },
{ id : 7, name : "lovers" } { 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(){ describe("rendering", function () {
beforeEach(function(){ beforeEach(function () {
this.view.render() 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(){ it("defaults to Public Visibility", function () {
expect(this.view.$("input.aspect_ids").val()).toBe("public") expect(this.view.$("input.aspect_ids.public")).toBeChecked()
expect($.trim(this.view.$(".dropdown-toggle .text").text())).toBe("Public") expect($.trim(this.view.$(".dropdown-toggle .text").text())).toBe("Public")
}) })
describe("selecting Public", function(){ it("sets aspect_ids to 'public'", function () {
beforeEach(function(){ expect(selectedAspects(this.view)).toEqual(["public"])
this.link = this.view.$("a[data-visibility='public']")
this.link.click()
}) })
it("sets aspect_ids to 'public'", function(){ it("sets the dropdown title 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") expect(this.view.$(".dropdown-toggle .text").text()).toBe("Public")
}) })
it("adds the selected class to the link", function(){ describe("setVisibility", function () {
expect(this.link.parent().hasClass("selected")).toBeTruthy(); function checkInput(input){
}) input.attr("checked", "checked")
input.trigger("change")
}
function uncheckInput(input){
input.attr("checked", false)
input.trigger("change")
}
describe("selecting All Aspects", function () {
beforeEach(function () {
this.input = this.view.$("input#aspect_ids_all_aspects")
checkInput(this.input)
}) })
describe("selecting All Aspects", function(){ it("calls set aspect_ids to 'all'", function () {
beforeEach(function(){ expect(selectedAspects(this.view)).toEqual(["all_aspects"])
this.link = this.view.$("a[data-visibility='all-aspects']")
this.link.click()
}) })
it("calls set aspect_ids to 'all'", function(){ it("sets the dropdown title to 'public'", 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") 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();
})
}) })
describe("selecting An Aspect", function () {
describe("selecting An Aspect", function(){ beforeEach(function () {
beforeEach(function(){ this.input = this.view.$("input[name='lovers']")
this.link = this.view.$("a:contains('lovers')") checkInput(this.input)
this.link.click()
}) })
it("sets the dropdown title to the aspect title", function(){ it("sets the dropdown title to the aspect title", function () {
expect($.trim(this.view.$(".dropdown-toggle .text").text())).toBe("lovers") expect($.trim(this.view.$(".dropdown-toggle .text").text())).toBe("lovers")
}) })
it("adds the selected class to the link", function(){ it("sets aspect_ids to to the aspect id", function () {
expect(this.link.parent().hasClass("selected")).toBeTruthy(); expect(selectedAspects(this.view)).toEqual(["7"])
}) })
it("sets aspect_ids to to the aspect id", function(){ describe("selecting another aspect", function () {
expect(this.view.$("input.aspect_ids").val()).toBe("7") beforeEach(function () {
this.input = this.view.$("input[name='sauce']")
checkInput(this.input)
}) })
describe("selecting another aspect", function(){ it("sets aspect_ids to the selected aspects", function () {
beforeEach(function(){ expect(selectedAspects(this.view)).toEqual(["3", "7"])
this.view.$("a:contains('sauce')").click()
}) })
it("sets aspect_ids to the selected aspects", function(){ it("sets the button text to the number of selected aspects", function () {
expect(this.view.$("input.aspect_ids").val()).toBe("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") expect($.trim(this.view.$(".dropdown-toggle .text").text())).toBe("In 2 aspects")
this.view.$("a:contains('conf')").click() checkInput(this.view.$("input[name='conf']"))
expect($.trim(this.view.$(".dropdown-toggle .text").text())).toBe("In 3 aspects") expect($.trim(this.view.$(".dropdown-toggle .text").text())).toBe("In 3 aspects")
this.view.$("a:contains('conf')").click() uncheckInput(this.view.$("input[name='conf']"))
expect($.trim(this.view.$(".dropdown-toggle .text").text())).toBe("In 2 aspects") expect($.trim(this.view.$(".dropdown-toggle .text").text())).toBe("In 2 aspects")
}) })
describe("deselecting another aspect", function(){ describe("deselecting another aspect", function () {
it("removes the clicked aspect", function(){ it("removes the clicked aspect", function () {
expect(this.view.$("input.aspect_ids").val()).toBe("3,7") expect(selectedAspects(this.view)).toEqual(["3", "7"])
expect($.trim(this.view.$(".dropdown-toggle .text").text())).toBe("In 2 aspects") expect($.trim(this.view.$(".dropdown-toggle .text").text())).toBe("In 2 aspects")
this.view.$("a:contains('lovers')").click() uncheckInput(this.view.$("input[name='lovers']"))
expect(this.view.$("input.aspect_ids").val()).toBe("3") expect(selectedAspects(this.view)).toEqual(["3"])
expect($.trim(this.view.$(".dropdown-toggle .text").text())).toBe("sauce") expect($.trim(this.view.$(".dropdown-toggle .text").text())).toBe("sauce")
}) })
}) })
describe("selecting all_aspects", function(){ describe("selecting all_aspects", function () {
it("sets aspect_ids to all_aspects", function(){ it("sets aspect_ids to all_aspects", function () {
this.view.$("a[data-visibility='all-aspects']").click() expect(selectedAspects(this.view)).toEqual(["3", "7"])
expect(this.view.$("input.aspect_ids").val()).toBe("all_aspects") checkInput(this.view.$("input[name='All Aspects']"))
expect(selectedAspects(this.view)).toEqual(["all_aspects"])
}) })
}) })
describe("selecting public", function(){ describe("selecting public", function () {
it("sets aspect_ids to public", function(){ it("sets aspect_ids to public", function () {
this.view.$("a[data-visibility='public']").click() expect(selectedAspects(this.view)).toEqual(["3", "7"])
expect(this.view.$("input.aspect_ids").val()).toBe("public") checkInput(this.view.$("input[name='Public']"))
expect(selectedAspects(this.view)).toEqual(["public"])
})
}) })
}) })
}) })

View file

@ -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(){ describe("rendering", function(){
@ -23,10 +23,10 @@ describe("app.views.ServicesSelector", function(){
// this tests the crazy css we have in a bassackwards way // 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. // 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(){ 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() 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();
}); });
}); });

View file

@ -5,8 +5,9 @@ describe("app.views.TemplatePicker", function(){
}) })
describe("initialization", 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') spyOn(this.model, 'setFrameName')
this.model.unset("frame_name")
new app.views.TemplatePicker({model:this.model}) new app.views.TemplatePicker({model:this.model})
expect(this.model.setFrameName).toHaveBeenCalled() expect(this.model.setFrameName).toHaveBeenCalled()
}) })