GID field should be enabled by default since the default group is posix.
Was caused by option_widget_base not properly reporting value change while selecting the default value. It has to be notified with delay otherwise the event is consumed by FieldBinder. https://fedorahosted.org/freeipa/ticket/4325 -- Petr Vobornik
From e1305b80d99d03627128083737c43ede97d61a5b Mon Sep 17 00:00:00 2001 From: Petr Vobornik <pvobo...@redhat.com> Date: Thu, 24 Apr 2014 16:32:07 +0200 Subject: [PATCH] webui: fix regression: enabled gid field on group add GID field should be enabled by default since the default group is posix. Was caused by option_widget_base not properly reporting value change while selecting the default value. It has to be notified with delay otherwise the event is consumed by FieldBinder. https://fedorahosted.org/freeipa/ticket/4325 --- install/ui/src/freeipa/group.js | 7 ++++--- install/ui/src/freeipa/widget.js | 2 ++ ipatests/test_webui/test_group.py | 31 +++++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/install/ui/src/freeipa/group.js b/install/ui/src/freeipa/group.js index f2103f8e8c2069568d601dbffe8383db24f9a225..3961384dc4b2e769ddaa0b2d3f165cc48ad471a1 100644 --- a/install/ui/src/freeipa/group.js +++ b/install/ui/src/freeipa/group.js @@ -21,6 +21,7 @@ */ define([ + 'dojo/on', './ipa', './jquery', './phases', @@ -29,7 +30,7 @@ define([ './search', './association', './entity'], - function(IPA, $, phases, reg) { + function(on, IPA, $, phases, reg) { var exp = IPA.group = {}; @@ -197,14 +198,14 @@ IPA.group_adder_dialog = function(spec) { var init = function() { var type_field = that.fields.get_field('type'); - type_field.widget.value_changed.attach(that.on_type_change); + on(type_field, 'value-change', that.on_type_change); }; that.on_type_change = function() { var type_field = that.fields.get_field('type'); var gid_field = that.fields.get_field('gidnumber'); - var posix = type_field.save()[0] === 'posix'; + var posix = type_field.get_value()[0] === 'posix'; if (!posix) { gid_field.reset(); diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js index 212fc1c445e05b5c20c2ccfc7ad4beae4fc5c15e..f49e706a948ec7418dd8c8d68e0e0c87f58ec847 100644 --- a/install/ui/src/freeipa/widget.js +++ b/install/ui/src/freeipa/widget.js @@ -1590,6 +1590,8 @@ IPA.option_widget_base = function(spec, that) { // select default if none specified if (that.default_value !== null) { check(that._selector+'[value="'+that.default_value+'"]'); + // default was selected instead of supplied value, hence notify + util.emit_delayed(that, 'value-change', { source: that }); } else { // otherwise select empty check(that._selector+'[value=""]'); diff --git a/ipatests/test_webui/test_group.py b/ipatests/test_webui/test_group.py index 8f9229b02546f478872ef8c45c5def906cf46ae7..06b34d0894931c1f4b5aca4983a0174ee9e209b4 100644 --- a/ipatests/test_webui/test_group.py +++ b/ipatests/test_webui/test_group.py @@ -43,6 +43,37 @@ class test_group(UI_driver): default_facet=group.DEFAULT_FACET) @screenshot + def test_group_types(self): + """ + Test group types in adder dialog + """ + self.init_app() + + pkey = 'itest-group' + data = { + 'pkey': pkey, + 'add': [ + ('callback', self.check_posix_enabled, True), + ('textbox', 'cn', pkey), + ('textarea', 'description', 'test-group desc'), + ('radio', 'type', 'normal'), + ('callback', self.check_posix_enabled, False), + ('radio', 'type', 'posix'), + ('callback', self.check_posix_enabled, True), + ('radio', 'type', 'external'), + ('callback', self.check_posix_enabled, False), + ('radio', 'type', 'posix'), + ('callback', self.check_posix_enabled, True), + ], + } + + self.add_record(group.ENTITY, data) + self.delete(group.ENTITY, [data], navigate=False) + + def check_posix_enabled(self, enabled): + self.assert_disabled("[name=gidnumber]", negative=enabled) + + @screenshot def test_actions(self): """ Test group actions -- 1.9.0
_______________________________________________ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel