Author: reebalazs
Date: Sun Dec 30 13:32:58 2007
New Revision: 50194

Added:
   
kukit/kss.core/branch/finish-closures/kss/core/plugins/core/demo/binderclasses/
   
kukit/kss.core/branch/finish-closures/kss/core/plugins/core/demo/binderclasses/README
   
kukit/kss.core/branch/finish-closures/kss/core/plugins/core/demo/binderclasses/__init__.py
   
kukit/kss.core/branch/finish-closures/kss/core/plugins/core/demo/binderclasses/configure.zcml
   
kukit/kss.core/branch/finish-closures/kss/core/plugins/core/demo/binderclasses/kss_binder_classes.js
   
kukit/kss.core/branch/finish-closures/kss/core/plugins/core/demo/binderclasses/kss_binder_classes.kss
   
kukit/kss.core/branch/finish-closures/kss/core/plugins/core/demo/binderclasses/kss_binder_classes.pt
   
kukit/kss.core/branch/finish-closures/kss/core/plugins/core/demo/binderclasses/selenium_tests/
   
kukit/kss.core/branch/finish-closures/kss/core/plugins/core/demo/binderclasses/selenium_tests/README.txt
   
kukit/kss.core/branch/finish-closures/kss/core/plugins/core/demo/binderclasses/selenium_tests/binderclasses.html
   
kukit/kss.core/branch/finish-closures/kss/core/plugins/core/demo/binderclasses/zopeconfig.py
   
kukit/kss.core/branch/finish-closures/kss/core/plugins/core/demo/selenium_tests/binderclasses_temporary.html
Modified:
   
kukit/kss.core/branch/finish-closures/kss/core/plugins/core/demo/configure.zcml
   
kukit/kss.core/branch/finish-closures/kss/core/plugins/core/demo/selenium_tests/suite.html
Log:
Add the binderclasses test to demonstrate the necessity of the following fixes

Added: 
kukit/kss.core/branch/finish-closures/kss/core/plugins/core/demo/binderclasses/README
==============================================================================
--- (empty file)
+++ 
kukit/kss.core/branch/finish-closures/kss/core/plugins/core/demo/binderclasses/README
       Sun Dec 30 13:32:58 2007
@@ -0,0 +1,7 @@
+
+
+I put this demos under the subdirectory demo_for_binderids.
+This is temporary, the demo will be merged under "demos" when
+they are relocated from kss.demo to here.
+
+(ree)

Added: 
kukit/kss.core/branch/finish-closures/kss/core/plugins/core/demo/binderclasses/__init__.py
==============================================================================
--- (empty file)
+++ 
kukit/kss.core/branch/finish-closures/kss/core/plugins/core/demo/binderclasses/__init__.py
  Sun Dec 30 13:32:58 2007
@@ -0,0 +1,4 @@
+"""\
+Module init
+"""
+

Added: 
kukit/kss.core/branch/finish-closures/kss/core/plugins/core/demo/binderclasses/configure.zcml
==============================================================================
--- (empty file)
+++ 
kukit/kss.core/branch/finish-closures/kss/core/plugins/core/demo/binderclasses/configure.zcml
       Sun Dec 30 13:32:58 2007
@@ -0,0 +1,49 @@
+<configure xmlns="http://namespaces.zope.org/zope";
+           xmlns:browser="http://namespaces.zope.org/browser";
+           xmlns:kss="http://namespaces.zope.org/kss";
+                  i18n_domain="kss"
+                  >
+
+  <!--
+    Set up the demos
+  -->
+
+  <!-- Set up the demo utility, needed for registration -->
+  <utility
+    name="core_demo_for_binderclasses"
+    factory=".zopeconfig.KSSDemos"
+    provides="kss.demo.interfaces.IKSSDemoResource"
+    permission="zope.Public"
+    />
+
+  <!-- Set up resources needed for the demo -->
+  <browser:page
+      for="kss.demo.interfaces.ISimpleContent"
+      template="kss_binder_classes.pt"
+      name="kss_binder_classes.html"
+      permission="zope.View"
+      />
+
+  <browser:resource
+    file="kss_binder_classes.kss"
+    name="kss_binder_classes.kss"
+    />
+
+    <!-- set up kss --> 
+    <kss:eventtype
+        name="testbinderclass-alphaone"
+        jsfile="kss_binder_classes.js"
+        />
+
+    <kss:eventtype
+        name="testbinderclass-betaone"
+        jsfile="kss_binder_classes.js"
+        />
+
+    <kss:eventtype
+        name="testbinderclass-betatwo"
+        jsfile="kss_binder_classes.js"
+        />
+
+</configure>
+

