force reloading of page upon query change

This got broken in 873e0ca1 when reloadOnSearch was disabled for the state
pull/3768/head
Jens Ulferts 9 years ago
parent 13a3543bf5
commit 052e610cee
  1. 7
      frontend/app/templates/work_packages/menus/query_select_dropdown_menu.html
  2. 19
      spec/features/work_packages/select_query_spec.rb
  3. 13
      spec/features/work_packages/work_packages_page.rb

@ -14,7 +14,12 @@
<div class="title-group-header">{{ group.name }}</div>
<li ng-repeat="model in group.models"
ng-class="{'selected': model.highlighted }">
<a href="" ui-sref="work-packages.list({ query_id: model.id, query_props: undefined })" title="{{ model.label }}" ng-bind-html="model.labelHtml"></a>
<a href=""
title="{{ model.label }}"
ui-sref="work-packages.list({ query_id: model.id, query_props: undefined })"
ui-sref-opts="{ reload: true }"
ng-bind-html="model.labelHtml">
</a>
</li>
</ul>
</div>

@ -81,9 +81,6 @@ describe 'Query selection', type: :feature do
context 'when a query is selected' do
before do
work_packages_page.select_query query
# ensure the page is loaded before expecting anything
find('.advanced-filters--filters select option', text: /\AStart date\Z/,
visible: false)
end
it 'shows the saved filters', js: true do
@ -96,4 +93,20 @@ describe 'Query selection', type: :feature do
expect(find_button('Activate Filter')).to have_text /2$/
end
end
context 'when the selected query is changed' do
let!(:query2) do
FactoryGirl.create(:query, project: project, is_public: true)
end
before do
work_packages_page.select_query query
end
it 'updates the page upon query switching', js: true do
work_packages_page.expect_query(query)
work_packages_page.select_query_from_dropdown(query2)
work_packages_page.expect_query(query2)
end
end
end

@ -71,6 +71,19 @@ class WorkPackagesPage
ensure_index_page_loaded
end
def select_query_from_dropdown(query)
within('.title-container') do
find('a').click
find('a', text: query.name).click
end
end
def expect_query(query)
within('.title-container') do
expect(page).to have_selector('a', text: query.name)
end
end
def find_filter(filter_name)
find(".advanced-filters--filters #filter_#{filter_name}")
end

Loading…
Cancel
Save