can mention in new composer
This commit is contained in:
parent
400bfd19d8
commit
20da08408f
5 changed files with 41 additions and 33 deletions
|
|
@ -11,19 +11,7 @@ app.forms.Post = app.views.Base.extend({
|
|||
},
|
||||
|
||||
postRenderTemplate : function() {
|
||||
//this.prepAndBindMentions()
|
||||
},
|
||||
|
||||
prepAndBindMentions : function(){
|
||||
Mentions.initialize(this.$("textarea.text"));
|
||||
Mentions.fetchContacts();
|
||||
|
||||
this.$("textarea.text").bind("textchange", $.proxy(this.updateTextWithMarkup, this))
|
||||
},
|
||||
|
||||
updateTextWithMarkup : function() {
|
||||
this.$("form textarea.text").mentionsInput('val', function(markup){
|
||||
$('#text_with_markup').val(markup);
|
||||
});
|
||||
Mentions.fetchContacts(); //mentions should use app.currentUser
|
||||
}
|
||||
});
|
||||
|
|
@ -11,8 +11,7 @@ app.pages.Composer = app.views.Base.extend({
|
|||
},
|
||||
|
||||
formAttrs : {
|
||||
// "textarea#text_with_markup" : "text", //fix mentions
|
||||
"textarea.text" : "text",
|
||||
"textarea#text_with_markup" : "text",
|
||||
"input.aspect_ids" : "aspect_ids",
|
||||
"input.service:checked" : "services"
|
||||
},
|
||||
|
|
@ -25,8 +24,13 @@ app.pages.Composer = app.views.Base.extend({
|
|||
},
|
||||
|
||||
navigateNext : function(){
|
||||
this.setModelAttributes();
|
||||
app.router.navigate("framer", true);
|
||||
this.$("form textarea.text").mentionsInput('val',
|
||||
_.bind(function(markup){
|
||||
$('#text_with_markup').val(markup);
|
||||
this.setModelAttributes();
|
||||
app.router.navigate("framer", true);
|
||||
}, this)
|
||||
);
|
||||
},
|
||||
|
||||
setModelAttributes : function(evt){
|
||||
|
|
@ -57,7 +61,7 @@ app.views.ComposerControls = app.views.Base.extend({
|
|||
|
||||
subviews : {
|
||||
".aspect-selector" : "aspectsDropdown",
|
||||
".service-selector" : "servicesSelector",
|
||||
".service-selector" : "servicesSelector"
|
||||
},
|
||||
|
||||
initialize : function() {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,21 @@
|
|||
def fill_in_autocomplete(selector, value)
|
||||
pending #make me work if yr board, investigate send_keys
|
||||
page.execute_script %Q{$('#{selector}').val('#{value}').keyup()}
|
||||
def mention_alice(user_name)
|
||||
#find(selector).native.send_keys(value)
|
||||
page.execute_script <<-JAVASCRIPT
|
||||
var mentionsInput = $("textarea.text")
|
||||
|
||||
triggerKeypress(64) //@
|
||||
triggerKeypress(97) //a
|
||||
mentionsInput.trigger("input") //bring up c
|
||||
|
||||
|
||||
function triggerKeypress(keyCode){
|
||||
var e = new $.Event("keypress")
|
||||
e.which = keyCode //@
|
||||
mentionsInput.trigger(e)
|
||||
}
|
||||
JAVASCRIPT
|
||||
page.find(".mentions-autocomplete-list li:contains('Alice Smith')").click()
|
||||
sleep(1)
|
||||
end
|
||||
|
||||
def aspects_dropdown
|
||||
|
|
@ -62,9 +77,7 @@ When /^I write "([^"]*)"(?:| with body "([^"]*)")$/ do |headline, body|
|
|||
end
|
||||
|
||||
Then /I mention "([^"]*)"$/ do |text|
|
||||
fill_in_autocomplete('textarea.text', '@a')
|
||||
sleep(5)
|
||||
find("li.active").click
|
||||
mention_alice('@a')
|
||||
end
|
||||
|
||||
When /^I select "([^"]*)" in my aspects dropdown$/ do |title|
|
||||
|
|
@ -135,6 +148,6 @@ When /^the frame's body should be "([^"]*)"$/ do |body_text|
|
|||
find("section.body").text.should == body_text
|
||||
end
|
||||
|
||||
Then /^the first post should mention "([^"]*)"$/ do |user_name|
|
||||
pending
|
||||
Then /^the post should mention "([^"]*)"$/ do |user_name|
|
||||
within('#post-content') { find("a:contains('#{user_name}')").should be_present }
|
||||
end
|
||||
|
|
|
|||
|
|
@ -23,14 +23,14 @@ Feature: Creating a new post
|
|||
Then I should see "This is super skrunkle" as the first post in my stream
|
||||
Then "This is super skrunkle" should be a limited post in my stream
|
||||
|
||||
@wip
|
||||
Scenario: Mention a contact
|
||||
Given a user named "Alice Smith" with email "alice@alice.alice"
|
||||
And a user with email "bob@bob.bob" is connected with "alice@alice.alice"
|
||||
And I mention "alice@alice.alice"
|
||||
And I trumpet
|
||||
And I wait for the ajax to finish
|
||||
And I mention "Alice Smith"
|
||||
And I go through the default composer
|
||||
And I go to "/stream"
|
||||
Then the first post should mention "Alice Smith"
|
||||
Then the post should mention "Alice Smith"
|
||||
|
||||
Scenario: Uploading multiple photos
|
||||
When I write "check out these pictures"
|
||||
|
|
|
|||
|
|
@ -46,9 +46,12 @@ describe("app.pages.Composer", function(){
|
|||
|
||||
it("instantiates a post on form submit", function(){
|
||||
this.page.$("button.next").click()
|
||||
expect(this.page.model.get("text")).toBe("Oh My")
|
||||
expect(this.page.model.get("aspect_ids")).toBe("public")
|
||||
expect(this.page.model.get("services").length).toBe(2)
|
||||
waitsFor(function(){ return this.page.$("#text_with_markup").text() == "Oh My" })
|
||||
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("text")).toBe("Oh My"))
|
||||
})
|
||||
})
|
||||
});
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue