From 38af45d45080fe134fddf97c0f245a942acd0fb8 Mon Sep 17 00:00:00 2001 From: Angel Perez Date: Thu, 8 Mar 2018 14:33:09 -0400 Subject: [PATCH] Replace deprecated `.trigger('click')` API with `.click` --- spec/features/budgets/ballots_spec.rb | 16 ++++++++-------- spec/features/budgets/investments_spec.rb | 4 ++-- .../features/comments/budget_investments_spec.rb | 6 +++--- .../budget_investments_valuation_spec.rb | 6 +++--- spec/features/comments/debates_spec.rb | 6 +++--- .../comments/legislation_annotations_spec.rb | 12 ++++++------ .../comments/legislation_questions_spec.rb | 6 +++--- spec/features/comments/polls_spec.rb | 6 +++--- spec/features/comments/proposals_spec.rb | 6 +++--- spec/features/comments/topics_spec.rb | 12 ++++++------ spec/features/legislation/draft_versions_spec.rb | 2 +- spec/support/common_actions.rb | 2 +- 12 files changed, 42 insertions(+), 42 deletions(-) diff --git a/spec/features/budgets/ballots_spec.rb b/spec/features/budgets/ballots_spec.rb index 4790de669..6e7d82c2e 100644 --- a/spec/features/budgets/ballots_spec.rb +++ b/spec/features/budgets/ballots_spec.rb @@ -149,7 +149,7 @@ feature 'Ballots' do end within("#budget_investment_#{investment.id}") do - find('.remove a').trigger('click') + find('.remove a').click end expect(page).to have_css("#amount-spent", text: "€0") @@ -274,7 +274,7 @@ feature 'Ballots' do visit budget_investments_path(budget, heading_id: california.id) within("#budget_investment_#{investment1.id}") do - find('.remove a').trigger('click') + find('.remove a').click end visit budget_investments_path(budget, heading_id: new_york.id) @@ -375,7 +375,7 @@ feature 'Ballots' do expect(page).to have_content("You have voted one investment") within("#budget_investment_#{investment.id}") do - find(".remove-investment-project").trigger('click') + find(".remove-investment-project").click end expect(page).to have_current_path(budget_ballot_path(budget)) @@ -404,7 +404,7 @@ feature 'Ballots' do end within("#sidebar #budget_investment_#{investment1.id}_sidebar") do - find(".remove-investment-project").trigger('click') + find(".remove-investment-project").click end expect(page).to have_css("#amount-spent", text: "€20,000") @@ -431,7 +431,7 @@ feature 'Ballots' do expect(page).to have_content("You have voted one investment") within("#budget_investment_#{investment.id}") do - find(".remove-investment-project").trigger('click') + find(".remove-investment-project").click end expect(page).to have_content("You have voted 0 investments") @@ -581,7 +581,7 @@ feature 'Ballots' do end within("#budget_investment_#{bi1.id}") do - find('.remove a').trigger('click') + find('.remove a').click expect(page).to have_css ".add a" end @@ -609,7 +609,7 @@ feature 'Ballots' do end within("#budget_investment_#{bi1.id}_sidebar") do - find('.remove-investment-project').trigger('click') + find('.remove-investment-project').click end expect(page).not_to have_css "#budget_investment_#{bi1.id}_sidebar" @@ -633,7 +633,7 @@ feature 'Ballots' do within("#budget_investment_#{investment1.id}") do expect(page).to have_selector('.in-favor a', visible: true) - find('.add a').trigger('click') + find('.add a').click expect(page.status_code).to eq(200) expect(page).not_to have_content "Remove" diff --git a/spec/features/budgets/investments_spec.rb b/spec/features/budgets/investments_spec.rb index 75e662d5a..72832d769 100644 --- a/spec/features/budgets/investments_spec.rb +++ b/spec/features/budgets/investments_spec.rb @@ -939,7 +939,7 @@ feature 'Budget Investments' do login_as(user) visit budget_investment_path(budget_id: investment.budget.id, id: investment.id) - find("#tab-milestones-label").trigger('click') + find("#tab-milestones-label").click within("#tab-milestones") do expect(first_milestone.description).to appear_before('Last milestone with a link to https://consul.dev') @@ -959,7 +959,7 @@ feature 'Budget Investments' do login_as(user) visit budget_investment_path(budget_id: investment.budget.id, id: investment.id) - find("#tab-milestones-label").trigger('click') + find("#tab-milestones-label").click within("#tab-milestones") do expect(page).to have_content("Don't have defined milestones") diff --git a/spec/features/comments/budget_investments_spec.rb b/spec/features/comments/budget_investments_spec.rb index bae63e4ec..c22ab56cb 100644 --- a/spec/features/comments/budget_investments_spec.rb +++ b/spec/features/comments/budget_investments_spec.rb @@ -53,17 +53,17 @@ feature 'Commenting Budget::Investments' do expect(page).to have_css('.comment', count: 3) - find("#comment_#{child_comment.id}_children_arrow").trigger('click') + find("#comment_#{child_comment.id}_children_arrow").click expect(page).to have_css('.comment', count: 2) expect(page).not_to have_content grandchild_comment.body - find("#comment_#{child_comment.id}_children_arrow").trigger('click') + find("#comment_#{child_comment.id}_children_arrow").click expect(page).to have_css('.comment', count: 3) expect(page).to have_content grandchild_comment.body - find("#comment_#{parent_comment.id}_children_arrow").trigger('click') + find("#comment_#{parent_comment.id}_children_arrow").click expect(page).to have_css('.comment', count: 1) expect(page).not_to have_content child_comment.body diff --git a/spec/features/comments/budget_investments_valuation_spec.rb b/spec/features/comments/budget_investments_valuation_spec.rb index f71d3f3ea..f2888845c 100644 --- a/spec/features/comments/budget_investments_valuation_spec.rb +++ b/spec/features/comments/budget_investments_valuation_spec.rb @@ -80,17 +80,17 @@ feature 'Internal valuation comments on Budget::Investments' do expect(page).to have_css('.comment', count: 3) - find("#comment_#{child_comment.id}_children_arrow").trigger('click') + find("#comment_#{child_comment.id}_children_arrow").click expect(page).to have_css('.comment', count: 2) expect(page).not_to have_content grandchild_comment.body - find("#comment_#{child_comment.id}_children_arrow").trigger('click') + find("#comment_#{child_comment.id}_children_arrow").click expect(page).to have_css('.comment', count: 3) expect(page).to have_content grandchild_comment.body - find("#comment_#{parent_comment.id}_children_arrow").trigger('click') + find("#comment_#{parent_comment.id}_children_arrow").click expect(page).to have_css('.comment', count: 1) expect(page).not_to have_content child_comment.body diff --git a/spec/features/comments/debates_spec.rb b/spec/features/comments/debates_spec.rb index 22a719526..7a014f60c 100644 --- a/spec/features/comments/debates_spec.rb +++ b/spec/features/comments/debates_spec.rb @@ -48,17 +48,17 @@ feature 'Commenting debates' do expect(page).to have_css('.comment', count: 3) - find("#comment_#{child_comment.id}_children_arrow").trigger('click') + find("#comment_#{child_comment.id}_children_arrow").click expect(page).to have_css('.comment', count: 2) expect(page).not_to have_content grandchild_comment.body - find("#comment_#{child_comment.id}_children_arrow").trigger('click') + find("#comment_#{child_comment.id}_children_arrow").click expect(page).to have_css('.comment', count: 3) expect(page).to have_content grandchild_comment.body - find("#comment_#{parent_comment.id}_children_arrow").trigger('click') + find("#comment_#{parent_comment.id}_children_arrow").click expect(page).to have_css('.comment', count: 1) expect(page).not_to have_content child_comment.body diff --git a/spec/features/comments/legislation_annotations_spec.rb b/spec/features/comments/legislation_annotations_spec.rb index 637cf1b1c..27ff22192 100644 --- a/spec/features/comments/legislation_annotations_spec.rb +++ b/spec/features/comments/legislation_annotations_spec.rb @@ -55,17 +55,17 @@ feature 'Commenting legislation questions' do expect(page).to have_css('.comment', count: 3) - find("#comment_#{child_comment.id}_children_arrow").trigger('click') + find("#comment_#{child_comment.id}_children_arrow").click expect(page).to have_css('.comment', count: 2) expect(page).not_to have_content grandchild_comment.body - find("#comment_#{child_comment.id}_children_arrow").trigger('click') + find("#comment_#{child_comment.id}_children_arrow").click expect(page).to have_css('.comment', count: 3) expect(page).to have_content grandchild_comment.body - find("#comment_#{parent_comment.id}_children_arrow").trigger('click') + find("#comment_#{parent_comment.id}_children_arrow").click expect(page).to have_css('.comment', count: 1) expect(page).not_to have_content child_comment.body @@ -620,7 +620,7 @@ feature 'Commenting legislation questions' do scenario 'View comments of annotations in an included range' do within("#annotation-link") do - first(:css, "a").trigger('click') + first(:css, "a").click end expect(page).to have_css(".comment", count: 2) @@ -656,7 +656,7 @@ feature 'Commenting legislation questions' do end within("#annotation-link") do - first(:css, "a").trigger('click') + first(:css, "a").click end expect(page).to have_css(".comment", count: 3) @@ -667,7 +667,7 @@ feature 'Commenting legislation questions' do scenario "Reply on a multiple annotation thread and display it in the single annotation thread" do within("#annotation-link") do - first(:css, "a").trigger('click') + first(:css, "a").click end comment = annotation2.comments.first diff --git a/spec/features/comments/legislation_questions_spec.rb b/spec/features/comments/legislation_questions_spec.rb index d0e341498..42475fa57 100644 --- a/spec/features/comments/legislation_questions_spec.rb +++ b/spec/features/comments/legislation_questions_spec.rb @@ -55,17 +55,17 @@ feature 'Commenting legislation questions' do expect(page).to have_css('.comment', count: 3) - find("#comment_#{child_comment.id}_children_arrow").trigger('click') + find("#comment_#{child_comment.id}_children_arrow").click expect(page).to have_css('.comment', count: 2) expect(page).not_to have_content grandchild_comment.body - find("#comment_#{child_comment.id}_children_arrow").trigger('click') + find("#comment_#{child_comment.id}_children_arrow").click expect(page).to have_css('.comment', count: 3) expect(page).to have_content grandchild_comment.body - find("#comment_#{parent_comment.id}_children_arrow").trigger('click') + find("#comment_#{parent_comment.id}_children_arrow").click expect(page).to have_css('.comment', count: 1) expect(page).not_to have_content child_comment.body diff --git a/spec/features/comments/polls_spec.rb b/spec/features/comments/polls_spec.rb index 1a371e9cc..b706a198a 100644 --- a/spec/features/comments/polls_spec.rb +++ b/spec/features/comments/polls_spec.rb @@ -49,17 +49,17 @@ feature 'Commenting polls' do expect(page).to have_css('.comment', count: 3) - find("#comment_#{child_comment.id}_children_arrow").trigger('click') + find("#comment_#{child_comment.id}_children_arrow").click expect(page).to have_css('.comment', count: 2) expect(page).not_to have_content grandchild_comment.body - find("#comment_#{child_comment.id}_children_arrow").trigger('click') + find("#comment_#{child_comment.id}_children_arrow").click expect(page).to have_css('.comment', count: 3) expect(page).to have_content grandchild_comment.body - find("#comment_#{parent_comment.id}_children_arrow").trigger('click') + find("#comment_#{parent_comment.id}_children_arrow").click expect(page).to have_css('.comment', count: 1) expect(page).not_to have_content child_comment.body diff --git a/spec/features/comments/proposals_spec.rb b/spec/features/comments/proposals_spec.rb index 959b4b65b..e7156019f 100644 --- a/spec/features/comments/proposals_spec.rb +++ b/spec/features/comments/proposals_spec.rb @@ -47,17 +47,17 @@ feature 'Commenting proposals' do expect(page).to have_css('.comment', count: 3) - find("#comment_#{child_comment.id}_children_arrow").trigger('click') + find("#comment_#{child_comment.id}_children_arrow").click expect(page).to have_css('.comment', count: 2) expect(page).not_to have_content grandchild_comment.body - find("#comment_#{child_comment.id}_children_arrow").trigger('click') + find("#comment_#{child_comment.id}_children_arrow").click expect(page).to have_css('.comment', count: 3) expect(page).to have_content grandchild_comment.body - find("#comment_#{parent_comment.id}_children_arrow").trigger('click') + find("#comment_#{parent_comment.id}_children_arrow").click expect(page).to have_css('.comment', count: 1) expect(page).not_to have_content child_comment.body diff --git a/spec/features/comments/topics_spec.rb b/spec/features/comments/topics_spec.rb index 2d09b5ff4..f8c9f3fc5 100644 --- a/spec/features/comments/topics_spec.rb +++ b/spec/features/comments/topics_spec.rb @@ -51,17 +51,17 @@ feature 'Commenting topics from proposals' do expect(page).to have_css('.comment', count: 3) - find("#comment_#{child_comment.id}_children_arrow").trigger('click') + find("#comment_#{child_comment.id}_children_arrow").click expect(page).to have_css('.comment', count: 2) expect(page).not_to have_content grandchild_comment.body - find("#comment_#{child_comment.id}_children_arrow").trigger('click') + find("#comment_#{child_comment.id}_children_arrow").click expect(page).to have_css('.comment', count: 3) expect(page).to have_content grandchild_comment.body - find("#comment_#{parent_comment.id}_children_arrow").trigger('click') + find("#comment_#{parent_comment.id}_children_arrow").click expect(page).to have_css('.comment', count: 1) expect(page).not_to have_content child_comment.body @@ -601,17 +601,17 @@ feature 'Commenting topics from budget investments' do expect(page).to have_css('.comment', count: 3) - find("#comment_#{child_comment.id}_children_arrow").trigger('click') + find("#comment_#{child_comment.id}_children_arrow").click expect(page).to have_css('.comment', count: 2) expect(page).not_to have_content grandchild_comment.body - find("#comment_#{child_comment.id}_children_arrow").trigger('click') + find("#comment_#{child_comment.id}_children_arrow").click expect(page).to have_css('.comment', count: 3) expect(page).to have_content grandchild_comment.body - find("#comment_#{parent_comment.id}_children_arrow").trigger('click') + find("#comment_#{parent_comment.id}_children_arrow").click expect(page).to have_css('.comment', count: 1) expect(page).not_to have_content child_comment.body diff --git a/spec/features/legislation/draft_versions_spec.rb b/spec/features/legislation/draft_versions_spec.rb index 2effaa5d0..a678a177b 100644 --- a/spec/features/legislation/draft_versions_spec.rb +++ b/spec/features/legislation/draft_versions_spec.rb @@ -194,7 +194,7 @@ feature 'Legislation Draft Versions' do expect(page).to have_content "my annotation" expect(page).to have_content comment.body - all(".annotator-hl")[1].trigger('click') + all(".annotator-hl")[1].click expect(page).to have_content "my other annotation" end diff --git a/spec/support/common_actions.rb b/spec/support/common_actions.rb index 81d831f5f..1704faed1 100644 --- a/spec/support/common_actions.rb +++ b/spec/support/common_actions.rb @@ -293,7 +293,7 @@ module CommonActions def add_to_ballot(budget_investment) within("#budget_investment_#{budget_investment.id}") do - find('.add a').trigger('click') + find('.add a').click expect(page).to have_content "Remove" end end