Fix post preview with location
This commit is contained in:
parent
9d6ce5b110
commit
a5ca78bc87
3 changed files with 33 additions and 1 deletions
|
|
@ -327,6 +327,17 @@ app.views.Publisher = Backbone.View.extend({
|
||||||
var mentionedPeople = this.getMentionedPeople(serializedForm);
|
var mentionedPeople = this.getMentionedPeople(serializedForm);
|
||||||
var date = (new Date()).toISOString();
|
var date = (new Date()).toISOString();
|
||||||
var poll = this.getPollData(serializedForm);
|
var poll = this.getPollData(serializedForm);
|
||||||
|
var locationCoords = serializedForm["location[coords]"];
|
||||||
|
if(!locationCoords || locationCoords === "") {
|
||||||
|
locationCoords = ["", ""];
|
||||||
|
} else {
|
||||||
|
locationCoords = locationCoords.split(",");
|
||||||
|
}
|
||||||
|
var location = {
|
||||||
|
"address": $("#location_address").val(),
|
||||||
|
"lat": locationCoords[0],
|
||||||
|
"lng": locationCoords[1]
|
||||||
|
};
|
||||||
|
|
||||||
var previewMessage = {
|
var previewMessage = {
|
||||||
"id" : 0,
|
"id" : 0,
|
||||||
|
|
@ -340,7 +351,7 @@ app.views.Publisher = Backbone.View.extend({
|
||||||
"photos" : photos,
|
"photos" : photos,
|
||||||
"frame_name" : "status",
|
"frame_name" : "status",
|
||||||
"title" : serializedForm["status_message[text]"],
|
"title" : serializedForm["status_message[text]"],
|
||||||
"address" : $("#location_address").val(),
|
"location" : location,
|
||||||
"interactions" : {"likes":[],"reshares":[],"comments_count":0,"likes_count":0,"reshares_count":0},
|
"interactions" : {"likes":[],"reshares":[],"comments_count":0,"likes_count":0,"reshares_count":0},
|
||||||
"poll": poll
|
"poll": poll
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -85,3 +85,17 @@ Feature: preview posts in the stream
|
||||||
Then I should see a ".poll_form" within ".stream_element"
|
Then I should see a ".poll_form" within ".stream_element"
|
||||||
And I should see a "form" within ".stream_element"
|
And I should see a "form" within ".stream_element"
|
||||||
And I close the publisher
|
And I close the publisher
|
||||||
|
|
||||||
|
Scenario: preview a post with location
|
||||||
|
Given I expand the publisher
|
||||||
|
When I fill in the following:
|
||||||
|
| status_message_fake_text | I am eating yogurt |
|
||||||
|
And I allow geolocation
|
||||||
|
And I click on selector "#locator"
|
||||||
|
When I fill in the following:
|
||||||
|
| status_message_fake_text | I am eating yogurt |
|
||||||
|
| location_address | Some cool place |
|
||||||
|
And I press "Preview"
|
||||||
|
Then I should see a ".near-from" within ".stream_element"
|
||||||
|
And I should see "Some cool place" within ".stream_element .near-from"
|
||||||
|
And I close the publisher
|
||||||
|
|
|
||||||
7
features/step_definitions/location_steps.rb
Normal file
7
features/step_definitions/location_steps.rb
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
When /^I allow geolocation$/ do
|
||||||
|
page.execute_script <<-JS
|
||||||
|
navigator.geolocation.getCurrentPosition = function(success) {
|
||||||
|
success({coords: {latitude: 42.42424242, longitude: 3.14159}});
|
||||||
|
};
|
||||||
|
JS
|
||||||
|
end
|
||||||
Loading…
Reference in a new issue