Commit 95af3936 authored by Mike Greiling's avatar Mike Greiling

Merge branch '224038-fix-empty_states_spec' into 'master'

Fix empty_states_spec when vue_issuables_list ff is off

See merge request gitlab-org/gitlab!38540
parents 7c563d51 d121b47e
......@@ -98,6 +98,8 @@ export default {
return {
title: __('Sorry, your filter produced no results'),
description: __('To widen your search, change or remove filters above'),
primaryLink: this.createIssuePath,
primaryText: __('New issue'),
};
} else if (this.filters.state === 'opened') {
return {
......
- if Feature.enabled?(:vue_issuables_list, @project)
.js-issuables-list{ data: { endpoint: expose_url(api_v4_projects_issues_path(id: @project.id)),
'create_issue_path': expose_url(new_project_issue_path(@project)),
'can-bulk-edit': @can_bulk_update.to_json,
'empty-svg-path': image_path('illustrations/issues.svg'),
'sort-key': @sort } }
......
......@@ -20,7 +20,7 @@
= _("To widen your search, change or remove filters above")
- if show_new_issue_link?(@project)
.text-center
= link_to _("New issue"), new_project_issue_path(@project), class: "btn btn-success", id: "new_issue_body_link"
= link_to _("New issue"), new_project_issue_path(@project), class: "btn btn-success"
- elsif is_opened_state && opened_issues_count == 0 && closed_issues_count > 0
%h4.text-center
= _("There are no open issues")
......@@ -28,7 +28,7 @@
= _("To keep this project going, create a new issue")
- if show_new_issue_link?(@project)
.text-center
= link_to _("New issue"), new_project_issue_path(@project), class: "btn btn-success", id: "new_issue_body_link"
= link_to _("New issue"), new_project_issue_path(@project), class: "btn btn-success"
- elsif is_closed_state && opened_issues_count > 0 && closed_issues_count == 0
%h4.text-center
= _("There are no closed issues")
......
......@@ -20,7 +20,7 @@
= _("To widen your search, change or remove filters above")
.text-center
- if can_create_merge_request
= link_to _("New merge request"), project_new_merge_request_path(@project), class: "btn btn-success", title: _("New merge request"), id: "new_merge_request_body_link"
= link_to _("New merge request"), project_new_merge_request_path(@project), class: "btn btn-success", title: _("New merge request")
- elsif is_opened_state && opened_merged_count == 0 && closed_merged_count > 0
%h4.text-center
= _("There are no open merge requests")
......@@ -28,7 +28,7 @@
= _("To keep this project going, create a new merge request")
.text-center
- if can_create_merge_request
= link_to _("New merge request"), project_new_merge_request_path(@project), class: "btn btn-success", title: _("New merge request"), id: "new_merge_request_body_link"
= link_to _("New merge request"), project_new_merge_request_path(@project), class: "btn btn-success", title: _("New merge request")
- elsif is_closed_state && opened_merged_count > 0 && closed_merged_count == 0
%h4.text-center
= _("There are no closed merge requests")
......
......@@ -7,8 +7,6 @@ RSpec.describe 'Group empty states' do
let(:user) { create(:group_member, :developer, user: create(:user), group: group ).user }
before do
stub_feature_flags(vue_issuables_list: false)
sign_in(user)
end
......@@ -34,42 +32,52 @@ RSpec.describe 'Group empty states' do
expect(page).not_to have_selector('.empty-state')
end
it "displays link to create new #{issuable} when no open #{issuable} is found" do
it "displays link to create new #{issuable} when no open #{issuable} is found", :js do
create("closed_#{issuable}", project_relation => project)
issuable_link_fn = "project_#{issuable}s_path"
visit public_send(issuable_link_fn, project)
wait_for_all_requests
page.within(find('.empty-state')) do
expect(page).to have_content(/There are no open #{issuable.to_s.humanize.downcase}/)
expect(page).to have_selector("#new_#{issuable}_body_link")
new_issuable_path = issuable == :issue ? 'new_project_issue_path' : 'project_new_merge_request_path'
path = public_send(new_issuable_path, project)
expect(page.find('a')['href']).to have_content(path)
end
end
it 'displays link to create new issue when the current search gave no results' do
it 'displays link to create new issue when the current search gave no results', :js do
create(issuable, project_relation => project)
issuable_link_fn = "project_#{issuable}s_path"
visit public_send(issuable_link_fn, project, author_username: 'foo', scope: 'all', state: 'opened')
wait_for_all_requests
page.within(find('.empty-state')) do
expect(page).to have_content(/Sorry, your filter produced no results/)
new_issuable_path = issuable == :issue ? 'new_project_issue_path' : 'project_new_merge_request_path'
path = public_send(new_issuable_path, project)
expect(page).to have_selector("#new_#{issuable}_body_link[href='#{path}']")
expect(page.find('a')['href']).to have_content(path)
end
end
it "displays conditional text when no closed #{issuable} is found" do
it "displays conditional text when no closed #{issuable} is found", :js do
create(issuable, project_relation => project)
issuable_link_fn = "project_#{issuable}s_path"
visit public_send(issuable_link_fn, project, state: 'closed')
wait_for_all_requests
page.within(find('.empty-state')) do
expect(page).to have_content(/There are no closed #{issuable.to_s.humanize.downcase}/)
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