summaryrefslogtreecommitdiffstats
path: root/install/ui/test
diff options
context:
space:
mode:
authorPetr Vobornik <pvoborni@redhat.com>2011-08-30 13:39:53 +0200
committerEndi S. Dewata <edewata@redhat.com>2011-08-31 05:09:11 +0000
commit776af82572b56d9c66a2eadabdb5bced9316648a (patch)
treef66ac15ee4dd1fdb7b68c901b908f56bb718d356 /install/ui/test
parent44dafb18cec8f1f225b6aaa7ec300446993853de (diff)
downloadfreeipa-776af82572b56d9c66a2eadabdb5bced9316648a.tar.gz
freeipa-776af82572b56d9c66a2eadabdb5bced9316648a.tar.xz
freeipa-776af82572b56d9c66a2eadabdb5bced9316648a.zip
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.
Diffstat (limited to 'install/ui/test')
-rw-r--r--install/ui/test/ipa_tests.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/install/ui/test/ipa_tests.js b/install/ui/test/ipa_tests.js
index 079b022b3..0a4d657f8 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);
+});