[KSS-checkins] r40328 - in kukit/kss.demo/trunk/kss/demo: browser browser/commandaction tests/selenium_tests

gotcha at codespeak.net gotcha at codespeak.net
Mon Mar 12 13:59:09 CET 2007


Author: gotcha
Date: Mon Mar 12 13:59:08 2007
New Revision: 40328

Added:
   kukit/kss.demo/trunk/kss/demo/browser/commandaction/commandaction.py
Modified:
   kukit/kss.demo/trunk/kss/demo/browser/commandaction/actions.kss
   kukit/kss.demo/trunk/kss/demo/browser/commandaction/actions.pt
   kukit/kss.demo/trunk/kss/demo/browser/commandaction/configure.zcml
   kukit/kss.demo/trunk/kss/demo/browser/commandaction/focus.kss
   kukit/kss.demo/trunk/kss/demo/browser/commandaction/focus.pt
   kukit/kss.demo/trunk/kss/demo/browser/demo.css
   kukit/kss.demo/trunk/kss/demo/tests/selenium_tests/actions.html
   kukit/kss.demo/trunk/kss/demo/tests/selenium_tests/ca_focus.html
Log:
tests for commands "focus" and "toggleClass"


Modified: kukit/kss.demo/trunk/kss/demo/browser/commandaction/actions.kss
==============================================================================
--- kukit/kss.demo/trunk/kss/demo/browser/commandaction/actions.kss	(original)
+++ kukit/kss.demo/trunk/kss/demo/browser/commandaction/actions.kss	Mon Mar 12 13:59:08 2007
@@ -3,3 +3,8 @@
     action-client: toggleClass;
     toggleClass-classname: 'selected';
 } 
+
+#server-toggleclass-button:click {
+    action-client: toggleClass;
+    toggleClass-classname: 'selected';
+} 

Modified: kukit/kss.demo/trunk/kss/demo/browser/commandaction/actions.pt
==============================================================================
--- kukit/kss.demo/trunk/kss/demo/browser/commandaction/actions.pt	(original)
+++ kukit/kss.demo/trunk/kss/demo/browser/commandaction/actions.pt	Mon Mar 12 13:59:08 2007
@@ -5,7 +5,6 @@
           string:${context/@@absolute_url}/++resource++actions.kss"/>
     <metal:header use-macro="context/@@header_macros/header_resources" />
     <style type="text/css">
-      div.nested { border: 1px solid green; padding: 0.4em; }
       .selected { background-color: darkblue; color: white !important; border-color: yellow !important}
     </style>
   </head>
@@ -27,7 +26,8 @@
         Toggling the class means adding or removing it. Click the button to toggle class on (it will highlight the button). Click it again to toggle class off (it will remove highlighting).
     </div>
     <div class="container">
-      <a  class="button click cursorPointer" href="#" id="toggleclass-button">Click me!</a>
+      <a  class="button click cursorPointer" title="Client-side" href="#" id="toggleclass-button">Click me!</a>
+      <a  class="button click cursorPointer" title="Server-side" href="#" id="server-toggleclass-button">Click me!</a>
     </div>
   </body>
 </html>

Added: kukit/kss.demo/trunk/kss/demo/browser/commandaction/commandaction.py
==============================================================================
--- (empty file)
+++ kukit/kss.demo/trunk/kss/demo/browser/commandaction/commandaction.py	Mon Mar 12 13:59:08 2007
@@ -0,0 +1,11 @@
+from kss.core import KSSView
+
+class ActionsView(KSSView):
+
+    def toggleClass(self):
+        self.getCommandSet('core').toggleClass('#toggleclass-button', 'selected')
+        return self.render()
+
+    def focus(self, id):
+        self.getCommandSet('core').focus('#' + id)
+        return self.render()

Modified: kukit/kss.demo/trunk/kss/demo/browser/commandaction/configure.zcml
==============================================================================
--- kukit/kss.demo/trunk/kss/demo/browser/commandaction/configure.zcml	(original)
+++ kukit/kss.demo/trunk/kss/demo/browser/commandaction/configure.zcml	Mon Mar 12 13:59:08 2007
@@ -17,6 +17,14 @@
 
   <browser:page
       for="kss.demo.interfaces.ISimpleContent"
+      class=".commandaction.ActionsView"
+      attribute="toggleClass"
+      name="toggleClass"
+      permission="zope.View"
+      />
+
+  <browser:page
+      for="kss.demo.interfaces.ISimpleContent"
       template="focus.pt"
       name="ca_focus.html"
       permission="zope.View"
