[otrs-cvs] otrs/var/httpd/htdocs/js/test Core.App.UnitTest.js, 1.3, 1.4 JSUnitTest.html, 1.22, 1.23

"CVS commits notifications of OTRS.org" <[email protected]>
Newsgroups gmane.comp.otrs.cvs
Message-ID <[email protected]>
Comments:
Update of /home/cvs/otrs/var/httpd/htdocs/js/test
In directory lancelot:/tmp/cvs-serv30876/var/httpd/htdocs/js/test

Modified Files:
	Core.App.UnitTest.js JSUnitTest.html 
Log Message:
Added PubSub to OTRS. Added wrapper functions to Core.App. Added first channels to Core.AJAX.

Author: mn

Index: Core.App.UnitTest.js
===================================================================
RCS file: /home/cvs/otrs/var/httpd/htdocs/js/test/Core.App.UnitTest.js,v
retrieving revision 1.3
retrieving revision 1.4
diff -2 -u -d -r1.3 -r1.4
--- Core.App.UnitTest.js	11 Dec 2012 09:05:42 -0000	1.3
+++ Core.App.UnitTest.js	17 Dec 2012 10:46:20 -0000	1.4
@@ -54,4 +54,43 @@
             $('#testcase').remove();
         });
+
+        test('Core.App.Publish()/Subscribe()', function () {
+            expect(4);
+            var Counter = 0, Handle;
+
+            // Subscribe to channel
+            Handle = Core.App.Subscribe('UNITTEST1', function () {
+                Counter++;
+            })
+
+            // publish channel
+            Core.App.Publish('UNITTEST1');
+
+            equal(Counter, 1);
+
+            // unsubscribe from channel
+            Core.App.Unsubscribe(Handle);
+
+            // publish again
+            Core.App.Publish('UNITTEST1');
+
+            // counter may not have changed
+            equal(Counter, 1);
+
+            Handle = Core.App.Subscribe('UNITTEST2', function (Count) {
+                Counter = Count;
+            });
+
+            // publish with arguments
+            Core.App.Publish('UNITTEST2', [5]);
+
+            equal(Counter, 5);
+
+            Core.App.Unsubscribe(Handle);
+
+            Core.App.Publish('UNITTEST2', [10]);
+
+            equal(Counter, 5);
+        });
     };
 

Author: mn

Index: JSUnitTest.html
===================================================================
RCS file: /home/cvs/otrs/var/httpd/htdocs/js/test/JSUnitTest.html,v
retrieving revision 1.22
retrieving revision 1.23
diff -2 -u -d -r1.22 -r1.23
--- JSUnitTest.html	11 Dec 2012 09:05:42 -0000	1.22
+++ JSUnitTest.html	17 Dec 2012 10:46:20 -0000	1.23
@@ -48,4 +48,5 @@
         Core.AJAX.RunUnitTests();
     </script>
+    <script type="text/javascript" src="../thirdparty/jquery-pubsub/pubsub.js"></script>
     <script type="text/javascript" src="../Core.App.js"></script>
     <script type="text/javascript" src="Core.App.UnitTest.js"></script>
---------------------------------------------------------------------
OTRS mailing list: cvs-log - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/cvs-log
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/cvs-log
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.