Commit 5854ab2f authored by Stan Hu's avatar Stan Hu
Browse files

Convert variants of trigger('click') -> click

parent a4410c83f96e
......@@ -22,7 +22,7 @@ class Spinach::Features::Dashboard < Spinach::FeatureSteps
end
step 'I click "Create merge request" link' do
find_link("Create merge request", visible: false).trigger('click')
find_link("Create merge request", visible: false).click
end
step 'I see prefilled new Merge Request page' do
......
......@@ -55,7 +55,7 @@ class Spinach::Features::DashboardTodos < Spinach::FeatureSteps
merge_request_reference = merge_request.to_reference(full: true)
issue_reference = issue.to_reference(full: true)
find('.js-todos-mark-all').trigger('click')
find('.js-todos-mark-all').click
page.within('.todos-count') { expect(page).to have_content '0' }
expect(page).to have_content 'To do 0'
......@@ -69,7 +69,7 @@ class Spinach::Features::DashboardTodos < Spinach::FeatureSteps
end
step 'I should see the todo marked as done' do
find('.todos-done a').trigger('click')
find('.todos-done a').click
expect(page).to have_link project.name_with_namespace
should_see_todo(1, "John Doe assigned you merge request #{merge_request.to_reference(full: true)}", merge_request.title, state: :done_irreversible)
......@@ -79,7 +79,7 @@ class Spinach::Features::DashboardTodos < Spinach::FeatureSteps
merge_request_reference = merge_request.to_reference(full: true)
issue_reference = issue.to_reference(full: true)
find('.todos-done a').trigger('click')
find('.todos-done a').click
expect(page).to have_link project.name_with_namespace
should_see_todo(1, "John Doe assigned you merge request #{merge_request_reference}", merge_request.title, state: :done_irreversible)
......
......@@ -11,7 +11,7 @@ class Spinach::Features::ProfileNotifications < Spinach::FeatureSteps
end
step 'I select Mention setting from dropdown' do
first(:link, "On mention").trigger('click')
first(:link, "On mention").click
end
step 'I should see Notification saved message' do
......
......@@ -34,7 +34,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end
step 'I click link "Merged"' do
find('#state-merged').trigger('click')
find('#state-merged').click
end
step 'I click link "Closed"' do
......@@ -336,7 +336,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
step 'I click on the Discussion tab' do
page.within '.merge-request-tabs' do
find('.notes-tab').trigger('click')
find('.notes-tab').click
end
# Waits for load
......@@ -420,7 +420,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end
step 'I click link "Reopen"' do
first(:css, '.reopen-mr-link').trigger('click')
first(:css, '.reopen-mr-link').click
end
step 'I should see reopened merge request "Bug NS-04"' do
......@@ -432,13 +432,13 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
step 'I click link "Hide inline discussion" of the third file' do
page.within '.files>div:nth-child(3)' do
find('.js-toggle-diff-comments').trigger('click')
find('.js-toggle-diff-comments').click
end
end
step 'I click link "Show inline discussion" of the third file' do
page.within '.files>div:nth-child(3)' do
find('.js-toggle-diff-comments').trigger('click')
find('.js-toggle-diff-comments').click
end
end
......@@ -510,7 +510,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
end
step 'I click Side-by-side Diff tab' do
find('a', text: 'Side-by-side').trigger('click')
find('a', text: 'Side-by-side').click
# Waits for load
expect(page).to have_css('.parallel')
......
......@@ -10,12 +10,12 @@ class Spinach::Features::Search < Spinach::FeatureSteps
step 'I search for "Foo"' do
fill_in "dashboard_search", with: "Foo"
find('.btn-search').trigger('click')
find('.btn-search').click
end
step 'I search for "rspec"' do
fill_in "dashboard_search", with: "rspec"
find('.btn-search').trigger('click')
find('.btn-search').click
end
step 'I search for "rspec" on project page' do
......@@ -25,7 +25,7 @@ class Spinach::Features::Search < Spinach::FeatureSteps
step 'I search for "Wiki content"' do
fill_in "dashboard_search", with: "content"
find('.btn-search').trigger('click')
find('.btn-search').click
end
step 'I click "Issues" link' do
......@@ -35,7 +35,7 @@ class Spinach::Features::Search < Spinach::FeatureSteps
end
step 'I click project "Shop" link' do
find('.js-search-project-dropdown').trigger('click')
find('.js-search-project-dropdown').click
page.within '.project-filter' do
click_link project.name_with_namespace
end
......
......@@ -215,7 +215,7 @@ module SharedDiffNote
end
step 'I click side-by-side diff button' do
find('#parallel-diff-btn').trigger('click')
find('#parallel-diff-btn').click
end
step 'I see side-by-side diff button' do
......@@ -228,11 +228,11 @@ def diff_file_selector
def click_diff_line(code)
find(".line_holder[id='#{code}'] td:nth-of-type(1)").trigger 'mouseover'
find(".line_holder[id='#{code}'] button").trigger 'click'
find(".line_holder[id='#{code}'] button").click
end
def click_parallel_diff_line(code, line_type)
find(".line_content.parallel.#{line_type}[data-line-code='#{code}']").trigger 'mouseover'
find(".line_holder.parallel button[data-line-code='#{code}']").trigger 'click'
find(".line_holder.parallel button[data-line-code='#{code}']").click
end
end
......@@ -51,7 +51,7 @@
expect(page).to have_selector('.issue-boards-sidebar')
find('.gutter-toggle').trigger('click')
find('.gutter-toggle').click
expect(page).not_to have_selector('.issue-boards-sidebar')
end
......@@ -155,7 +155,7 @@
end
page.within(find('.board:nth-child(2)')) do
find('.card:nth-child(2)').trigger('click')
find('.card:nth-child(2)').click
end
page.within('.assignee') do
......
......@@ -7,7 +7,7 @@
shared_examples 'page has active tab' do |title|
it "#{title} tab" do
find('.global-dropdown-toggle').trigger('click')
find('.global-dropdown-toggle').click
expect(page).to have_selector('.global-dropdown-menu li.active', count: 1)
expect(find('.global-dropdown-menu li.active')).to have_content(title)
end
......
......@@ -7,7 +7,7 @@
it 'creates new group', js: true do
visit dashboard_groups_path
find('.btn-new').trigger('click')
find('.btn-new').click
new_path = 'Samurai'
new_description = 'Tokugawa Shogunate'
......
......@@ -74,14 +74,14 @@
expect(page).not_to have_selector("#group-#{group.id} .fa-caret-right")
# Collapse
find("#group-#{group.id}").trigger('click')
find("#group-#{group.id}").click
expect(page).not_to have_selector("#group-#{group.id} .fa-caret-down")
expect(page).to have_selector("#group-#{group.id} .fa-caret-right", count: 1)
expect(page).not_to have_selector("#group-#{group.id} #group-#{subgroup.id}")
# Expand
find("#group-#{group.id}").trigger('click')
find("#group-#{group.id}").click
expect(page).to have_selector("#group-#{group.id} .fa-caret-down", count: 1)
expect(page).not_to have_selector("#group-#{group.id} .fa-caret-right")
......@@ -115,7 +115,7 @@
expect(page).not_to have_selector("#group-#{group.id}")
# Go to next page
find(".gl-pagination .page:not(.active) a").trigger('click')
find(".gl-pagination .page:not(.active) a").click
wait_for_requests
......
......@@ -65,7 +65,7 @@
describe 'new issue dropdown' do
it 'shows projects only with issues feature enabled', js: true do
find('.new-project-item-select-button').trigger('click')
find('.new-project-item-select-button').click
page.within('.select2-results') do
expect(page).to have_content(project.name_with_namespace)
......
......@@ -17,7 +17,7 @@
end
it 'shows projects only with merge requests feature enabled', js: true do
find('.new-project-item-select-button').trigger('click')
find('.new-project-item-select-button').click
page.within('.select2-results') do
expect(page).to have_content(project.name_with_namespace)
......
......@@ -69,9 +69,9 @@
visit namespace_project_path(project.namespace, project)
page.within '.header-content' do
find('.header-new-dropdown-toggle').trigger('click')
find('.header-new-dropdown-toggle').click
expect(page).to have_selector('.header-new.dropdown.open', count: 1)
find('.header-new-project-snippet a').trigger('click')
find('.header-new-project-snippet a').click
end
expect(page).to have_content('New Snippet')
......@@ -91,9 +91,9 @@
visit group_path(group)
page.within '.header-content' do
find('.header-new-dropdown-toggle').trigger('click')
find('.header-new-dropdown-toggle').click
expect(page).to have_selector('.header-new.dropdown.open', count: 1)
find('.header-new-group-project a').trigger('click')
find('.header-new-group-project a').click
end
expect(page).to have_content('Project path')
......@@ -160,7 +160,7 @@
def click_topmenuitem(item_name)
page.within '.header-content' do
find('.header-new-dropdown-toggle').trigger('click')
find('.header-new-dropdown-toggle').click
expect(page).to have_selector('.header-new.dropdown.open', count: 1)
click_link item_name
end
......
......@@ -80,7 +80,7 @@
set_recent_searches(project_1_local_storage_key, '["foo", "bar"]')
visit namespace_project_issues_path(project_1.namespace, project_1)
all('.filtered-search-history-dropdown-item', visible: false)[0].trigger('click')
all('.filtered-search-history-dropdown-item', visible: false)[0].click
wait_for_filtered_search('foo')
expect(find('.filtered-search').value.strip).to eq('foo')
......@@ -94,7 +94,7 @@
expect(items_before.count).to eq(1)
find('.filtered-search-history-clear-button', visible: false).trigger('click')
find('.filtered-search-history-clear-button', visible: false).click
items_after = all('.filtered-search-history-dropdown-item', visible: false)
expect(items_after.count).to eq(0)
......
......@@ -184,7 +184,7 @@ def visit_issue(project, issue)
end
def open_issue_sidebar
find('aside.right-sidebar.right-sidebar-collapsed .js-sidebar-toggle').trigger('click')
find('aside.right-sidebar.right-sidebar-collapsed .js-sidebar-toggle').click
find('aside.right-sidebar.right-sidebar-expanded')
end
end
......@@ -378,7 +378,7 @@
it 'changes incoming email address token', js: true do
find('.issue-email-modal-btn').click
previous_token = find('input#issue_email').value
find('.incoming-email-token-reset').trigger('click')
find('.incoming-email-token-reset').click
wait_for_requests
......
......@@ -18,7 +18,7 @@ def create_merge_request(source_branch)
within find('.files-wrapper .diff-file', text: 'files/ruby/regex.rb') do
all('button', text: 'Use ours').each do |button|
button.trigger('click')
button.click
end
end
......
......@@ -150,7 +150,7 @@
page.within '.js-discussion-note-form' do
find('.js-note-text').native.send_keys('Test')
find('.js-comment-button').trigger 'click'
find('.js-comment-button').click
wait_for_requests
end
......
......@@ -275,7 +275,7 @@
end
page.within '.line-resolve-all-container' do
page.find('.discussion-next-btn').trigger('click')
page.find('.discussion-next-btn').click
end
expect(page.evaluate_script("$('body').scrollTop()")).to be > 0
......
......@@ -90,7 +90,7 @@ def visit_merge_request(format = :html)
end
it 'should close when toggle is clicked again' do
toggle.trigger('click')
toggle.click
expect(toggle.find(:xpath, '..')).not_to have_selector('.mini-pipeline-graph-dropdown-menu')
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment