diff --git a/app/assets/javascripts/angular/directives/work_packages/query-filters-directive.js b/app/assets/javascripts/angular/directives/work_packages/query-filters-directive.js index 3bf7a61b15..b98c2422eb 100644 --- a/app/assets/javascripts/angular/directives/work_packages/query-filters-directive.js +++ b/app/assets/javascripts/angular/directives/work_packages/query-filters-directive.js @@ -9,7 +9,7 @@ angular.module('openproject.workPackages.directives') compile: function(tElement) { return { pre: function(scope) { - scope.showFilters = scope.query.id !== null; + scope.showFilters = scope.query.filters.length > 0; scope.$watch('filterToBeAdded', function(filterName) { if (filterName) { diff --git a/public/templates/work_packages/query_filters.html b/public/templates/work_packages/query_filters.html index f1f75957a8..e1ea472af2 100644 --- a/public/templates/work_packages/query_filters.html +++ b/public/templates/work_packages/query_filters.html @@ -2,8 +2,8 @@ class="header_collapsible collapsible" ng-class="{collapsed: !showFilters }"> - - {{ I18n.t('js.work_packages.label_filter_add') }} + + {{ I18n.t('js.work_packages.label_filter_add') }} {{ showFilters ? I18n.t('js.label_expanded') : I18n.t('js.label_collapsed') }} diff --git a/public/templates/work_packages/work_packages_options.html b/public/templates/work_packages/work_packages_options.html index dfb349a1f4..6d007cc5f5 100644 --- a/public/templates/work_packages/work_packages_options.html +++ b/public/templates/work_packages/work_packages_options.html @@ -8,7 +8,10 @@ ng-class="{collapsed: !showQueryOptions }"> - {{ I18n.t('js.work_packages.label_options') }} + + {{ I18n.t('js.work_packages.label_options') }} + {{ showFilters ? I18n.t('js.label_expanded') : I18n.t('js.label_collapsed') }} +
diff --git a/spec/features/accessibility/custom_fields_spec.rb b/spec/features/accessibility/custom_fields_spec.rb index 6e80a04b78..53c4e90e25 100644 --- a/spec/features/accessibility/custom_fields_spec.rb +++ b/spec/features/accessibility/custom_fields_spec.rb @@ -179,7 +179,7 @@ describe 'Custom field accessibility' do type: type, custom_values: { custom_field.id => 'value' }) } - describe 'index' do + describe 'index', js: true do shared_context "index page with query" do let!(:query) do query = FactoryGirl.build(:query, project: project) diff --git a/spec/features/accessibility/support/toggable_fieldsets_spec.rb b/spec/features/accessibility/support/toggable_fieldsets_spec.rb index 1d16b92a34..db4e8c0124 100644 --- a/spec/features/accessibility/support/toggable_fieldsets_spec.rb +++ b/spec/features/accessibility/support/toggable_fieldsets_spec.rb @@ -31,14 +31,8 @@ require 'features/work_packages/work_packages_page' describe 'Toggable fieldset' do shared_context 'find legend with text' do - let(:legend_text) { find('legend a', text: fieldset_name) } - let(:fieldset) { legend_text.find(:xpath, '../..') } - end - - shared_context 'find toggle label' do - let(:toggle_state_label) { legend_text.find('span.fieldset-toggle-state-label', visible: false) } - - it { expect(toggle_state_label).not_to be_nil } + let(:legend_text) { find('legend a span', text: fieldset_name) } + let(:fieldset) { legend_text.find(:xpath, '../../..') } end shared_examples_for 'toggable fieldset initially collapsed' do @@ -46,8 +40,6 @@ describe 'Toggable fieldset' do describe 'initial state', js: true do include_context 'find legend with text' - - it_behaves_like 'toggle state set collapsed' end describe 'after click', js: true do @@ -55,7 +47,7 @@ describe 'Toggable fieldset' do before { legend_text.click } - it_behaves_like 'toggle state set expanded' + it_behaves_like 'expanded fieldset' end end @@ -65,7 +57,6 @@ describe 'Toggable fieldset' do describe 'initial state', js: true do include_context 'find legend with text' - it_behaves_like 'toggle state set expanded' end describe 'after click', js: true do @@ -73,24 +64,10 @@ describe 'Toggable fieldset' do before { legend_text.click } - it_behaves_like 'toggle state set collapsed' + it_behaves_like 'collapsed fieldset' end end - shared_examples_for 'toggle state set collapsed' do - include_context 'find legend with text' - include_context 'find toggle label' - - it { expect(toggle_state_label.text(:all)).to include(I18n.t('js.label_collapsed')) } - end - - shared_examples_for 'toggle state set expanded' do - include_context 'find legend with text' - include_context 'find toggle label' - - it { expect(toggle_state_label.text(:all)).to include(I18n.t('js.label_expanded')) } - end - shared_context 'collapsed CSS' do let(:collapsed_class_name) { 'collapsed' } end diff --git a/spec/features/accessibility/work_packages/index_toggable_fieldsets_spec.rb b/spec/features/accessibility/work_packages/index_toggable_fieldsets_spec.rb index 113db5bb4c..8ca9815e3e 100644 --- a/spec/features/accessibility/work_packages/index_toggable_fieldsets_spec.rb +++ b/spec/features/accessibility/work_packages/index_toggable_fieldsets_spec.rb @@ -31,7 +31,7 @@ require 'features/accessibility/support/toggable_fieldsets_spec' require 'features/work_packages/work_packages_page' describe 'Work package index' do - describe 'Toggable fieldset' do + describe 'Toggable fieldset', js: true do let(:current_user) { FactoryGirl.create (:admin) } let(:work_packages_page) { WorkPackagesPage.new } @@ -43,7 +43,7 @@ describe 'Work package index' do describe 'Filter fieldset' do it_behaves_like 'toggable fieldset initially expanded' do - let(:fieldset_name) { 'Filters' } + let(:fieldset_name) { 'Add filter' } end end