@@ -26,6 +34,14 @@
     file="focus.kss"
     name="focus.kss"
   />
+  
+  <browser:page
+      for="kss.demo.interfaces.ISimpleContent"
+      class=".commandaction.ActionsView"
+      attribute="focus"
+      name="focus"
+      permission="zope.View"
+      />
 
 </configure>
 

Modified: kukit/kss.demo/trunk/kss/demo/browser/commandaction/focus.kss
==============================================================================
--- kukit/kss.demo/trunk/kss/demo/browser/commandaction/focus.kss	(original)
+++ kukit/kss.demo/trunk/kss/demo/browser/commandaction/focus.kss	Mon Mar 12 13:59:08 2007
@@ -35,3 +35,28 @@
     executeCommand-selector: "#checkbox-1";
 } 
 
+#server-focus-to-text:click {
+    action-server: focus;
+    focus-id: "text";
+} 
+
+#server-focus-to-textarea:click {
+    action-server: focus;
+    focus-id: "textarea";
+} 
+
+#server-focus-to-select:click {
+    action-server: focus;
+    focus-id: "select";
+} 
+
+#server-focus-to-radio:click {
+    action-server: focus;
+    focus-id: "radio-1";
+} 
+
+#server-focus-to-checkbox:click {
+    action-server: focus;
+    focus-id: "checkbox-1";
+} 
+

Modified: kukit/kss.demo/trunk/kss/demo/browser/commandaction/focus.pt
==============================================================================
--- kukit/kss.demo/trunk/kss/demo/browser/commandaction/focus.pt	(original)
+++ kukit/kss.demo/trunk/kss/demo/browser/commandaction/focus.pt	Mon Mar 12 13:59:08 2007
@@ -25,11 +25,12 @@
         Focus to <code>input type="text"<code>.
       </h3>
       <div class="help">
-        Click the button to set focus to the input.
+        Click the buttons to set focus to the input.
       </div>
       <fieldset>
         <div>
-          <a class="button click cursorPointer" id="focus-to-text">Click me !</a>
+          <a class="button click cursorPointer" title="Client-side" id="focus-to-text">Click me !</a>
+          <a class="button click cursorPointer" title="Server-side" id="server-focus-to-text">Click me !</a>
           <input class="focus" id="text"
                  type="text" name="text" value="text" />
         </div>
@@ -38,11 +39,12 @@
         Focus to <code>textarea<code>.
       </h3>
       <div class="help">
-        Click the button to set focus to the textarea.
+        Click the buttons to set focus to the textarea.
       </div>
       <fieldset>
         <div>
-          <a class="button click cursorPointer" id="focus-to-textarea">Click me !</a>
+          <a class="button click cursorPointer" title="Client-side" id="focus-to-textarea">Click me !</a>
+          <a class="button click cursorPointer" title="Server-side" id="server-focus-to-textarea">Click me !</a>
           <textarea id="textarea" class="focus" name="textarea">textarea</textarea>
         </div>
       </fieldset>
@@ -50,11 +52,12 @@
         Focus to <code>select<code>.
       </h3>
       <div class="help">
-        Click the button to set focus to the select.
+        Click the buttons to set focus to the select.
       </div>
       <fieldset>
         <div>
-          <a class="button click cursorPointer" id="focus-to-select">Click me !</a>
+          <a class="button click cursorPointer" title="Client-side" id="focus-to-select">Click me !</a>
+          <a class="button click cursorPointer" title="Server-side" id="server-focus-to-select">Click me !</a>
           <select id="select" class="focus" name="select">
             <option selected="selected">select</option>
             <option>second option</option>
@@ -65,11 +68,12 @@
         Focus to <code>input type="radio"<code>.
       </h3>
       <div class="help">
-        Click the button to set focus to the radio.
+        Click the buttons to set focus to the radio.
       </div>
       <fieldset>
         <div>
-          <a class="button click cursorPointer" id="focus-to-radio">Click me !</a>
+          <a class="button click cursorPointer" title="Client-side" id="focus-to-radio">Click me !</a>
+          <a class="button click cursorPointer" title="Server-side" id="server-focus-to-radio">Click me !</a>
           <input class="focus" id="radio-1" 
                  type="radio" name="radio" value="radio"
                  checked="checked" />
@@ -81,11 +85,12 @@
         Focus to <code>input type="checkbox"<code>.
       </h3>
       <div class="help">
