Author: drobiazko
Date: Sat Jul 24 11:37:17 2010
New Revision: 978849

URL: http://svn.apache.org/viewvc?rev=978849&view=rev
Log:
TAP5-1154: ValidationDecorator.insideField not called for Select component

Added:
    tapestry/tapestry5/trunk/tapestry-core/src/test/app1/SelectDemo.tml
    
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/SelectDemo.java
   (with props)
Modified:
    
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Select.java
    
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/default.css
    
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java
    
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Select.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Select.java?rev=978849&r1=978848&r2=978849&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Select.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Select.java
 Sat Jul 24 11:37:17 2010
@@ -1,4 +1,4 @@
-// Copyright 2007, 2008, 2009 The Apache Software Foundation
+// Copyright 2007, 2008, 2009, 2010 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -201,6 +201,8 @@ public class Select extends AbstractFiel
         removePropertyNameFromBeanValidationContext();
 
         resources.renderInformalParameters(writer);
+        
+        decorateInsideField();
 
         // Disabled is via a mixin
 

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/default.css
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/default.css?rev=978849&r1=978848&r2=978849&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/default.css
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/default.css
 Sat Jul 24 11:37:17 2010
@@ -44,7 +44,7 @@ LABEL.t-error {
     color: red;
 }
 
-INPUT.t-error, TEXTAREA.t-error {
+INPUT.t-error, TEXTAREA.t-error, SELECT.t-error {
     border-color: red;
     font-style: italic;
     color: red;

Added: tapestry/tapestry5/trunk/tapestry-core/src/test/app1/SelectDemo.tml
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/app1/SelectDemo.tml?rev=978849&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/app1/SelectDemo.tml (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/app1/SelectDemo.tml Sat Jul 
24 11:37:17 2010
@@ -0,0 +1,21 @@
+<t:border xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd";>
+       <t:form clientValidation="false">
+               <p>
+                       <t:errors />
+               </p>
+               <p>
+                       <t:label for="color" />
+                       :
+                       <t:select t:id="color" validate="required" 
blankOption="always"
+                               model="literal:Red,Green,Blue" />
+
+               </p>
+
+               <p>
+                       <t:submit value="literal:Submit" />
+               </p>
+       </t:form>
+
+       <p> Selected color: ${color}</p>
+
+</t:border>
\ No newline at end of file

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java?rev=978849&r1=978848&r2=978849&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java
 Sat Jul 24 11:37:17 2010
@@ -866,4 +866,25 @@ public class FormTests extends TapestryC
 
         assertText("message", "onSelectedFromCancelLink() invoked.");
     }
+    
+    @Test
+    public void validation_decoration_for_select() throws Exception
+    {
+        clickThru("Select Demo");
+
+        clickAndWait(SUBMIT);
+        assertTextPresent("You must provide a value for Color.");
+
+        // Check on decorations via the default validation decorator:
+
+        assertAttribute("//lab...@for='color']/@class", "t-error");
+        assertAttribute("//sele...@id='color']/@class", "t-error");
+        assertAttribute("//i...@id='color_icon']/@class", "t-error-icon");
+
+        select("color", "label=Green");
+
+        clickAndWait(SUBMIT);
+
+        assertTextPresent("Selected color: Green");
+    }
 }

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java?rev=978849&r1=978848&r2=978849&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
 Sat Jul 24 11:37:17 2010
@@ -443,7 +443,9 @@ public class Index
                     new Item("unavailablecomponentdemo", "Report Location of 
Unavailable Component",
                             "Report Location of Unavailable Component"),
 
-                    new Item("discardafterdemo", "@DiscardAfter Demo", "Demo 
using @DiscardAfter annotation")
+                    new Item("discardafterdemo", "@DiscardAfter Demo", "Demo 
using @DiscardAfter annotation"),
+                    
+                    new Item("SelectDemo", "Select Demo", "Validation 
decoration for Select")
 
             );
 

Added: 
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/SelectDemo.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/SelectDemo.java?rev=978849&view=auto
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/SelectDemo.java
 (added)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/SelectDemo.java
 Sat Jul 24 11:37:17 2010
@@ -0,0 +1,26 @@
+// Copyright 2010 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package org.apache.tapestry5.integration.app1.pages;
+
+import org.apache.tapestry5.annotations.Persist;
+import org.apache.tapestry5.annotations.Property;
+
+public class SelectDemo
+{
+
+    @Property
+    @Persist
+    private String color;
+
+}

Propchange: 
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/SelectDemo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/SelectDemo.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain


Reply via email to