Commit 75807f2a authored by Sean McGivern's avatar Sean McGivern

Merge branch 'improve-milestone_filter_spec-wait_for_ajax-correct-flow' into 'master'

Fix milestone_filter_spec.rb

See merge request !11329
parents c266b5f5 4c9264b6
require 'spec_helper' require 'spec_helper'
describe 'Dashboard > milestone filter', feature: true, js: true do describe 'Dashboard > milestone filter', :feature, :js do
include WaitForAjax
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project, name: 'test', namespace: user.namespace) } let(:project) { create(:project, name: 'test', namespace: user.namespace) }
let(:milestone) { create(:milestone, title: "v1.0", project: project) } let(:milestone) { create(:milestone, title: "v1.0", project: project) }
...@@ -26,30 +28,29 @@ describe 'Dashboard > milestone filter', feature: true, js: true do ...@@ -26,30 +28,29 @@ describe 'Dashboard > milestone filter', feature: true, js: true do
before do before do
find(milestone_select).click find(milestone_select).click
wait_for_ajax
page.within('.dropdown-content') do page.within('.dropdown-content') do
click_link 'v1.0' click_link 'v1.0'
end end
find(milestone_select).click find(milestone_select).click
wait_for_ajax
end end
it 'shows issues with Milestone v1.0' do it 'shows issues with Milestone v1.0' do
expect(find('.issues-list')).to have_selector('.issue', count: 1) expect(find('.issues-list')).to have_selector('.issue', count: 1)
find(milestone_select).click
expect(find('.dropdown-content')).to have_selector('a.is-active', count: 1) expect(find('.dropdown-content')).to have_selector('a.is-active', count: 1)
end end
it 'should not change active Milestone unless clicked' do it 'should not change active Milestone unless clicked' do
find(milestone_select).trigger('click')
expect(find('.dropdown-content')).to have_selector('a.is-active', count: 1) expect(find('.dropdown-content')).to have_selector('a.is-active', count: 1)
# open & close dropdown # open & close dropdown
find('.dropdown-menu-close').click find('.dropdown-menu-close').click
expect(find('.milestone-filter')).not_to have_selector('.dropdown.open') expect(find('.milestone-filter')).not_to have_selector('.dropdown.open')
find(milestone_select).click find(milestone_select).click
expect(find('.dropdown-content')).to have_selector('a.is-active', count: 1) expect(find('.dropdown-content')).to have_selector('a.is-active', count: 1)
......
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