Added: 
kukit/kss.core/branch/finish-closures/kss/core/plugins/core/demo/binderclasses/kss_binder_classes.js
==============================================================================
--- (empty file)
+++ 
kukit/kss.core/branch/finish-closures/kss/core/plugins/core/demo/binderclasses/kss_binder_classes.js
        Sun Dec 30 13:32:58 2007
@@ -0,0 +1,63 @@
+
+/*
+ * Event plugins for the binderclasses demo
+ *
+ * We test several things here:
+ *
+ * - Inheritence can be used to set up the event binder class.
+ *   The __bind_click__ method is accessable from the subclass.
+ *
+ * - The event binder can have a constructor, and what is set up in the 
constructor
+ *   will become a property of the instance, not of the class.
+ *
+ * - Event names defined on the same class, will be bound to the same
+ *   class, not different ones. This means if the events bind to the same
+ *   instance id, they share a common state.
+ */
+
+(function () {           // BEGIN CLOSURE
+
+var AlphaBinder = function() {
+    this.counter = [50];
+
+    this.customBind = function(name, func_to_bind, oper) {
+        // validate and set parameters
+        oper.evaluateParameters([], {}, 'testbinderclasses event binding');
+        // Apply a filter before the execute actions hook.
+        // It always returns true, causing the actions to execute
+        // always.
+        // It sets up the counter on it, which can be used
+        // from action parameters as pass(counter).
+        var self = this;
+        var filter = function(oper) {
+            oper.defaultParameters = {
+                    counter:  '[' + self.counter[0] + ']'};
+            self.counter[0]++;
+            return true;
+        }
+        // register this as a "click" browser event
+        kukit.pl.registerBrowserEvent(oper, filter, 'click');
+
+    };
+
+    this._prepareExecuteActions = function(oper) {
+        // Set up the execution of the actions.
+        // Make counter available from action parameters 
+        // as pass(counter).
+    };
+
+};
+
+kukit.eventsGlobalRegistry.register('testbinderclass', 'alphaone', 
AlphaBinder, 'customBind', null);
+
+
+var BetaBinder = function(name, func_to_bind, oper) {
+    this.counter = [100];
+};
+// inherited from AlphaBinder
+BetaBinder.prototype = new AlphaBinder();
+
+kukit.eventsGlobalRegistry.register('testbinderclass', 'betaone', BetaBinder, 
'customBind', null);
+kukit.eventsGlobalRegistry.register('testbinderclass', 'betatwo', BetaBinder, 
'customBind', null);
+
+})();            // END CLOSURE

Added: 
kukit/kss.core/branch/finish-closures/kss/core/plugins/core/demo/binderclasses/kss_binder_classes.kss
==============================================================================
--- (empty file)
+++ 
kukit/kss.core/branch/finish-closures/kss/core/plugins/core/demo/binderclasses/kss_binder_classes.kss
       Sun Dec 30 13:32:58 2007
@@ -0,0 +1,12 @@
+
+
+
+
+#alpha1:testbinderclass-alphaone,
+#beta1:testbinderclass-betaone,
+#beta2:testbinderclass-betatwo {
+    action-client: insertHTMLAsLastChild;
+    insertHTMLAsLastChild-kssSelector: #logger;
+    insertHTMLAsLastChild-html: pass(counter);
+}
+

Added: 
kukit/kss.core/branch/finish-closures/kss/core/plugins/core/demo/binderclasses/kss_binder_classes.pt
==============================================================================
--- (empty file)
+++ 
kukit/kss.core/branch/finish-closures/kss/core/plugins/core/demo/binderclasses/kss_binder_classes.pt
        Sun Dec 30 13:32:58 2007
@@ -0,0 +1,44 @@
+<html tal:define="viewname string:kss_binder_classes">
+  <head>
+    <metal:header use-macro="context/@@header_macros/header_resources" />
+  </head>
+  <body>
+    <p metal:use-macro="context/@@body_macros/header">header</p>
+    <!-- START of demo content -->
+
+    <h2>Binder classes handling</h2>
+
+    <p>The followings are checked in this demo:</p>
+    <ul>
+      <li>inheritence must work with event binder classes.</li>
+      <li>If the constructors of the binder class set up variables on this.XX, 
these will 
+      be properties of the _instance_, not that of the class.</li>
+      <li>If two events are bound on the same binder class, they are 
considered the same 
+      class in the registry. That is, if the events are bound on the same 
instance 
+      id (or the singleton), they will see a shared state.</li>
+    </ul>
+
+    <hr/>
+
+    <input type="submit" id="alpha1" class="buttons"
+      value="alpha1">
+
+    <input type="submit" id="beta1" class="buttons"
+      value="beta1">
+
+    <input type="submit" id="beta2" class="buttons"
+      value="beta2">
+  
+    <br />
+
+    <p metal:use-macro="context/@@body_macros/logger">logger</p>
+
+    <p>When you click button alpha1, logging of count should start
+    from 50. When you click beta1 or beta2, counting starts from 100.
+    Alpha and beta are independent, but beta1 and beta2 share the same
+    clicking state.
+    </p>
+
+    <!-- END of demo content -->
+  </body>
+</html>

Added: 
kukit/kss.core/branch/finish-closures/kss/core/plugins/core/demo/binderclasses/selenium_tests/README.txt
==============================================================================
--- (empty file)
+++ 
kukit/kss.core/branch/finish-closures/kss/core/plugins/core/demo/binderclasses/selenium_tests/README.txt
    Sun Dec 30 13:32:58 2007
@@ -0,0 +1,4 @@
+
+Save sour selenium tests into this directory, in html format.
+All the tests ending with .html will be processed automatically.
+

Added: 
kukit/kss.core/branch/finish-closures/kss/core/plugins/core/demo/binderclasses/selenium_tests/binderclasses.html
==============================================================================
--- (empty file)
+++ 
kukit/kss.core/branch/finish-closures/kss/core/plugins/core/demo/binderclasses/selenium_tests/binderclasses.html
    Sun Dec 30 13:32:58 2007
@@ -0,0 +1,99 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>binderclasses</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">binderclasses</td></tr>
+</thead><tbody>
+<tr>
+       <td>open</td>
+       <td>/demo/kss_binder_classes.html</td>
+       <td></td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>alpha1</td>
+       <td></td>
+</tr>
+<tr>
+       <td>waitForTextPresent</td>
+       <td>[50]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>alpha1</td>
+       <td></td>
+</tr>
+<tr>
+       <td>waitForTextPresent</td>
+       <td>[50][51]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>beta1</td>
+       <td></td>
+</tr>
+<tr>
+       <td>waitForTextPresent</td>
+       <td>[50][51][100]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>beta2</td>
+       <td></td>
+</tr>
+<tr>
+       <td>waitForTextPresent</td>
+       <td>[50][51][100][101]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>beta1</td>
+       <td></td>
+</tr>
+<tr>
+       <td>waitForTextPresent</td>
+       <td>[50][51][100][101][102]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>beta1</td>
+       <td></td>
+</tr>
+<tr>
+       <td>waitForTextPresent</td>
+       <td>[50][51][100][101][102][103]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>beta2</td>
+       <td></td>
+</tr>
+<tr>
+       <td>verifyTextPresent</td>
+       <td>[50][51][100][101][102][103][104]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>alpha1</td>
+       <td></td>
+</tr>
+<tr>
+       <td>waitForTextPresent</td>
+       <td>[50][51][100][101][102][103][104][52]</td>
+       <td></td>
+</tr>
+
+</tbody></table>
+</body>
+</html>

Added: 
kukit/kss.core/branch/finish-closures/kss/core/plugins/core/demo/binderclasses/zopeconfig.py
==============================================================================
--- (empty file)
+++ 
kukit/kss.core/branch/finish-closures/kss/core/plugins/core/demo/binderclasses/zopeconfig.py
        Sun Dec 30 13:32:58 2007
