From 6b19b2dc895b862d00eaf1eb4f047282418f598c Mon Sep 17 00:00:00 2001 From: Petr Vobornik Date: Tue, 30 Aug 2011 13:39:53 +0200 Subject: Enable update and reset button only if dirty https://fedorahosted.org/freeipa/ticket/1697 Original problem: WEBUI: Update automount location refer to unknown command Update name of the automount location (Policy -> Automount -> custom_location -> Settings -> Update) in the WEBUI refer to an unknown command. Solution: Tracking dirty state in field -> section -> details facet. 'Reset' and 'Updates' in details facet are enabled only if facet is dirty. Removes the problem above and 'no modification to be performed' annoyance. --- install/ui/test/ipa_tests.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'install/ui/test/ipa_tests.js') diff --git a/install/ui/test/ipa_tests.js b/install/ui/test/ipa_tests.js index 079b022b..0a4d657f 100644 --- a/install/ui/test/ipa_tests.js +++ b/install/ui/test/ipa_tests.js @@ -312,3 +312,35 @@ test("Testing unsuccessful IPA.command().", function() { $.ajax = orig; }); + +test("Testing observer.", function() { + expect(6); + var obj = {}; + var param1_value = 'p1'; + var param2_value = 'p2'; + + obj.event = IPA.observer(); + + obj.event.attach(function(param1, param2) { + ok(true, "Proper function 1 callback"); + }); + + var first = true; + + var func = function(param1, param2) { + if(first) { + ok(true, "Proper function 2 callback"); + equals(param1, param1_value, "Testing Parameter 1"); + equals(param2, param2_value, "Testing Parameter 2"); + equals(this, obj, "Testing Context"); + first = false; + } else { + ok(false, "Fail function 2 callback"); + } + } + + obj.event.attach(func); + obj.event.notify([param1_value, param2_value], obj); + obj.event.detach(func); + obj.event.notify([param1_value, param2_value], obj); +}); -- cgit