-        Click the button to set focus to the checkbox.
+        Click the buttons to set focus to the checkbox.
       </div>
       <fieldset>
         <div>
-          <a class="button click cursorPointer" id="focus-to-checkbox">Click me !</a>
+          <a class="button click cursorPointer" title="Client-side" id="focus-to-checkbox">Click me !</a>
+          <a class="button click cursorPointer" title="Server-side" id="server-focus-to-checkbox">Click me !</a>
           <input class="focus" id="checkbox-1" 
                  type="checkbox" name="checkbox" value="checkbox"
                  checked="checked" />

Modified: kukit/kss.demo/trunk/kss/demo/browser/demo.css
==============================================================================
--- kukit/kss.demo/trunk/kss/demo/browser/demo.css	(original)
+++ kukit/kss.demo/trunk/kss/demo/browser/demo.css	Mon Mar 12 13:59:08 2007
@@ -61,6 +61,7 @@
   padding: 0.2em;
   border: 1px solid #FF8888;
   color: #CC0000;
+  text-decoration: none;
 }
 
 fieldset {

Modified: kukit/kss.demo/trunk/kss/demo/tests/selenium_tests/actions.html
==============================================================================
--- kukit/kss.demo/trunk/kss/demo/tests/selenium_tests/actions.html	(original)
+++ kukit/kss.demo/trunk/kss/demo/tests/selenium_tests/actions.html	Mon Mar 12 13:59:08 2007
@@ -39,6 +39,41 @@
 	<td>button click cursorPointer</td>
 </tr>
 
+<tr>
+	<td>assertAttribute</td>
+	<td>server-toggleclass-button at class</td>
+	<td>button click cursorPointer</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>server-toggleclass-button</td>
+	<td></td>
+</tr>
+<tr>
+	<td>waitForAttribute</td>
+	<td>server-toggleclass-button at class</td>
+	<td>button click cursorPointer selected</td>
+</tr>
+<tr>
+	<td>assertAttribute</td>
+	<td>server-toggleclass-button at class</td>
+	<td>button click cursorPointer selected</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>server-toggleclass-button</td>
+	<td></td>
+</tr>
+<tr>
+	<td>waitForAttribute</td>
+	<td>server-toggleclass-button at class</td>
+	<td>button click cursorPointer</td>
+</tr>
+<tr>
+	<td>assertAttribute</td>
+	<td>server-toggleclass-button at class</td>
+	<td>button click cursorPointer</td>
+</tr>
 </tbody></table>
 </body>
 </html>

Modified: kukit/kss.demo/trunk/kss/demo/tests/selenium_tests/ca_focus.html
==============================================================================
--- kukit/kss.demo/trunk/kss/demo/tests/selenium_tests/ca_focus.html	(original)
+++ kukit/kss.demo/trunk/kss/demo/tests/selenium_tests/ca_focus.html	Mon Mar 12 13:59:08 2007
@@ -93,6 +93,81 @@
 	<td>Focus on checkbox-1.</td>
 	<td></td>
 </tr>
+<tr>
+	<td>click</td>
+	<td>server-focus-to-text</td>
+	<td></td>
+</tr>
+<tr>
+	<td>waitForTextPresent</td>
+	<td>Focus on text.</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertTextPresent</td>
+	<td>Focus on text.</td>
+	<td></td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>server-focus-to-textarea</td>
+	<td></td>
+</tr>
+<tr>
+	<td>waitForTextPresent</td>
+	<td>Focus on textarea.</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertTextPresent</td>
+	<td>Focus on textarea.</td>
+	<td></td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>server-focus-to-select</td>
+	<td></td>
+</tr>
+<tr>
+	<td>waitForTextPresent</td>
+	<td>Focus on select.</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertTextPresent</td>
+	<td>Focus on select.</td>
+	<td></td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>server-focus-to-radio</td>
+	<td></td>
+</tr>
+<tr>
+	<td>waitForTextPresent</td>
+	<td>Focus on radio-1.</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertTextPresent</td>
+	<td>Focus on radio-1.</td>
+	<td></td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>server-focus-to-checkbox</td>
+	<td></td>
+</tr>
+<tr>
+	<td>waitForTextPresent</td>
+	<td>Focus on checkbox-1.</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertTextPresent</td>
+	<td>Focus on checkbox-1.</td>
+	<td></td>
+</tr>
 
 </tbody></table>
 </body>


More information about the Kukit-checkins mailing list