From de35dfb2eb58ba2429fe5c7262819bea766f66c6 Mon Sep 17 00:00:00 2001 From: Wieland Lindenthal Date: Thu, 23 Mar 2017 16:57:13 +0100 Subject: [PATCH] Extend "Reset to defaults" to reset attribute visibility, too. --- .../types-form-configuration.controller.ts | 1 + spec/features/types/form_configuration_spec.rb | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/app/components/types/form-configuration/types-form-configuration.controller.ts b/frontend/app/components/types/form-configuration/types-form-configuration.controller.ts index 1dce304755..7f4f855d1e 100644 --- a/frontend/app/components/types/form-configuration/types-form-configuration.controller.ts +++ b/frontend/app/components/types/form-configuration/types-form-configuration.controller.ts @@ -49,6 +49,7 @@ function typesFormConfigurationCtrl( $scope.resetToDefault = ($event: any): void => { let form: JQuery = angular.element($event.target).parents('form'); angular.element('input#type_attribute_groups').first().val(JSON.stringify([])); + angular.element('input#type_attribute_visibility').first().val(JSON.stringify({})); form.submit(); }; diff --git a/spec/features/types/form_configuration_spec.rb b/spec/features/types/form_configuration_spec.rb index 2f6f38947d..26c02abd1c 100644 --- a/spec/features/types/form_configuration_spec.rb +++ b/spec/features/types/form_configuration_spec.rb @@ -136,10 +136,14 @@ describe 'form configuration', type: :feature, js: true do it 'resets the form properly after changes' do rename_group('Details', 'Whatever') + set_visibility(:assignee, checked: true) + expect_attribute(key: :assignee, checked: true) + reset_button.click expect(page).to have_no_selector(group_selector('Whatever')) expect_group('Details') + expect_attribute(key: :assignee, checked: false) end it 'detects errors for duplicate group names' do @@ -267,4 +271,3 @@ describe 'form configuration', type: :feature, js: true do loading_indicator_saveguard end end -