Fix invitations and tests
This commit is contained in:
parent
56a79828bc
commit
c838389b67
17 changed files with 71 additions and 93 deletions
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
//= require ./publisher/services_view
|
||||
//= require ./publisher/aspect_selector_view
|
||||
//= require ./publisher/aspect_selector_blueprint_view
|
||||
//= require ./publisher/getting_started_view
|
||||
//= require ./publisher/uploader_view
|
||||
//= require jquery-textchange
|
||||
|
|
@ -97,6 +96,7 @@ app.views.Publisher = Backbone.View.extend({
|
|||
});
|
||||
|
||||
this.initSubviews();
|
||||
this.checkSubmitAvailability();
|
||||
return this;
|
||||
},
|
||||
|
||||
|
|
@ -114,14 +114,9 @@ app.views.Publisher = Backbone.View.extend({
|
|||
form: form
|
||||
});
|
||||
|
||||
this.view_aspect_selector_blueprint = new app.views.PublisherAspectSelectorBlueprint({
|
||||
el: this.$('.public_toggle > .dropdown'),
|
||||
form: form
|
||||
});
|
||||
|
||||
this.view_getting_started = new app.views.PublisherGettingStarted({
|
||||
el_first_msg: this.el_input,
|
||||
el_visibility: this.$('.public_toggle > .dropdown'),
|
||||
el_visibility: this.$('.public_toggle .aspect_dropdown > .dropdown-toggle'),
|
||||
el_stream: $('#gs-shim')
|
||||
});
|
||||
|
||||
|
|
@ -136,13 +131,11 @@ app.views.Publisher = Backbone.View.extend({
|
|||
});
|
||||
this.view_poll_creator.on('change', this.checkSubmitAvailability, this);
|
||||
this.view_poll_creator.render();
|
||||
|
||||
},
|
||||
|
||||
// set the selected aspects in the dropdown by their ids
|
||||
setSelectedAspects: function(ids) {
|
||||
this.view_aspect_selector.updateAspectsSelector(ids);
|
||||
this.view_aspect_selector_blueprint.updateAspectsSelector(ids);
|
||||
},
|
||||
|
||||
// inject content into the publisher textarea
|
||||
|
|
@ -461,15 +454,23 @@ app.views.Publisher = Backbone.View.extend({
|
|||
},
|
||||
|
||||
setButtonsEnabled: function(bool) {
|
||||
bool = !bool;
|
||||
this.el_submit.prop({disabled: bool});
|
||||
this.el_preview.prop({disabled: bool});
|
||||
if (bool) {
|
||||
this.el_submit.removeProp('disabled');
|
||||
this.el_preview.removeProp('disabled');
|
||||
} else {
|
||||
this.el_submit.prop('disabled', true);
|
||||
this.el_preview.prop('disabled', true);
|
||||
}
|
||||
},
|
||||
|
||||
setInputEnabled: function(bool) {
|
||||
bool = !bool;
|
||||
this.el_input.prop({disabled: bool});
|
||||
this.el_hiddenInput.prop({disabled: bool});
|
||||
if (bool) {
|
||||
this.el_input.removeProp('disabled');
|
||||
this.el_hiddenInput.removeProp('disabled');
|
||||
} else {
|
||||
this.el_input.prop('disabled', true);
|
||||
this.el_hiddenInput.prop('disabled', true);
|
||||
}
|
||||
},
|
||||
|
||||
// determine submit availability
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ $link-disabled-grey: #999999;
|
|||
|
||||
$text-grey: #999999;
|
||||
$text-dark-grey: #666666;
|
||||
$text: #333333;
|
||||
|
||||
$white: white;
|
||||
$black: black;
|
||||
|
|
|
|||
|
|
@ -5,19 +5,16 @@
|
|||
}
|
||||
|
||||
#invitationsModal {
|
||||
#paste_link_wrapper {
|
||||
font-size: 12px;
|
||||
padding: 10px;
|
||||
.modal-header, .modal-body {
|
||||
color: $text;
|
||||
font-size: 14px;
|
||||
text-align: initial;
|
||||
}
|
||||
#paste_link { font-weight: 700; }
|
||||
#invite_code {
|
||||
padding: 5px;
|
||||
display: block;
|
||||
height: auto;
|
||||
}
|
||||
#invite_code { margin-top: 10px; }
|
||||
#codes_left { color: $text-grey; }
|
||||
.control-label { width: 200px; }
|
||||
.controls { margin-left: 220px; }
|
||||
.control-label { width: 120px; }
|
||||
.controls { margin-left: 140px; }
|
||||
#email_invitation {
|
||||
padding-top: 10px;
|
||||
margin-top: 20px;
|
||||
|
|
|
|||
|
|
@ -2,27 +2,25 @@
|
|||
.controls {
|
||||
z-index: 6;
|
||||
float: right;
|
||||
.post_report, .comment_report {
|
||||
|
||||
.block_user,
|
||||
.comment_report,
|
||||
.create_participation,
|
||||
.delete,
|
||||
.destroy_participation,
|
||||
.post_report {
|
||||
display: inline-block;
|
||||
|
||||
.icons-create_participation,
|
||||
.icons-deletelabel,
|
||||
.icons-destroy_participation,
|
||||
.icons-ignoreuser,
|
||||
.icons-report {
|
||||
height: 14px;
|
||||
width: 14px;
|
||||
}
|
||||
}
|
||||
.block_user {
|
||||
display: inline-block;
|
||||
.icons-ignoreuser {
|
||||
height: 14px;
|
||||
width: 14px;
|
||||
}
|
||||
}
|
||||
.delete {
|
||||
display: inline-block;
|
||||
.icons-deletelabel {
|
||||
height: 14px;
|
||||
width: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
& > a:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
#profile_container {
|
||||
.profile_header {
|
||||
border-bottom: 1px solid $border-grey;
|
||||
margin-bottom: 20px;
|
||||
border-left: 1px solid #dddddd;
|
||||
padding-left: 10px;
|
||||
|
|
@ -54,6 +53,7 @@
|
|||
|
||||
#profile_horizontal_bar {
|
||||
border-top: 1px dashed $border-grey;
|
||||
border-bottom: 1px solid $border-grey;
|
||||
min-height: 50px;
|
||||
margin-top: 10px;
|
||||
#profile_buttons {
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
#invite_code {
|
||||
& > #invite_code {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
font-size: 11px;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
#paste_link_wrapper
|
||||
#paste_link
|
||||
= t('.paste_link')
|
||||
%span#codes_left
|
||||
= '(' + t('.codes_left', :count => @invite_code.count) + ')'
|
||||
.form-horizontal
|
||||
.control-group
|
||||
.controls
|
||||
= invite_link(@invite_code)
|
||||
|
||||
#email_invitation
|
||||
|
|
|
|||
|
|
@ -31,13 +31,13 @@ Feature: invitation acceptance
|
|||
And I close the publisher
|
||||
And I log out
|
||||
And I sign in as "bob@bob.bob"
|
||||
And I follow "By email"
|
||||
And I click on selector ".btn-link[data-target='#invitationsModal']"
|
||||
Then I should see one less invite
|
||||
|
||||
Scenario: sends an invitation
|
||||
Given a user with email "bob@bob.bob"
|
||||
When I sign in as "bob@bob.bob"
|
||||
And I follow "By email"
|
||||
And I click on selector ".btn-link[data-target='#invitationsModal']"
|
||||
And I fill in the following:
|
||||
| email_inviter_emails | alex@example.com |
|
||||
And I press "Send an invitation"
|
||||
|
|
|
|||
|
|
@ -10,16 +10,10 @@ Feature: following and being followed
|
|||
When I sign in as "bob@bob.bob"
|
||||
And I am on "alice@alice.alice"'s page
|
||||
And I add the person to my "Besties" aspect
|
||||
|
||||
When I am on the home page
|
||||
And I expand the publisher
|
||||
And I fill in the following:
|
||||
| status_message_fake_text | I am following you |
|
||||
And I press "Share"
|
||||
Then I should see "I am following you" within "#main_stream"
|
||||
And I sign out
|
||||
|
||||
Scenario: seeing a follower's posts on their profile page, but not in your stream
|
||||
Given "bob@bob.bob" has a non public post with text "I am following you"
|
||||
When I sign in as "alice@alice.alice"
|
||||
And I am on "bob@bob.bob"'s page
|
||||
Then I should see "I am following you"
|
||||
|
|
@ -28,16 +22,7 @@ Feature: following and being followed
|
|||
Then I should not see "I am following you"
|
||||
|
||||
Scenario: seeing public posts of someone you follow
|
||||
Given I sign in as "alice@alice.alice"
|
||||
And I am on the home page
|
||||
And I expand the publisher
|
||||
And I fill in the following:
|
||||
| status_message_fake_text | I am ALICE |
|
||||
And I press the first ".toggle" within "#publisher"
|
||||
And I press the first ".public" within "#publisher"
|
||||
And I press "Share"
|
||||
Then I should see "I am ALICE" within "#main_stream"
|
||||
And I sign out
|
||||
Given "alice@alice.alice" has a public post with text "I am ALICE"
|
||||
|
||||
When I sign in as "bob@bob.bob"
|
||||
And I am on "alice@alice.alice"'s page
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ Feature: preview posts in the stream
|
|||
Given I expand the publisher
|
||||
When I fill in the following:
|
||||
| status_message_fake_text | I am eating yogurt |
|
||||
And I press the element "#poll_creator"
|
||||
And I click on selector "#poll_creator"
|
||||
When I fill in the following:
|
||||
| status_message_fake_text | I am eating yogurt |
|
||||
| poll_question | What kind of yogurt do you like? |
|
||||
|
|
|
|||
|
|
@ -16,13 +16,13 @@ Feature: posting with a poll
|
|||
Scenario: expanding the poll creator
|
||||
Given "#poll_creator_container" is hidden
|
||||
When I expand the publisher
|
||||
And I press the element "#poll_creator"
|
||||
And I click on selector "#poll_creator"
|
||||
Then I should see an element "#poll_creator_container"
|
||||
|
||||
Scenario: adding option to poll
|
||||
Given "#poll_creator_container" is hidden
|
||||
When I expand the publisher
|
||||
And I press the element "#poll_creator"
|
||||
And I click on selector "#poll_creator"
|
||||
And I fill in values for the first two options
|
||||
And I lose focus
|
||||
Then I should see 3 options
|
||||
|
|
@ -30,7 +30,7 @@ Feature: posting with a poll
|
|||
Scenario: delete an option
|
||||
Given "#poll_creator_container" is hidden
|
||||
When I expand the publisher
|
||||
And I press the element "#poll_creator"
|
||||
And I click on selector "#poll_creator"
|
||||
And I fill in values for the first two options
|
||||
And I lose focus
|
||||
And I delete the last option
|
||||
|
|
@ -39,7 +39,7 @@ Feature: posting with a poll
|
|||
|
||||
Scenario: post with an attached poll
|
||||
Given I expand the publisher
|
||||
And I press the element "#poll_creator"
|
||||
And I click on selector "#poll_creator"
|
||||
When I fill in the following:
|
||||
| status_message_fake_text | I am eating yogurt |
|
||||
| poll_question | What kind of yogurt do you like? |
|
||||
|
|
@ -52,7 +52,7 @@ Feature: posting with a poll
|
|||
|
||||
Scenario: vote for an option
|
||||
Given I expand the publisher
|
||||
And I press the element "#poll_creator"
|
||||
And I click on selector "#poll_creator"
|
||||
When I fill in the following:
|
||||
| status_message_fake_text | I am eating yogurt |
|
||||
| poll_question | What kind of yogurt do you like? |
|
||||
|
|
@ -69,7 +69,7 @@ Feature: posting with a poll
|
|||
|
||||
Scenario: click to show result
|
||||
Given I expand the publisher
|
||||
And I press the element "#poll_creator"
|
||||
And I click on selector "#poll_creator"
|
||||
When I fill in the following:
|
||||
| status_message_fake_text | I am eating yogurt |
|
||||
| poll_question | What kind of yogurt do you like? |
|
||||
|
|
@ -77,18 +77,18 @@ Feature: posting with a poll
|
|||
| normal |
|
||||
| not normal |
|
||||
And I press "Share"
|
||||
And I press the element ".toggle_result"
|
||||
And I click on selector ".toggle_result"
|
||||
Then I should see an element ".percentage"
|
||||
|
||||
Scenario: validate answer input
|
||||
Given I expand the publisher
|
||||
And I press the element "#poll_creator"
|
||||
And I click on selector "#poll_creator"
|
||||
When I fill in the following:
|
||||
| status_message_fake_text | I am eating yogurt |
|
||||
| poll_question | What kind of yogurt do you like? |
|
||||
And I fill in the following for the options:
|
||||
| normal |
|
||||
| |
|
||||
And I press the element "#poll_creator_container"
|
||||
And I press the element "input[type=submit]"
|
||||
And I click on selector "#poll_creator_container"
|
||||
And I click on selector "#publisher button#submit"
|
||||
Then I should see an element ".poll-answer input.error"
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ Feature: posting from the main page
|
|||
Given ".markdownIndications" is hidden
|
||||
And ".options_and_submit" is hidden
|
||||
When I expand the publisher
|
||||
Then I should see "You can use Markdown to format your post" within "#publisher-images"
|
||||
Then I should see "You can use Markdown to format your post" within ".markdownIndications"
|
||||
Then I should see "All aspects" within ".options_and_submit"
|
||||
Then I should see "Preview" within ".options_and_submit"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
module AspectCukeHelpers
|
||||
def click_aspect_dropdown
|
||||
# blueprint: .dropdown .button, bootstrap: .aspect_dropdown .dropdown-toggle
|
||||
find('.dropdown .button, .aspect_dropdown .dropdown-toggle').click
|
||||
find('.aspect_dropdown .dropdown-toggle').click
|
||||
end
|
||||
|
||||
def toggle_aspect(a_name)
|
||||
# blueprint: .dropdown li, bootstrap: .aspect_dropdown li
|
||||
a_id = @me.aspects.where(name: a_name).pluck(:id).first
|
||||
aspect_css = ".dropdown li[data-aspect_id='#{a_id}'], .aspect_dropdown li[data-aspect_id='#{a_id}']"
|
||||
aspect_css = ".aspect_dropdown li[data-aspect_id='#{a_id}']"
|
||||
expect(page).to have_selector(aspect_css)
|
||||
find(aspect_css).click
|
||||
end
|
||||
|
|
@ -30,7 +28,7 @@ module AspectCukeHelpers
|
|||
end
|
||||
|
||||
def aspect_dropdown_visible?
|
||||
expect(find('.aspect_membership.dropdown.active')).to be_visible
|
||||
expect(find('.aspect_membership_dropdown.open')).to be_visible
|
||||
end
|
||||
end
|
||||
World(AspectCukeHelpers)
|
||||
|
|
|
|||
|
|
@ -23,12 +23,6 @@ When /^I check the first option$/ do
|
|||
first(".poll_form input").click
|
||||
end
|
||||
|
||||
When(/^I press the element "(.*?)"$/) do |selector|
|
||||
page.should have_css(selector)
|
||||
find(selector).click
|
||||
end
|
||||
|
||||
|
||||
When(/^I fill in values for the first two options$/) do
|
||||
all(".poll-answer input").each_with_index do |answer, i|
|
||||
answer.set "answer option #{i}"
|
||||
|
|
|
|||
|
|
@ -126,6 +126,10 @@ When /^I post a status with the text "([^\"]*)"$/ do |text|
|
|||
@me.post(:status_message, :text => text, :public => true, :to => 'all')
|
||||
end
|
||||
|
||||
When /^I post a limited status with the text "([^\"]*)"$/ do |text|
|
||||
@me.post(:status_message, :text => text, :public => false, :to => @me.aspect_ids)
|
||||
end
|
||||
|
||||
And /^I follow the "([^\"]*)" link from the last sent email$/ do |link_text|
|
||||
email_text = Devise.mailer.deliveries.first.body.to_s
|
||||
email_text = Devise.mailer.deliveries.first.html_part.body.raw_source if email_text.blank?
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ module PublishingCukeHelpers
|
|||
end
|
||||
|
||||
def publisher_submittable?
|
||||
submit_btn = find("#publisher input[type=submit]")
|
||||
submit_btn = find("#publisher button#submit")
|
||||
!submit_btn[:disabled]
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -150,8 +150,6 @@ describe("app.views.Publisher", function() {
|
|||
});
|
||||
|
||||
it("disables submitting", function() {
|
||||
this.view.togglePollCreator();
|
||||
|
||||
this.view.setText('TESTING');
|
||||
expect(this.view.el_submit.prop('disabled')).toBeFalsy();
|
||||
expect(this.view.el_preview.prop('disabled')).toBeFalsy();
|
||||
|
|
|
|||
Loading…
Reference in a new issue