summaryrefslogtreecommitdiff
path: root/spec/features/issuables
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2019-02-21 18:06:14 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2019-02-21 22:19:24 +0200
commit0a11d5e24559d9e22a3e9ab7311646f762a13562 (patch)
treed737114f2140d04b9e44f71cbbf138a212b0eb35 /spec/features/issuables
parentc8bf9f78f3e481cb7e74384fa45b46b864fa523a (diff)
downloadgitlab-ce-0a11d5e24559d9e22a3e9ab7311646f762a13562.tar.gz
Sort labels alphabetically
Sorts labels alphabetically on issues (and merge requests) list. Before it was order id desc. Now it will be consistent with sidebar and labels page. Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'spec/features/issuables')
-rw-r--r--spec/features/issuables/issuable_list_spec.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/features/issuables/issuable_list_spec.rb b/spec/features/issuables/issuable_list_spec.rb
index 2f45ef856a5..7b6e9cd66b2 100644
--- a/spec/features/issuables/issuable_list_spec.rb
+++ b/spec/features/issuables/issuable_list_spec.rb
@@ -28,6 +28,22 @@ describe 'issuable list' do
expect(first('.fa-thumbs-down').find(:xpath, '..')).to have_content(1)
expect(first('.fa-comments').find(:xpath, '..')).to have_content(2)
end
+
+ it 'sorts labels alphabetically' do
+ label1 = create(:label, project: project, title: 'a')
+ label2 = create(:label, project: project, title: 'z')
+ label3 = create(:label, project: project, title: 'X')
+ label4 = create(:label, project: project, title: 'B')
+ issuable = create_issuable(issuable_type)
+ issuable.labels << [label1, label2, label3, label4]
+
+ visit_issuable_list(issuable_type)
+
+ expect(all('.label-link')[0].text).to have_content('B')
+ expect(all('.label-link')[1].text).to have_content('X')
+ expect(all('.label-link')[2].text).to have_content('a')
+ expect(all('.label-link')[3].text).to have_content('z')
+ end
end
it "counts merge requests closing issues icons for each issue" do
@@ -45,6 +61,14 @@ describe 'issuable list' do
end
end
+ def create_issuable(issuable_type)
+ if issuable_type == :issue
+ create(:issue, project: project)
+ else
+ create(:merge_request, source_project: project)
+ end
+ end
+
def create_issuables(issuable_type)
3.times do |n|
issuable =