From 3185eaf50b2d0ce84317f8b6aa0a334803ea70c5 Mon Sep 17 00:00:00 2001 From: Jens Ulferts Date: Wed, 13 Jan 2016 15:59:29 +0100 Subject: [PATCH 1/6] establish accessibility for work package attributes --- config/locales/js-en.yml | 3 ++ .../display-pane/display-pane.directive.html | 1 + .../display-pane/display-pane.directive.js | 4 +++ .../display-spent-time.directive.html | 13 ++++++-- .../display-user/display-user.directive.html | 3 +- .../display-version.directive.html | 11 +++++-- .../services/work-package-field.service.js | 30 +++++++++++++++++++ .../routing/views/work-packages.show.html | 4 ++- .../components/accessible_by_keyboard.html | 1 + .../inplace-edit/display/fields/embedded.html | 7 ++++- .../inplace-edit/display/fields/text.html | 14 +++++++-- .../accessible-by-keyboard-directive.js | 3 +- 12 files changed, 82 insertions(+), 12 deletions(-) diff --git a/config/locales/js-en.yml b/config/locales/js-en.yml index 2378dd331c..69ac59cb51 100644 --- a/config/locales/js-en.yml +++ b/config/locales/js-en.yml @@ -360,6 +360,8 @@ en: description_options_show: "Show options" error: "An error has occured." error_update_failed: "The work package could not be updated." + edit_attribute: "%{attribute} - Edit" + key_value: "%{key}: %{value}" label_enable_multi_select: "Enable multiselect" label_disable_multi_select: "Disable multiselect" label_filter_add: "Add filter" @@ -367,6 +369,7 @@ en: label_column_multiselect: "Combined dropdown field: Select with arrow keys, confirm selection with enter, delete with backspace" message_error_during_bulk_delete: An error occurred while trying to delete work packages. message_successful_bulk_delete: Successfully deleted work packages. + no_value: "No value" create: header: 'New Work Package' header_with_parent: 'New work package (Child of %{type} #%{id})' diff --git a/frontend/app/components/inplace-edit/directives/display-pane/display-pane.directive.html b/frontend/app/components/inplace-edit/directives/display-pane/display-pane.directive.html index 7ab6e5abd1..70017d2ce8 100644 --- a/frontend/app/components/inplace-edit/directives/display-pane/display-pane.directive.html +++ b/frontend/app/components/inplace-edit/directives/display-pane/display-pane.directive.html @@ -5,6 +5,7 @@ span-class="inplace-editing--container" link-class="inplace-editing--trigger-link" link-title="{{ fieldController.editTitle }}" + aria-label="{{ displayPaneController.getAriaLabel() }}" execute="displayPaneController.startEditing()"> - {{ field.placeholder }} + + {{ field.placeholder }} + - + {{ field.text }} - + {{ field.text }} diff --git a/frontend/app/components/inplace-edit/directives/field-display/display-user/display-user.directive.html b/frontend/app/components/inplace-edit/directives/field-display/display-user/display-user.directive.html index cbefe3c7f9..c8988cb956 100644 --- a/frontend/app/components/inplace-edit/directives/field-display/display-user/display-user.directive.html +++ b/frontend/app/components/inplace-edit/directives/field-display/display-user/display-user.directive.html @@ -8,7 +8,8 @@ + class="user-field-user-link" + aria-label="{{field.getKeyValue()}}"> {{user.name}} - + {{field.placeholder}} - + {{field.text.props.name}} - + {{field.text.props.name}} diff --git a/frontend/app/components/inplace-edit/services/work-package-field.service.js b/frontend/app/components/inplace-edit/services/work-package-field.service.js index 4a4f63256b..9679916b84 100644 --- a/frontend/app/components/inplace-edit/services/work-package-field.service.js +++ b/frontend/app/components/inplace-edit/services/work-package-field.service.js @@ -189,6 +189,35 @@ function WorkPackageFieldService($q, $http, $filter, I18n, WorkPackagesHelper, return schema.props[field].name; } + function getKeyValue(workPackage, field) { + var label = getLabel(workPackage, field); + var value = WorkPackageFieldService.format(workPackage, field); + + if (value === null) { + value = I18n.t('js.work_packages.no_value'); + } + else if (value && value.raw) { + var shortened = value.raw.length > 20; + + value = $filter('limitTo')(value.raw, 20); + if (shortened) { + value += '...'; + } + } + else if(value && value.props && value.props.name) { + value = value.props.name; + } + else if(value && value.props && value.props.subject) { + value = value.props.subject; + } + else if(field === 'date' && !isMilestone(workPackage)) { + value = (value.startDate || I18n.t('js.label_no_start_date')) + ' - ' + + (value.dueDate || I18n.t('js.label_no_due_date')); + } + + return I18n.t('js.work_packages.key_value', { key: label, value: value }); + } + function isEmpty(workPackage, field) { if (field === 'date') { return ( @@ -394,6 +423,7 @@ function WorkPackageFieldService($q, $http, $filter, I18n, WorkPackagesHelper, isSavedAsLink: isSavedAsLink, getValue: getValue, getLabel: getLabel, + getKeyValue: getKeyValue, getAllowedValues: getAllowedValues, allowedValuesEmbedded: allowedValuesEmbedded, format: format, diff --git a/frontend/app/components/routing/views/work-packages.show.html b/frontend/app/components/routing/views/work-packages.show.html index b195f26bac..f80a1f3ebf 100644 --- a/frontend/app/components/routing/views/work-packages.show.html +++ b/frontend/app/components/routing/views/work-packages.show.html @@ -115,7 +115,9 @@
+ ng-repeat-start="field in group.attributes" + class="attributes-key-value--key" + id="attributes-key-value--key-{{field}}"> {{vm.getLabel(vm.workPackage, field)}} *
diff --git a/frontend/app/templates/components/accessible_by_keyboard.html b/frontend/app/templates/components/accessible_by_keyboard.html index 8e60983f00..d604fe53e8 100644 --- a/frontend/app/templates/components/accessible_by_keyboard.html +++ b/frontend/app/templates/components/accessible_by_keyboard.html @@ -1,6 +1,7 @@ diff --git a/frontend/app/templates/inplace-edit/display/fields/embedded.html b/frontend/app/templates/inplace-edit/display/fields/embedded.html index 26d75daba5..a0e4dcec1f 100644 --- a/frontend/app/templates/inplace-edit/display/fields/embedded.html +++ b/frontend/app/templates/inplace-edit/display/fields/embedded.html @@ -1 +1,6 @@ - + + diff --git a/frontend/app/templates/inplace-edit/display/fields/text.html b/frontend/app/templates/inplace-edit/display/fields/text.html index 0e6459bad1..864a3cd0fe 100644 --- a/frontend/app/templates/inplace-edit/display/fields/text.html +++ b/frontend/app/templates/inplace-edit/display/fields/text.html @@ -1,2 +1,12 @@ - - + + + + diff --git a/frontend/app/ui_components/accessible-by-keyboard-directive.js b/frontend/app/ui_components/accessible-by-keyboard-directive.js index d39795301c..c5f50d0dc7 100644 --- a/frontend/app/ui_components/accessible-by-keyboard-directive.js +++ b/frontend/app/ui_components/accessible-by-keyboard-directive.js @@ -34,7 +34,8 @@ module.exports = function() { execute: '&', linkClass: '@', linkTitle: '@', - spanClass: '@' + spanClass: '@', + ariaLabel: '@' }, templateUrl: '/templates/components/accessible_by_keyboard.html' }; From cc86ebc8e67c22f94eb9c54e11c4cc4cdf27227c Mon Sep 17 00:00:00 2001 From: Jens Ulferts Date: Thu, 14 Jan 2016 10:24:38 +0100 Subject: [PATCH 2/6] writing custom directive for accessible-wp-attribute --- .../display-spent-time.directive.html | 6 +- .../display-version.directive.html | 6 +- .../inplace-edit/display/fields/boolean.html | 3 +- .../display/fields/date-range.html | 6 +- .../inplace-edit/display/fields/embedded.html | 6 +- .../inplace-edit/display/fields/text.html | 14 +-- .../display/fields/wiki-textarea.html | 3 +- .../app/work_packages/directives/index.js | 3 + ...-package-accessible-attribute-directive.js | 49 ++++++++++ ...age-accessible-attribute-directive-test.js | 91 +++++++++++++++++++ 10 files changed, 161 insertions(+), 26 deletions(-) create mode 100644 frontend/app/work_packages/directives/work-package-accessible-attribute-directive.js create mode 100644 frontend/tests/unit/tests/work_packages/directives/work-package-accessible-attribute-directive-test.js diff --git a/frontend/app/components/inplace-edit/directives/field-display/display-spent-time/display-spent-time.directive.html b/frontend/app/components/inplace-edit/directives/field-display/display-spent-time/display-spent-time.directive.html index 3f577f98c5..b55805f197 100644 --- a/frontend/app/components/inplace-edit/directives/field-display/display-spent-time/display-spent-time.directive.html +++ b/frontend/app/components/inplace-edit/directives/field-display/display-spent-time/display-spent-time.directive.html @@ -1,7 +1,6 @@
+ work-package-accessible-attribute="field"> {{ field.placeholder }} @@ -12,8 +11,7 @@ + work-package-accessible-attribute="field"> {{ field.text }} diff --git a/frontend/app/components/inplace-edit/directives/field-display/display-version/display-version.directive.html b/frontend/app/components/inplace-edit/directives/field-display/display-version/display-version.directive.html index 0ef3d44776..15a094d51c 100644 --- a/frontend/app/components/inplace-edit/directives/field-display/display-version/display-version.directive.html +++ b/frontend/app/components/inplace-edit/directives/field-display/display-version/display-version.directive.html @@ -1,7 +1,6 @@
+ work-package-accessible-attribute="field"> {{field.placeholder}} @@ -11,8 +10,7 @@ + work-package-accessible-attribute="field"> {{field.text.props.name}}
diff --git a/frontend/app/templates/inplace-edit/display/fields/boolean.html b/frontend/app/templates/inplace-edit/display/fields/boolean.html index 6218fe54f5..2053da2aa1 100644 --- a/frontend/app/templates/inplace-edit/display/fields/boolean.html +++ b/frontend/app/templates/inplace-edit/display/fields/boolean.html @@ -1 +1,2 @@ - + diff --git a/frontend/app/templates/inplace-edit/display/fields/date-range.html b/frontend/app/templates/inplace-edit/display/fields/date-range.html index 7544d602be..7c56456cbb 100644 --- a/frontend/app/templates/inplace-edit/display/fields/date-range.html +++ b/frontend/app/templates/inplace-edit/display/fields/date-range.html @@ -1 +1,5 @@ -  -   + + +   -   + + diff --git a/frontend/app/templates/inplace-edit/display/fields/embedded.html b/frontend/app/templates/inplace-edit/display/fields/embedded.html index a0e4dcec1f..a04aaee643 100644 --- a/frontend/app/templates/inplace-edit/display/fields/embedded.html +++ b/frontend/app/templates/inplace-edit/display/fields/embedded.html @@ -1,6 +1,2 @@ - - diff --git a/frontend/app/templates/inplace-edit/display/fields/text.html b/frontend/app/templates/inplace-edit/display/fields/text.html index 864a3cd0fe..5d6d278163 100644 --- a/frontend/app/templates/inplace-edit/display/fields/text.html +++ b/frontend/app/templates/inplace-edit/display/fields/text.html @@ -1,12 +1,6 @@ - - + - - + work-package-accessible-attribute="field"> diff --git a/frontend/app/templates/inplace-edit/display/fields/wiki-textarea.html b/frontend/app/templates/inplace-edit/display/fields/wiki-textarea.html index 49fd253b6b..d2daa65e22 100644 --- a/frontend/app/templates/inplace-edit/display/fields/wiki-textarea.html +++ b/frontend/app/templates/inplace-edit/display/fields/wiki-textarea.html @@ -1 +1,2 @@ - + diff --git a/frontend/app/work_packages/directives/index.js b/frontend/app/work_packages/directives/index.js index b2426e127f..360b02d800 100644 --- a/frontend/app/work_packages/directives/index.js +++ b/frontend/app/work_packages/directives/index.js @@ -87,4 +87,7 @@ angular.module('openproject.workPackages.directives') 'I18n', 'FocusHelper', require('./work-package-watchers-lookup-directive.js') + ]) + .directive('workPackageAccessibleAttribute', [ + require('./work-package-accessible-attribute-directive.js') ]); diff --git a/frontend/app/work_packages/directives/work-package-accessible-attribute-directive.js b/frontend/app/work_packages/directives/work-package-accessible-attribute-directive.js new file mode 100644 index 0000000000..7dc8380c1b --- /dev/null +++ b/frontend/app/work_packages/directives/work-package-accessible-attribute-directive.js @@ -0,0 +1,49 @@ +//-- copyright +// OpenProject is a project management system. +// Copyright (C) 2012-2015 the OpenProject Foundation (OPF) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License version 3. +// +// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: +// Copyright (C) 2006-2013 Jean-Philippe Lang +// Copyright (C) 2010-2013 the ChiliProject Team +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// See doc/COPYRIGHT.rdoc for more details. +//++ + +module.exports = function() { + return { + restrict: 'A', + scope: { + field: '=workPackageAccessibleAttribute' + }, + + link: function(scope, element) { + scope.$watch('field', function(field) { + if (!field.isEditable()) { + angular.element(element).attr('aria-label', field.getKeyValue()) + .attr('tabindex', 0); + } + else { + angular.element(element).removeAttr('aria-label') + .removeAttr('tabindex'); + } + }); + } + }; +}; diff --git a/frontend/tests/unit/tests/work_packages/directives/work-package-accessible-attribute-directive-test.js b/frontend/tests/unit/tests/work_packages/directives/work-package-accessible-attribute-directive-test.js new file mode 100644 index 0000000000..33154cedff --- /dev/null +++ b/frontend/tests/unit/tests/work_packages/directives/work-package-accessible-attribute-directive-test.js @@ -0,0 +1,91 @@ +//-- copyright +// OpenProject is a project management system. +// Copyright (C) 2012-2015 the OpenProject Foundation (OPF) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License version 3. +// +// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: +// Copyright (C) 2006-2013 Jean-Philippe Lang +// Copyright (C) 2010-2013 the ChiliProject Team +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// See doc/COPYRIGHT.rdoc for more details. +//++ + +/*jshint expr: true*/ + +describe('workPackageAccessibleAttributeDirective', function() { + var html = '
'; + var scope, element, $compile; + + beforeEach(module('openproject.workPackages.directives')); + + beforeEach(inject(function(_$compile_, + $rootScope){ + scope = $rootScope.$new(); + + $compile = _$compile_; + })); + + describe('on noneditable fields', function() { + beforeEach(function() { + scope.field = { + isEditable: function() { + return false; + }, + getKeyValue: function() { + return 'myKeyValue'; + } + }; + + element = $compile(html)(scope); + scope.$digest(); + }); + + it('has a tabindex of 0', function() { + expect(element.attr('tabindex')).to.eq('0'); + }); + + it('has an aria-label with the keyValue', function() { + expect(element.attr('aria-label')).to.eq(scope.field.getKeyValue()); + }); + }); + + describe('on editable fields', function() { + beforeEach(function() { + scope.field = { + isEditable: function() { + return true; + }, + getKeyValue: function() { + return 'myKeyValue'; + } + }; + + element = $compile(html)(scope); + scope.$digest(); + }); + + it('has no tabindex', function() { + expect(element.attr('tabindex')).to.eq(undefined); + }); + + it('has an aria-label with the keyValue', function() { + expect(element.attr('aria-label')).to.eq(undefined); + }); + }); +}); From f8f24e4097895565f6a0a6a85131444651cea1b8 Mon Sep 17 00:00:00 2001 From: Alex Dik Date: Thu, 14 Jan 2016 16:54:06 +0100 Subject: [PATCH 3/6] Move WP accessible attribute directive to components --- .../work-package-accessible-attribute.directive.test.ts} | 4 +--- .../work-package-accessible-attribute.directive.ts} | 8 ++++++-- frontend/app/work_packages/directives/index.js | 3 --- 3 files changed, 7 insertions(+), 8 deletions(-) rename frontend/{tests/unit/tests/work_packages/directives/work-package-accessible-attribute-directive-test.js => app/components/work-packages/wp-accessible-attribute/work-package-accessible-attribute.directive.test.ts} (96%) rename frontend/app/{work_packages/directives/work-package-accessible-attribute-directive.js => components/work-packages/wp-accessible-attribute/work-package-accessible-attribute.directive.ts} (90%) diff --git a/frontend/tests/unit/tests/work_packages/directives/work-package-accessible-attribute-directive-test.js b/frontend/app/components/work-packages/wp-accessible-attribute/work-package-accessible-attribute.directive.test.ts similarity index 96% rename from frontend/tests/unit/tests/work_packages/directives/work-package-accessible-attribute-directive-test.js rename to frontend/app/components/work-packages/wp-accessible-attribute/work-package-accessible-attribute.directive.test.ts index 33154cedff..0e0b835dd4 100644 --- a/frontend/tests/unit/tests/work_packages/directives/work-package-accessible-attribute-directive-test.js +++ b/frontend/app/components/work-packages/wp-accessible-attribute/work-package-accessible-attribute.directive.test.ts @@ -26,13 +26,11 @@ // See doc/COPYRIGHT.rdoc for more details. //++ -/*jshint expr: true*/ - describe('workPackageAccessibleAttributeDirective', function() { var html = '
'; var scope, element, $compile; - beforeEach(module('openproject.workPackages.directives')); + beforeEach(angular.mock.module('openproject.workPackages.directives')); beforeEach(inject(function(_$compile_, $rootScope){ diff --git a/frontend/app/work_packages/directives/work-package-accessible-attribute-directive.js b/frontend/app/components/work-packages/wp-accessible-attribute/work-package-accessible-attribute.directive.ts similarity index 90% rename from frontend/app/work_packages/directives/work-package-accessible-attribute-directive.js rename to frontend/app/components/work-packages/wp-accessible-attribute/work-package-accessible-attribute.directive.ts index 7dc8380c1b..9cc6336180 100644 --- a/frontend/app/work_packages/directives/work-package-accessible-attribute-directive.js +++ b/frontend/app/components/work-packages/wp-accessible-attribute/work-package-accessible-attribute.directive.ts @@ -26,7 +26,7 @@ // See doc/COPYRIGHT.rdoc for more details. //++ -module.exports = function() { +function workPackageAccessibleAttribute() { return { restrict: 'A', scope: { @@ -46,4 +46,8 @@ module.exports = function() { }); } }; -}; +} + +angular + .module('openproject.workPackages.directives') + .directive('workPackageAccessibleAttribute', workPackageAccessibleAttribute); diff --git a/frontend/app/work_packages/directives/index.js b/frontend/app/work_packages/directives/index.js index 360b02d800..b2426e127f 100644 --- a/frontend/app/work_packages/directives/index.js +++ b/frontend/app/work_packages/directives/index.js @@ -87,7 +87,4 @@ angular.module('openproject.workPackages.directives') 'I18n', 'FocusHelper', require('./work-package-watchers-lookup-directive.js') - ]) - .directive('workPackageAccessibleAttribute', [ - require('./work-package-accessible-attribute-directive.js') ]); From 7769e559162fc23ab79f027b7a4b6c3ac71af227 Mon Sep 17 00:00:00 2001 From: Alex Dik Date: Thu, 14 Jan 2016 16:59:08 +0100 Subject: [PATCH 4/6] Abbreviate name of the WP accessible attribute directive --- .../display-spent-time/display-spent-time.directive.html | 4 ++-- .../display-version/display-version.directive.html | 4 ++-- ...ve.test.ts => wp-accessible-attribute.directive.test.ts} | 4 ++-- ...te.directive.ts => wp-accessible-attribute.directive.ts} | 6 +++--- .../app/templates/inplace-edit/display/fields/boolean.html | 2 +- .../templates/inplace-edit/display/fields/date-range.html | 2 +- .../app/templates/inplace-edit/display/fields/embedded.html | 2 +- .../app/templates/inplace-edit/display/fields/text.html | 4 ++-- .../inplace-edit/display/fields/wiki-textarea.html | 2 +- 9 files changed, 15 insertions(+), 15 deletions(-) rename frontend/app/components/work-packages/wp-accessible-attribute/{work-package-accessible-attribute.directive.test.ts => wp-accessible-attribute.directive.test.ts} (95%) rename frontend/app/components/work-packages/wp-accessible-attribute/{work-package-accessible-attribute.directive.ts => wp-accessible-attribute.directive.ts} (91%) diff --git a/frontend/app/components/inplace-edit/directives/field-display/display-spent-time/display-spent-time.directive.html b/frontend/app/components/inplace-edit/directives/field-display/display-spent-time/display-spent-time.directive.html index b55805f197..0a5ec7d589 100644 --- a/frontend/app/components/inplace-edit/directives/field-display/display-spent-time/display-spent-time.directive.html +++ b/frontend/app/components/inplace-edit/directives/field-display/display-spent-time/display-spent-time.directive.html @@ -1,6 +1,6 @@
+ wp-accessible-attribute="field"> {{ field.placeholder }} @@ -11,7 +11,7 @@ + wp-accessible-attribute="field"> {{ field.text }} diff --git a/frontend/app/components/inplace-edit/directives/field-display/display-version/display-version.directive.html b/frontend/app/components/inplace-edit/directives/field-display/display-version/display-version.directive.html index 15a094d51c..ce7271bfba 100644 --- a/frontend/app/components/inplace-edit/directives/field-display/display-version/display-version.directive.html +++ b/frontend/app/components/inplace-edit/directives/field-display/display-version/display-version.directive.html @@ -1,6 +1,6 @@
+ wp-accessible-attribute="field"> {{field.placeholder}} @@ -10,7 +10,7 @@ + wp-accessible-attribute="field"> {{field.text.props.name}}
diff --git a/frontend/app/components/work-packages/wp-accessible-attribute/work-package-accessible-attribute.directive.test.ts b/frontend/app/components/work-packages/wp-accessible-attribute/wp-accessible-attribute.directive.test.ts similarity index 95% rename from frontend/app/components/work-packages/wp-accessible-attribute/work-package-accessible-attribute.directive.test.ts rename to frontend/app/components/work-packages/wp-accessible-attribute/wp-accessible-attribute.directive.test.ts index 0e0b835dd4..93c57a838f 100644 --- a/frontend/app/components/work-packages/wp-accessible-attribute/work-package-accessible-attribute.directive.test.ts +++ b/frontend/app/components/work-packages/wp-accessible-attribute/wp-accessible-attribute.directive.test.ts @@ -26,8 +26,8 @@ // See doc/COPYRIGHT.rdoc for more details. //++ -describe('workPackageAccessibleAttributeDirective', function() { - var html = '
'; +describe('wpAccessibleAttributeDirective', function() { + var html = '
'; var scope, element, $compile; beforeEach(angular.mock.module('openproject.workPackages.directives')); diff --git a/frontend/app/components/work-packages/wp-accessible-attribute/work-package-accessible-attribute.directive.ts b/frontend/app/components/work-packages/wp-accessible-attribute/wp-accessible-attribute.directive.ts similarity index 91% rename from frontend/app/components/work-packages/wp-accessible-attribute/work-package-accessible-attribute.directive.ts rename to frontend/app/components/work-packages/wp-accessible-attribute/wp-accessible-attribute.directive.ts index 9cc6336180..5d82b1196e 100644 --- a/frontend/app/components/work-packages/wp-accessible-attribute/work-package-accessible-attribute.directive.ts +++ b/frontend/app/components/work-packages/wp-accessible-attribute/wp-accessible-attribute.directive.ts @@ -26,11 +26,11 @@ // See doc/COPYRIGHT.rdoc for more details. //++ -function workPackageAccessibleAttribute() { +function wpAccessibleAttribute() { return { restrict: 'A', scope: { - field: '=workPackageAccessibleAttribute' + field: '=wpAccessibleAttribute' }, link: function(scope, element) { @@ -50,4 +50,4 @@ function workPackageAccessibleAttribute() { angular .module('openproject.workPackages.directives') - .directive('workPackageAccessibleAttribute', workPackageAccessibleAttribute); + .directive('wpAccessibleAttribute', wpAccessibleAttribute); diff --git a/frontend/app/templates/inplace-edit/display/fields/boolean.html b/frontend/app/templates/inplace-edit/display/fields/boolean.html index 2053da2aa1..b6faef3371 100644 --- a/frontend/app/templates/inplace-edit/display/fields/boolean.html +++ b/frontend/app/templates/inplace-edit/display/fields/boolean.html @@ -1,2 +1,2 @@ + wp-accessible-attribute="field"> diff --git a/frontend/app/templates/inplace-edit/display/fields/date-range.html b/frontend/app/templates/inplace-edit/display/fields/date-range.html index 7c56456cbb..950fffe736 100644 --- a/frontend/app/templates/inplace-edit/display/fields/date-range.html +++ b/frontend/app/templates/inplace-edit/display/fields/date-range.html @@ -1,4 +1,4 @@ - +   -   diff --git a/frontend/app/templates/inplace-edit/display/fields/embedded.html b/frontend/app/templates/inplace-edit/display/fields/embedded.html index a04aaee643..0122544e25 100644 --- a/frontend/app/templates/inplace-edit/display/fields/embedded.html +++ b/frontend/app/templates/inplace-edit/display/fields/embedded.html @@ -1,2 +1,2 @@ - diff --git a/frontend/app/templates/inplace-edit/display/fields/text.html b/frontend/app/templates/inplace-edit/display/fields/text.html index 5d6d278163..35c6899638 100644 --- a/frontend/app/templates/inplace-edit/display/fields/text.html +++ b/frontend/app/templates/inplace-edit/display/fields/text.html @@ -1,6 +1,6 @@ + wp-accessible-attribute="field"> + wp-accessible-attribute="field"> diff --git a/frontend/app/templates/inplace-edit/display/fields/wiki-textarea.html b/frontend/app/templates/inplace-edit/display/fields/wiki-textarea.html index d2daa65e22..500892eaf9 100644 --- a/frontend/app/templates/inplace-edit/display/fields/wiki-textarea.html +++ b/frontend/app/templates/inplace-edit/display/fields/wiki-textarea.html @@ -1,2 +1,2 @@ + wp-accessible-attribute="field"> From aaea37d6973ed68cefe16d320126805c377b6022 Mon Sep 17 00:00:00 2001 From: Alex Dik Date: Thu, 14 Jan 2016 17:04:08 +0100 Subject: [PATCH 5/6] Add some minor changes Using $digest is fine, although $apply is the recommended way to go. --- .../display-spent-time/display-spent-time.directive.html | 2 +- .../wp-accessible-attribute.directive.test.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/app/components/inplace-edit/directives/field-display/display-spent-time/display-spent-time.directive.html b/frontend/app/components/inplace-edit/directives/field-display/display-spent-time/display-spent-time.directive.html index 0a5ec7d589..8dd648180f 100644 --- a/frontend/app/components/inplace-edit/directives/field-display/display-spent-time/display-spent-time.directive.html +++ b/frontend/app/components/inplace-edit/directives/field-display/display-spent-time/display-spent-time.directive.html @@ -5,7 +5,7 @@ - {{ field.text }} diff --git a/frontend/app/components/work-packages/wp-accessible-attribute/wp-accessible-attribute.directive.test.ts b/frontend/app/components/work-packages/wp-accessible-attribute/wp-accessible-attribute.directive.test.ts index 93c57a838f..acfe152b2d 100644 --- a/frontend/app/components/work-packages/wp-accessible-attribute/wp-accessible-attribute.directive.test.ts +++ b/frontend/app/components/work-packages/wp-accessible-attribute/wp-accessible-attribute.directive.test.ts @@ -51,7 +51,7 @@ describe('wpAccessibleAttributeDirective', function() { }; element = $compile(html)(scope); - scope.$digest(); + scope.$apply(); }); it('has a tabindex of 0', function() { @@ -75,7 +75,7 @@ describe('wpAccessibleAttributeDirective', function() { }; element = $compile(html)(scope); - scope.$digest(); + scope.$apply(); }); it('has no tabindex', function() { From e81588f45ea160c005d4890419c3b54902456520 Mon Sep 17 00:00:00 2001 From: Jens Ulferts Date: Mon, 18 Jan 2016 12:51:46 +0100 Subject: [PATCH 6/6] adapt test --- .../work-packages/details-pane/date-range-picker-spec.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/tests/integration/specs/work-packages/details-pane/date-range-picker-spec.js b/frontend/tests/integration/specs/work-packages/details-pane/date-range-picker-spec.js index e99f790219..e0b57c2986 100644 --- a/frontend/tests/integration/specs/work-packages/details-pane/date-range-picker-spec.js +++ b/frontend/tests/integration/specs/work-packages/details-pane/date-range-picker-spec.js @@ -33,7 +33,7 @@ var expect = require('../../../spec_helper.js').expect, datepicker = detailsPaneHelper.datepicker, elements = detailsPaneHelper.elements; -describe.only('details pane', function() { +describe('details pane', function() { var dateRangePicker; var normalizeString = function(string) { @@ -104,7 +104,7 @@ describe.only('details pane', function() { var read_value = dateRangePicker.$('.inplace-edit--read-value'); var text = read_value.getText().then(function(value) { return normalizeString(value) } ); - expect(text).to.eventually.equal('02/17/2015 - 04/29/2015'); + expect(text).to.eventually.equal('02/17/2015 - 04/29/2015'); }); }); @@ -385,7 +385,7 @@ describe.only('details pane', function() { var read_value = dateRangePicker.$('.inplace-edit--read-value'); var text = read_value.getText().then(function(value) { return normalizeString(value) }); - expect(text).to.eventually.equal('no start date - 12/27/2014'); + expect(text).to.eventually.equal('no start date - 12/27/2014'); }); }); @@ -450,7 +450,7 @@ describe.only('details pane', function() { var read_value = dateRangePicker.$('.inplace-edit--read-value'); var text = read_value.getText().then(function(value) { return normalizeString(value) }); - expect(text).to.eventually.equal('10/23/2014 - no end date'); + expect(text).to.eventually.equal('10/23/2014 - no end date'); }); });