@@ -0,0 +1,35 @@
+
+from kss.demo.interfaces import (
+    IKSSDemoResource,
+    IKSSSeleniumTestResource,
+    )
+from kss.demo.resource import (
+    KSSDemo,
+    KSSSeleniumTestDirectory,
+    )
+from zope.interface import implements
+     
+# Create a mesh of provided interfaces
+# This is needed, because an utility must have a single interface.
+class IResource(IKSSDemoResource, IKSSSeleniumTestResource):
+    pass
+
+# XXX you do not need to change anything above here
+# -------------------------------------------------
+
+class KSSDemos(object):
+    implements(IResource)
+
+    demos = (
+        # List your demos here. 
+        # (Second parameter can be a subcategory within the demo if needed.)
+        KSSDemo('', 'Core syntax', 'kss_binder_classes.html', 'Binder class 
usage'),
+
+        )
+
+    # directories are relative from the location of this .py file
+    selenium_tests = (
+        # if you only have one test directory, you
+        # need not change anything here.
+        KSSSeleniumTestDirectory('selenium_tests'),
+        )

Modified: 
kukit/kss.core/branch/finish-closures/kss/core/plugins/core/demo/configure.zcml
==============================================================================
--- 
kukit/kss.core/branch/finish-closures/kss/core/plugins/core/demo/configure.zcml 
    (original)
+++ 
kukit/kss.core/branch/finish-closures/kss/core/plugins/core/demo/configure.zcml 
    Sun Dec 30 13:32:58 2007
@@ -14,6 +14,7 @@
   <include package=".coresyntax" />
   <include package=".coreplugin" />
   <include package=".binderids" />
+  <include package=".binderclasses" />
   
   <!--
     Set up the demos in the root of this package

Added: 
kukit/kss.core/branch/finish-closures/kss/core/plugins/core/demo/selenium_tests/binderclasses_temporary.html
==============================================================================
--- (empty file)
+++ 
kukit/kss.core/branch/finish-closures/kss/core/plugins/core/demo/selenium_tests/binderclasses_temporary.html
        Sun Dec 30 13:32:58 2007
@@ -0,0 +1,99 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>binderclasses</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">binderclasses</td></tr>
+</thead><tbody>
+<tr>
+       <td>open</td>
+       <td>/demo/kss_binder_classes.html</td>
+       <td></td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>alpha1</td>
+       <td></td>
+</tr>
+<tr>
+       <td>waitForTextPresent</td>
+       <td>[50]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>alpha1</td>
+       <td></td>
+</tr>
+<tr>
+       <td>waitForTextPresent</td>
+       <td>[50][51]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>beta1</td>
+       <td></td>
+</tr>
+<tr>
+       <td>waitForTextPresent</td>
+       <td>[50][51][100]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>beta2</td>
+       <td></td>
+</tr>
+<tr>
+       <td>waitForTextPresent</td>
+       <td>[50][51][100][101]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>beta1</td>
+       <td></td>
+</tr>
+<tr>
+       <td>waitForTextPresent</td>
+       <td>[50][51][100][101][102]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>beta1</td>
+       <td></td>
+</tr>
+<tr>
+       <td>waitForTextPresent</td>
+       <td>[50][51][100][101][102][103]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>beta2</td>
+       <td></td>
+</tr>
+<tr>
+       <td>verifyTextPresent</td>
+       <td>[50][51][100][101][102][103][104]</td>
+       <td></td>
+</tr>
+<tr>
+       <td>click</td>
+       <td>alpha1</td>
+       <td></td>
+</tr>
+<tr>
+       <td>waitForTextPresent</td>
+       <td>[50][51][100][101][102][103][104][52]</td>
+       <td></td>
+</tr>
+
+</tbody></table>
+</body>
+</html>

Modified: 
kukit/kss.core/branch/finish-closures/kss/core/plugins/core/demo/selenium_tests/suite.html
==============================================================================
--- 
kukit/kss.core/branch/finish-closures/kss/core/plugins/core/demo/selenium_tests/suite.html
  (original)
+++ 
kukit/kss.core/branch/finish-closures/kss/core/plugins/core/demo/selenium_tests/suite.html
  Sun Dec 30 13:32:58 2007
@@ -67,6 +67,9 @@
         <tr>
           <td><a href="++resource++coreselenium/html_inserts.html">HTML 
inserts</a></td>
         </tr>
+        <tr>
+          <td><a 
href="++resource++coreselenium/binderclasses_temporary.html">Binder classes 
handling</a></td>
+        </tr>
         <!--> </-->
         <tr>
           <td>
@@ -128,6 +131,9 @@
         <tr>
           <td><a href="++resource++coreselenium/html_inserts.html">HTML 
inserts</a></td>
         </tr>
+        <tr>
+          <td><a 
href="++resource++coreselenium/binderclasses_temporary.html">Binder classes 
handling</a></td>
+        </tr>
       </tbody>
     </table>
   </body>
_______________________________________________
Kukit-checkins mailing list
[email protected]
http://codespeak.net/mailman/listinfo/kukit-checkins

Reply via email to