Merge pull request #7233 from opf/fix/30082/global-wp-queries

[30082] Ensure global work package query menu is activated

[ci skip]
pull/7237/head
Oliver Günther 6 years ago committed by GitHub
commit ff6a996040
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      frontend/src/app/components/main-menu/main-menu-navigation.service.ts
  2. 2
      frontend/src/app/components/wp-query-select/wp-query-select-dropdown.component.ts
  3. 9
      spec/features/work_packages/table/queries/query_menu_spec.rb

@ -5,11 +5,11 @@ export class MainMenuNavigationService {
public navigationEvents$ = new BehaviorSubject<string>('');
public onActivate(name:string) {
public onActivate(...names:string[]) {
return this
.navigationEvents$
.pipe(
filter(evt => evt === name),
filter(evt => names.indexOf(evt) !== -1),
take(1)
);
}
@ -73,10 +73,13 @@ export class MainMenuNavigationService {
// Emit first active
let active = jQuery('#main-menu .menu_root > li.open').data('name');
if (active) {
this.navigationEvents$.next(active);
let activeRoot = jQuery('#main-menu .menu_root.open > li').data('name');
if (active || activeRoot) {
this.navigationEvents$.next(active || activeRoot);
}
jQuery('#main-menu li:has(ul) .main-item-wrapper > a').not('ul ul a')
// 1. unbind the current click functions
.unbind('click')

@ -126,7 +126,7 @@ export class WorkPackageQuerySelectDropdownComponent implements OnInit, OnDestro
// When activating the work packages submenu,
// either initially or through click on the toggle, load the results
this.mainMenuService
.onActivate('work_packages')
.onActivate('work_packages', 'work_packages_query_select')
.subscribe(() => this.initializeAutocomplete());
// Register click handler on results

@ -38,6 +38,15 @@ describe 'Query menu item', js: true do
login_as(user)
end
context 'visiting the global work packages page' do
let(:wp_table) { ::Pages::WorkPackagesTable.new }
it 'should show the query menu (Regression #30082)' do
wp_table.visit!
expect(page).to have_selector('.wp-query-menu--container')
expect(page).to have_selector('.wp-query-menu--item', wait: 20, minimum: 1)
end
end
context 'filtering by version in project' do
let(:version) { FactoryBot.create :version, project: project }
let(:work_package_with_version) { FactoryBot.create :work_package, project: project, fixed_version: version }

Loading…
Cancel
Save