diff --git a/app/assets/javascripts/app/pages/profile.js b/app/assets/javascripts/app/pages/profile.js index f5eff7d79..b987ea387 100644 --- a/app/assets/javascripts/app/pages/profile.js +++ b/app/assets/javascripts/app/pages/profile.js @@ -40,6 +40,8 @@ app.pages.Profile = app.views.Base.extend({ app.events.on("person:unblock:"+id, this.reload, this); app.events.on("aspect:create", this.reload, this); app.events.on("aspect_membership:update", this.reload, this); + + app.router.renderAspectMembershipDropdowns(this.$el); }, _populateModel: function(opts) { diff --git a/app/assets/javascripts/app/router.js b/app/assets/javascripts/app/router.js index 63073ace0..0228358c0 100644 --- a/app/assets/javascripts/app/router.js +++ b/app/assets/javascripts/app/router.js @@ -169,7 +169,7 @@ app.Router = Backbone.Router.extend({ }, profile: function() { - this._loadAspects(); + this._loadRelationshipsPreloads(); this.renderPage(function() { return new app.pages.Profile({ el: $("body > #profile_container") @@ -179,7 +179,7 @@ app.Router = Backbone.Router.extend({ pageWithAspectMembershipDropdowns: function() { this._loadRelationshipsPreloads(); - this._renderAspectMembershipDropdowns(); + this.renderAspectMembershipDropdowns($(document)); }, _loadAspects: function() { @@ -195,8 +195,8 @@ app.Router = Backbone.Router.extend({ this._loadAspects(); }, - _renderAspectMembershipDropdowns: function() { - $(".aspect_membership_dropdown.placeholder").each(function() { + renderAspectMembershipDropdowns: function($context) { + $context.find(".aspect_membership_dropdown.placeholder").each(function() { var personId = $(this).data("personId"); var view = new app.views.AspectMembership({person: app.contacts.findWhere({"person_id": personId}).person}); $(this).html(view.render().$el); diff --git a/features/desktop/contacts.feature b/features/desktop/contacts.feature index 5af487d2d..5521f74fe 100644 --- a/features/desktop/contacts.feature +++ b/features/desktop/contacts.feature @@ -25,8 +25,9 @@ Feature: show contacts Then I should see "Contacts" within "#profile-horizontal-bar" When I press the first "#contacts_link" - And I press the first "a" within "#people_stream .media-body" - Then I should see "Bob Jones" + Then I should see "Bob Jones" within "#people_stream .media-body" + When I add the person to my "Besties" aspect within "#people_stream" + Then I should see a flash message containing "You have started sharing with Bob Jones!" Scenario: don't see contacts of an invisible aspect list When I am on "bob@bob.bob"'s page diff --git a/features/step_definitions/user_steps.rb b/features/step_definitions/user_steps.rb index c4b8b490f..9074fccb1 100644 --- a/features/step_definitions/user_steps.rb +++ b/features/step_definitions/user_steps.rb @@ -118,8 +118,10 @@ Then /^I should have (\d) contacts? in "([^"]*)"$/ do |n_contacts, aspect_name| @me.aspects.where(:name => aspect_name).first.contacts.count.should == n_contacts.to_i end -When /^I (?:add|remove) the person (?:to|from) my "([^\"]*)" aspect$/ do |aspect_name| - toggle_aspect_via_ui(aspect_name) +When /^I (?:add|remove) the person (?:to|from) my "([^\"]*)" aspect(?: within "([^"]*)")?$/ do |aspect_name, within_selector| # rubocop:disable Metrics/LineLength + with_scope(within_selector) do + toggle_aspect_via_ui(aspect_name) + end end When /^I post a status with the text "([^\"]*)"$/ do |text|