WIP. fixed the show/hide options/filters things.

pull/1018/head
Richard 11 years ago
parent 713d7539a1
commit 124d85eaad
  1. 2
      app/assets/javascripts/angular/directives/work_packages/query-filters-directive.js
  2. 4
      public/templates/work_packages/query_filters.html
  3. 5
      public/templates/work_packages/work_packages_options.html
  4. 2
      spec/features/accessibility/custom_fields_spec.rb
  5. 31
      spec/features/accessibility/support/toggable_fieldsets_spec.rb
  6. 4
      spec/features/accessibility/work_packages/index_toggable_fieldsets_spec.rb

@ -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) {

@ -2,8 +2,8 @@
class="header_collapsible collapsible"
ng-class="{collapsed: !showFilters }">
<legend ng-click="showFilters = !showFilters" title="{{showFilters && 'Hide' || 'Show'}} filters">
<a href="">
{{ I18n.t('js.work_packages.label_filter_add') }}
<a href="#">
<span>{{ I18n.t('js.work_packages.label_filter_add') }}</span>
<span class="hidden-for-sighted">{{ showFilters ? I18n.t('js.label_expanded') : I18n.t('js.label_collapsed') }}</span>
</a>
</legend>

@ -8,7 +8,10 @@
ng-class="{collapsed: !showQueryOptions }">
<legend title="{{ showQueryOptions && I18n.t('js.work_packages.description_options_hide') || I18n.t('js.work_packages.description_options_show') }}"
ng-click="showQueryOptions = !showQueryOptions">
<a href="">{{ I18n.t('js.work_packages.label_options') }}</a>
<a href="#">
<span>{{ I18n.t('js.work_packages.label_options') }}</span>
<span class="hidden-for-sighted">{{ showFilters ? I18n.t('js.label_expanded') : I18n.t('js.label_collapsed') }}</span>
</a>
</legend>
<div slide-toggle collapsed="!showQueryOptions" class="tabular">

@ -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)

@ -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

@ -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

Loading…
Cancel
Save