tapestry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject svn commit: r931361 - in /tapestry/tapestry5/trunk/tapestry-core/src: main/java/org/apache/tapestry5/corelib/components/ main/resources/org/apache/tapestry5/ test/java/org/apache/tapestry5/integration/app1/
Date Tue, 06 Apr 2010 23:01:01 GMT
Author: hlship
Date: Tue Apr  6 23:01:00 2010
New Revision: 931361

URL: http://svn.apache.org/viewvc?rev=931361&view=rev
Log:
Do not render an id attribute for Label components, as they can be identified via their for
attribute

Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Label.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Label.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Label.java?rev=931361&r1=931360&r2=931361&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Label.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Label.java
Tue Apr  6 23:01:00 2010
@@ -84,7 +84,7 @@ public class Label
     {
         String fieldId = field.getClientId();
 
-        labelElement.forceAttributes("for", fieldId, "id", fieldId + "_label");
+        labelElement.forceAttributes("for", fieldId);
 
         decorator.insideLabel(field, labelElement);
     }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js?rev=931361&r1=931360&r2=931361&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js
Tue Apr  6 23:01:00 2010
@@ -850,7 +850,9 @@ Tapestry.Initializer = {
 				};
 
 				element.sendAjaxRequest(url, {
-				  parameters: { "t:zoneid": zoneId },
+					parameters : {
+						"t:zoneid" : zoneId
+					},
 					onSuccess : successHandler
 				});
 			});
@@ -1317,7 +1319,10 @@ Tapestry.FieldEventManager = Class.creat
 		this.field = $(field);
 
 		var id = this.field.id;
-		this.label = $(id + '_label');
+
+		var selector = "label[for='" + id + "']";
+
+		this.label = this.field.up("form").down(selector);
 		this.icon = $(id + '_icon');
 
 		this.translator = Prototype.K;

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java?rev=931361&r1=931360&r2=931361&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java
Tue Apr  6 23:01:00 2010
@@ -647,8 +647,7 @@ public class CoreBehaviorsTests extends 
 
         assertTextPresent("Editor for org.apache.tapestry5.integration.app1.data.Track");
 
-        assertText("//label[@id='title_label']", "Title");
-        assertAttribute("//label[@id='title_label']/@for", "title");
+        assertText("//label[@for='title']", "Title");
     }
 
     /**
@@ -1314,7 +1313,7 @@ public class CoreBehaviorsTests extends 
 
         // assertSourcePresent("<![CDATA[< & >]]>");
     }
-    
+
     @Test
     public void secure_page_access()
     {

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=931361&r1=931360&r2=931361&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
Tue Apr  6 23:01:00 2010
@@ -381,10 +381,10 @@ public class FormTests extends TapestryC
         // ComponentFieldValidator.isRequired()
 
         assertSourcePresent(
-                "[Before label for Value]<label id=\"value_label\" for=\"value\">Value</label>[After
label for Value]",
+                "[Before label for Value]<label for=\"value\">Value</label>[After
label for Value]",
                 "[Before field Value]",
                 "[After field Value (optional)]",
-                "[Before label for Required Value]<label id=\"requiredValue_label\" for=\"requiredValue\">Required
Value</label>[After label for Required Value]",
+                "[Before label for Required Value]<label for=\"requiredValue\">Required
Value</label>[After label for Required Value]",
                 "[Before field Required Value]", "[After field Required Value (required)]");
     }
 
@@ -749,15 +749,15 @@ public class FormTests extends TapestryC
     {
         clickThru("SimpleForm");
 
-        assertText("//label[@id='disabled_label']", "Disabled");
+        assertText("//label[@for='disabled']", "Disabled");
 
         // This demonstrates TAPESTRY-1642:
-        assertText("//label[@id='email_label']", "User Email");
+        assertText("//label[@for='email']", "User Email");
 
-        assertText("//label[@id='message_label']", "Incident Message");
-        assertText("//label[@id='operatingSystem_label']", "Operating System");
-        assertText("//label[@id='department_label']", "Department");
-        assertText("//label[@id='urgent_label']", "Urgent Processing Requested");
+        assertText("//label[@for='message']", "Incident Message");
+        assertText("//label[@for='operatingSystem']", "Operating System");
+        assertText("//label[@for='department']", "Department");
+        assertText("//label[@for='urgent']", "Urgent Processing Requested");
 
         assertFieldValue("email", "");
         assertFieldValue("message", "");



Mime
View raw message