backfill some tests; jasmine green
This commit is contained in:
parent
3cdc2fc03b
commit
c8aa67360b
4 changed files with 63 additions and 12 deletions
|
|
@ -23,13 +23,21 @@ app.pages.Framer = app.views.Base.extend({
|
|||
},
|
||||
|
||||
navigateNext : function(){
|
||||
if(parent.location.pathname == '/new_bookmarklet'){
|
||||
parent.close()
|
||||
if(parent.location.pathname == '/new_bookmarklet') {
|
||||
this.bookmarkletNavigation()
|
||||
} else {
|
||||
var url = app.currentUser.expProfileUrl()
|
||||
// app.router.navigate(url, {trigger: true, replace: true})
|
||||
//window.location = app.currentUser.expProfileUrl();
|
||||
this.defaultNavigation()
|
||||
}
|
||||
},
|
||||
|
||||
bookmarkletNavigation : function() {
|
||||
parent.close()
|
||||
},
|
||||
|
||||
defaultNavigation : function() {
|
||||
var url = app.currentUser.expProfileUrl()
|
||||
app.router.navigate(url, {trigger: true, replace: true})
|
||||
//window.location = app.currentUser.expProfileUrl()
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@
|
|||
{{#if is_own_profile}}
|
||||
<div id="composer" class="hidden"></div>
|
||||
|
||||
<a href="#composer" id="composer-button" class="control small label label-inverse">
|
||||
<a href="#" id="composer-button" class="control small label label-inverse">
|
||||
MAKE
|
||||
</a>
|
||||
<a href="#" id="edit-mode-toggle" class="control small label label-inverse" title="Edit Posts" rel="tooltip">
|
||||
|
|
|
|||
|
|
@ -9,6 +9,16 @@ describe("app.pages.Framer", function(){
|
|||
expect(this.page.postView().model).toBe(app.frame)
|
||||
});
|
||||
|
||||
describe("navigation on save", function(){
|
||||
it("navigates to the current user's profile page", function(){
|
||||
spyOn(app.router, "navigate")
|
||||
this.page.model.trigger("sync")
|
||||
expect(app.router.navigate).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
// want a spec here for the bookmarklet case
|
||||
})
|
||||
|
||||
describe("rendering", function(){
|
||||
beforeEach(function(){
|
||||
this.page.render();
|
||||
|
|
@ -20,12 +30,6 @@ describe("app.pages.Framer", function(){
|
|||
expect(app.frame.save).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("calls navigateNext on save", function(){
|
||||
spyOn(this.page, "navigateNext")
|
||||
this.page.model.trigger("sync")
|
||||
expect(this.page.navigateNext).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it("makes and renders a new smallFrame when the template is changed", function(){
|
||||
expect(app.frame.get("frame_name")).not.toBe("night") //pre conditions, yo
|
||||
this.page.$("a.mood[data-mood=Night]").click()
|
||||
|
|
|
|||
|
|
@ -132,6 +132,45 @@ describe("app.pages.Profile", function(){
|
|||
})
|
||||
})
|
||||
|
||||
describe("composing", function(){
|
||||
beforeEach(function(){
|
||||
this.page.model.set({is_own_profile : true})
|
||||
this.page.render()
|
||||
|
||||
/* stub navigation changes */
|
||||
spyOn(app.router, "navigate")
|
||||
})
|
||||
|
||||
describe("invoking the interaction", function(){
|
||||
it("shows the publisher and disables the body from scrolling", function(){
|
||||
expect(this.page.$("#composer")).toHaveClass('hidden')
|
||||
this.page.$("#composer-button").click()
|
||||
expect(this.page.$("#composer")).not.toHaveClass('hidden')
|
||||
expect($("body")).toHaveClass('lock')
|
||||
})
|
||||
|
||||
it("changes the URL", function(){
|
||||
this.page.$("#composer-button").click()
|
||||
expect(app.router.navigate).toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
|
||||
describe("revoking the interaction", function(){
|
||||
beforeEach(function(){
|
||||
/* invoke the composer */
|
||||
this.page.$("#composer-button").click()
|
||||
|
||||
this.evt = Event
|
||||
this.evt.keyCode = 28
|
||||
})
|
||||
|
||||
it("changes the URL", function(){
|
||||
$(window).trigger("keydown", this.evt)
|
||||
expect(app.router.navigate).toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
});
|
||||
|
||||
describe("followingEnabled", function(){
|
||||
/* for legacy beta testers */
|
||||
it("returns false if following_count is zero", function(){
|
||||
|
|
|
|||
Loading…
Reference in a new issue