upgrade backbone, fix tests
some cukes may be failing non deterministically, I think, do we bump the cuke timeout?
This commit is contained in:
parent
fb946bd407
commit
3bc3f13651
17 changed files with 763 additions and 466 deletions
|
|
@ -1,7 +1,11 @@
|
|||
app.collections.Comments = Backbone.Collection.extend({
|
||||
model: app.models.Comment,
|
||||
|
||||
url : function(){
|
||||
return this.post.url() + "/comments"
|
||||
},
|
||||
|
||||
initialize : function(models, options) {
|
||||
this.url = "/posts/" + options.post.id + "/comments" //not delegating to post.url() because when it is in a stream collection it delegates to that url
|
||||
this.post = options.post
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -91,6 +91,20 @@ app.models.Post = Backbone.Model.extend({
|
|||
}});
|
||||
},
|
||||
|
||||
comment : function (text) {
|
||||
|
||||
var self = this
|
||||
, postComments = this.comments;
|
||||
|
||||
postComments.create({"text": text}, {
|
||||
url : postComments.url(),
|
||||
wait:true, // added a wait for the time being. 0.5.3 was not optimistic, but 0.9.2 is.
|
||||
error:function () {
|
||||
alert(Diaspora.I18n.t("failed_to_post_message"));
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
headline : function() {
|
||||
var headline = this.get("text").trim()
|
||||
, newlineIdx = headline.lastIndexOf("\n")
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@ app.pages.PostViewer = app.views.Base.extend({
|
|||
|
||||
postRenderTemplate : function() {
|
||||
/* set the document title */
|
||||
console.log(this.model)
|
||||
document.title = this.model.get("title");
|
||||
|
||||
this.bindNavHooks();
|
||||
|
|
|
|||
|
|
@ -6,7 +6,9 @@ app.Router = Backbone.Router.extend({
|
|||
"participate": "stream",
|
||||
"explore": "stream",
|
||||
|
||||
"aspects": "stream",
|
||||
"aspects:query": "stream",
|
||||
|
||||
"commented": "stream",
|
||||
"liked": "stream",
|
||||
"mentions": "stream",
|
||||
|
|
|
|||
|
|
@ -38,15 +38,7 @@ app.views.CommentStream = app.views.Base.extend({
|
|||
|
||||
createComment: function(evt) {
|
||||
if(evt){ evt.preventDefault(); }
|
||||
|
||||
this.model.comments.create({
|
||||
"text" : this.$(".comment_box").val()
|
||||
}, {
|
||||
error: function() {
|
||||
alert(Diaspora.I18n.t("failed_to_post_message"));
|
||||
}
|
||||
});
|
||||
|
||||
this.model.comment(this.$(".comment_box").val());
|
||||
this.$(".comment_box").val("")
|
||||
return this;
|
||||
},
|
||||
|
|
|
|||
|
|
@ -9,6 +9,10 @@ app.views.PostViewerNewComment = app.views.Base.extend({
|
|||
|
||||
scrollableArea : "#post-reactions",
|
||||
|
||||
initialize : function(){
|
||||
this.model.comments.bind("sync", this.clearAndReactivateForm, this)
|
||||
},
|
||||
|
||||
postRenderTemplate : function() {
|
||||
this.$("textarea").placeholder();
|
||||
this.$("textarea").autoResize({'extraSpace' : 0});
|
||||
|
|
@ -16,14 +20,8 @@ app.views.PostViewerNewComment = app.views.Base.extend({
|
|||
|
||||
createComment: function(evt) {
|
||||
if(evt){ evt.preventDefault(); }
|
||||
|
||||
var self = this;
|
||||
|
||||
this.toggleFormState()
|
||||
this.model.comments.create({
|
||||
"text" : this.$("textarea").val()
|
||||
}, {success : _.bind(self.clearAndReactivateForm, self)});
|
||||
|
||||
this.model.comment(this.$("textarea").val());
|
||||
},
|
||||
|
||||
clearAndReactivateForm : function() {
|
||||
|
|
|
|||
|
|
@ -5,8 +5,11 @@ Feature: The activity stream
|
|||
When I sign in as "bob@bob.bob"
|
||||
|
||||
And I post "A- I like turtles"
|
||||
And I wait for 1 second
|
||||
And I post "B- barack obama is your new bicycle"
|
||||
And I wait for 1 second
|
||||
And I post "C- barack obama is a square"
|
||||
And I wait for 1 second
|
||||
|
||||
When I go to the activity stream page
|
||||
Then "C- barack obama is a square" should be post 1
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ Feature: following and being followed
|
|||
And I am on "bob@bob.bob"'s page
|
||||
|
||||
And I add the person to my "Besties" aspect
|
||||
And I wait for the ajax to finish
|
||||
And I add the person to my "Unicorns" aspect
|
||||
|
||||
When I go to the home page
|
||||
|
|
|
|||
|
|
@ -17,12 +17,12 @@ Feature: posting from the main page
|
|||
|
||||
Scenario: post a text-only message to all aspects
|
||||
Given I expand the publisher
|
||||
When I fill in "status_message_fake_text" with "I am eating a yogurt"
|
||||
When I fill in "status_message_fake_text" with "I am eating yogurt"
|
||||
And I press "Share"
|
||||
And I wait for the ajax to finish
|
||||
|
||||
And I go to the aspects page
|
||||
Then I should see "I am eating a yogurt" within ".stream_element"
|
||||
Then "I am eating yogurt" should be post 1
|
||||
|
||||
Scenario: posting a message appends it to the top of the stream
|
||||
When I click the publisher and post "sup dog"
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ Then /^I like the post "([^"]*)"$/ do |post_text|
|
|||
end
|
||||
|
||||
Then /^"([^"]*)" should be post (\d+)$/ do |post_text, position|
|
||||
find(".stream_element:nth-child(#{position}) .post-content").text.should == post_text
|
||||
stream_element_numbers_content(position).text.should == post_text
|
||||
end
|
||||
|
||||
When /^I toggle nsfw posts$/ do
|
||||
|
|
|
|||
|
|
@ -99,11 +99,10 @@ Then /^I should have (\d) contacts? in "([^"]*)"$/ do |n_contacts, aspect_name|
|
|||
end
|
||||
|
||||
When /^I (?:add|remove) the person (?:to|from) my "([^\"]*)" aspect$/ do |aspect_name|
|
||||
steps %Q{
|
||||
And I press the first ".toggle.button"
|
||||
And I click on selector ".dropdown.active .dropdown_list li[data-aspect_id=#{@me.aspects.where(:name => aspect_name).first.id}]"
|
||||
And I press the first ".toggle.button"
|
||||
}
|
||||
aspects_dropdown = find(".aspect_membership .toggle.button:first")
|
||||
aspects_dropdown.click
|
||||
find(".dropdown.active .dropdown_list li:contains('#{aspect_name}')").click
|
||||
aspects_dropdown.click
|
||||
end
|
||||
|
||||
When /^I post a status with the text "([^\"]*)"$/ do |text|
|
||||
|
|
|
|||
|
|
@ -65,6 +65,13 @@ Spork.prefork do
|
|||
require File.join(File.dirname(__FILE__), "..", "..", "spec", "support", "fake_resque")
|
||||
|
||||
require File.join(File.dirname(__FILE__), 'run_resque_in_process')
|
||||
|
||||
#hax to get rubymine to run spork, set RUBYMINE_HOME in your .bash_profile
|
||||
if ENV["RUBYMINE_HOME"]
|
||||
puts "Loading rubymine spork extensions"
|
||||
$:.unshift(File.expand_path("rb/testing/patch/common", ENV["RUBYMINE_HOME"]))
|
||||
$:.unshift(File.expand_path("rb/testing/patch/bdd", ENV["RUBYMINE_HOME"]))
|
||||
end
|
||||
end
|
||||
|
||||
Spork.each_run do
|
||||
|
|
|
|||
|
|
@ -34,7 +34,11 @@ module PublishingCukeHelpers
|
|||
end
|
||||
|
||||
def first_post_text
|
||||
find('.stream_element:first .post-content').text()
|
||||
stream_element_numbers_content(1).text()
|
||||
end
|
||||
|
||||
def stream_element_numbers_content(position)
|
||||
find(".stream_element:nth-child(#{position}) .post-content")
|
||||
end
|
||||
|
||||
def find_post_by_text(text)
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ describe("app.collections.comments", function(){
|
|||
it("should user the post id", function(){
|
||||
var post =new app.models.Post({id : 5})
|
||||
var collection = new app.collections.Comments([], {post : post})
|
||||
expect(collection.url).toBe("/posts/5/comments")
|
||||
expect(collection.url()).toBe("/posts/5/comments")
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
describe("app.views.AspectsDropdown", function(){
|
||||
beforeEach(function(){
|
||||
loginAs(factory.user({
|
||||
loginAs({
|
||||
aspects : [
|
||||
{ id : 3, name : "sauce" },
|
||||
{ id : 5, name : "conf" },
|
||||
{ id : 7, name : "lovers" }
|
||||
]
|
||||
}))
|
||||
})
|
||||
|
||||
this.view = new app.views.AspectsDropdown
|
||||
})
|
||||
|
|
@ -62,7 +62,9 @@ describe("app.views.AspectsDropdown", function(){
|
|||
|
||||
describe("selecting An Aspect", function(){
|
||||
beforeEach(function(){
|
||||
|
||||
this.link = this.view.$("a:contains('lovers')")
|
||||
console.log(app.currentUser.get("aspects"), $("a:contains('lovers')", this.view.el))
|
||||
this.link.click()
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
describe("app.views.ServicesSelector", function(){
|
||||
beforeEach(function(){
|
||||
loginAs(factory.user({
|
||||
loginAs({
|
||||
services : [
|
||||
{ provider : "fakeBook" }
|
||||
]
|
||||
}));
|
||||
});
|
||||
|
||||
this.view = new app.views.ServicesSelector();
|
||||
});
|
||||
|
|
@ -16,7 +16,6 @@ describe("app.views.ServicesSelector", function(){
|
|||
|
||||
it("displays all services", function(){
|
||||
var checkboxes = $(this.view.el).find('input[type="checkbox"]');
|
||||
|
||||
expect(checkboxes.val()).toBe("fakeBook");
|
||||
});
|
||||
});
|
||||
|
|
|
|||
1139
vendor/assets/javascripts/backbone.js
vendored
1139
vendor/assets/javascripts/backbone.js
vendored
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue