label_filter_spec.rb 916 Bytes
Newer Older
1 2
require 'spec_helper'

3
describe 'Dashboard > label filter', :js do
Heinrich Lee Yu's avatar
Heinrich Lee Yu committed
4 5 6 7 8
  include FilteredSearchHelpers

  let(:filtered_search) { find('.filtered-search') }
  let(:filter_dropdown) { find("#js-dropdown-label .filter-dropdown") }

9
  let(:user) { create(:user) }
10 11
  let(:project) { create(:project, name: 'test', namespace: user.namespace) }
  let(:project2) { create(:project, name: 'test2', path: 'test2', namespace: user.namespace) }
12 13 14 15 16 17 18
  let(:label) { create(:label, title: 'bug', color: '#ff0000') }
  let(:label2) { create(:label, title: 'bug') }

  before do
    project.labels << label
    project2.labels << label2

19
    sign_in(user)
20
    visit issues_dashboard_path
Heinrich Lee Yu's avatar
Heinrich Lee Yu committed
21 22

    init_label_search
23 24 25
  end

  context 'duplicate labels' do
26
    it 'removes duplicate labels' do
Heinrich Lee Yu's avatar
Heinrich Lee Yu committed
27
      filtered_search.send_keys('bu')
28

Heinrich Lee Yu's avatar
Heinrich Lee Yu committed
29
      expect(filter_dropdown).to have_selector('.filter-dropdown-item', text: 'bug', count: 1)
30 31 32
    end
  end
end