diff --git a/app/assets/javascripts/app/pages/framer.js b/app/assets/javascripts/app/pages/framer.js index 1e27fe7cd..7f3c9d4dd 100644 --- a/app/assets/javascripts/app/pages/framer.js +++ b/app/assets/javascripts/app/pages/framer.js @@ -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() } }); diff --git a/app/assets/templates/profile.jst.hbs b/app/assets/templates/profile.jst.hbs index 367a019d0..64c977c85 100644 --- a/app/assets/templates/profile.jst.hbs +++ b/app/assets/templates/profile.jst.hbs @@ -49,7 +49,7 @@ {{#if is_own_profile}}
- + MAKE diff --git a/spec/javascripts/app/pages/framer_spec.js b/spec/javascripts/app/pages/framer_spec.js index a31b4afc5..6d2ee4381 100644 --- a/spec/javascripts/app/pages/framer_spec.js +++ b/spec/javascripts/app/pages/framer_spec.js @@ -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() diff --git a/spec/javascripts/app/pages/profile_spec.js b/spec/javascripts/app/pages/profile_spec.js index 1f723543f..ef1b8cee0 100644 --- a/spec/javascripts/app/pages/profile_spec.js +++ b/spec/javascripts/app/pages/profile_spec.js @@ -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(){