diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-20 15:11:43 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-20 15:11:43 +0300 |
commit | f80dee91829a985dbf7d07b606179e06e87166a6 (patch) | |
tree | 144131834302ded35f593ab4f9ba25f82b04c2e8 /spec/views | |
parent | 6c4f8ad2d99cf2716e62bd5a0c2ecea9e15505b2 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/views')
-rw-r--r-- | spec/views/shared/groups/_dropdown.html.haml_spec.rb | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/spec/views/shared/groups/_dropdown.html.haml_spec.rb b/spec/views/shared/groups/_dropdown.html.haml_spec.rb index 71fa3a30711..2c6f3b4370e 100644 --- a/spec/views/shared/groups/_dropdown.html.haml_spec.rb +++ b/spec/views/shared/groups/_dropdown.html.haml_spec.rb @@ -5,11 +5,37 @@ require 'spec_helper' RSpec.describe 'shared/groups/_dropdown.html.haml' do describe 'render' do describe 'when a sort option is not selected' do - it 'renders a default sort option' do + before do render 'shared/groups/dropdown' + end + it 'renders a default sort option' do expect(rendered).to have_content 'Last created' end + + it 'renders correct sort by options' do + html_rendered = Nokogiri::HTML(rendered) + sort_options = Gitlab::Json.parse(html_rendered.css('div.dropdown')[0]['data-items']) + + expect(sort_options.size).to eq(6) + expect(sort_options[0]['value']).to eq('name_asc') + expect(sort_options[0]['text']).to eq(s_('SortOptions|Name')) + + expect(sort_options[1]['value']).to eq('name_desc') + expect(sort_options[1]['text']).to eq(s_('SortOptions|Name, descending')) + + expect(sort_options[2]['value']).to eq('created_desc') + expect(sort_options[2]['text']).to eq(s_('SortOptions|Last created')) + + expect(sort_options[3]['value']).to eq('created_asc') + expect(sort_options[3]['text']).to eq(s_('SortOptions|Oldest created')) + + expect(sort_options[4]['value']).to eq('latest_activity_desc') + expect(sort_options[4]['text']).to eq(_('Updated date')) + + expect(sort_options[5]['value']).to eq('latest_activity_asc') + expect(sort_options[5]['text']).to eq(s_('SortOptions|Oldest updated')) + end end describe 'when a sort option is selected' do |