You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by jk...@apache.org on 2015/04/09 14:45:06 UTC

[1/2] tapestry-5 git commit: TAP5-2440: mixin autocomplete work not correct if user input is required

Repository: tapestry-5
Updated Branches:
  refs/heads/master a81ca0c2f -> cf101cce3


TAP5-2440: mixin autocomplete work not correct if user input is required


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/9dec1b42
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/9dec1b42
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/9dec1b42

Branch: refs/heads/master
Commit: 9dec1b429b77b15f5e8ba432bdb4520db72478a9
Parents: a81ca0c
Author: Felix Scheffer <ma...@felix-scheffer.de>
Authored: Thu Mar 19 23:45:19 2015 +0100
Committer: Jochen Kemnade <jo...@eddyson.de>
Committed: Thu Apr 9 14:43:36 2015 +0200

----------------------------------------------------------------------
 .../coffeescript/META-INF/modules/t5/core/autocomplete.coffee   | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/9dec1b42/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/autocomplete.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/autocomplete.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/autocomplete.coffee
index 332e945..3043b70 100644
--- a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/autocomplete.coffee
+++ b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/autocomplete.coffee
@@ -40,4 +40,9 @@ define ["./dom", "./ajax", "underscore", "jquery", "./utils", "./typeahead"],
         minLength: spec.minChars
         dataset
 
+      # don't validate the "tt-hint" input field created by Typeahead (fix for TAP5-2440)
+      $field.prev(".tt-hint").removeAttr("data-validation data-optionality data-required-message")
+
+      return
+
     exports = init


[2/2] tapestry-5 git commit: add test for TAP5-2440

Posted by jk...@apache.org.
add test for TAP5-2440


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/cf101cce
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/cf101cce
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/cf101cce

Branch: refs/heads/master
Commit: cf101cce3e7d74db40169661aa936fce084cfe96
Parents: 9dec1b4
Author: Jochen Kemnade <jo...@eddyson.de>
Authored: Thu Apr 9 14:44:42 2015 +0200
Committer: Jochen Kemnade <jo...@eddyson.de>
Committed: Thu Apr 9 14:44:42 2015 +0200

----------------------------------------------------------------------
 tapestry-core/src/test/app1/AutocompleteDemo.tml |  1 +
 .../tapestry5/integration/app1/AjaxTests.java    | 19 ++++++++++++++++---
 .../integration/app1/pages/AutocompleteDemo.java | 14 ++++++++++++--
 3 files changed, 29 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/cf101cce/tapestry-core/src/test/app1/AutocompleteDemo.tml
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/app1/AutocompleteDemo.tml b/tapestry-core/src/test/app1/AutocompleteDemo.tml
index 32a52ab..43ae614 100644
--- a/tapestry-core/src/test/app1/AutocompleteDemo.tml
+++ b/tapestry-core/src/test/app1/AutocompleteDemo.tml
@@ -7,6 +7,7 @@
 
         <t:textfield t:id="title" t:mixins="autocomplete,formgroup" maxSuggestions="10" size="60"/>
         <t:textfield t:id="withContext" t:mixins="autocomplete,formgroup" context="context"/>
+        <t:textfield t:id="required" t:mixins="autocomplete,formgroup" validate="required"/>
 
         <div class="form-actions">
             <input type="submit" class="btn btn-primary" value="Show Track"/>

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/cf101cce/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java
index 9a68365..5d3ca65 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java
@@ -26,9 +26,22 @@ public class AjaxTests extends App1TestCase
 
         // And that's as far as we can go currently, because
         // of limitations in Selenium 0.8.3 and bugs in Selenium 0.9.2.
-        
+
         // also test Autocomplete with context
-        
+
+    }
+
+    @Test
+    // TAP5-2440
+    public void autocomplete_mixin_on_required_field()
+    {
+        openLinks("Autocomplete Mixin Demo");
+
+        type("required", "foo");
+
+        clickAndWait(SUBMIT);
+
+        assertTextPresent("required: foo");
     }
 
     @Test
@@ -202,7 +215,7 @@ public class AjaxTests extends App1TestCase
 
         assertText("sum", "0.0");
     }
-    
+
     @Test
     public void remove_ajaxformloop_values_using_buttons_with_nested_elements()
     {

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/cf101cce/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/AutocompleteDemo.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/AutocompleteDemo.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/AutocompleteDemo.java
index 245a7c9..7a76fcb 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/AutocompleteDemo.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/AutocompleteDemo.java
@@ -28,6 +28,7 @@ import org.apache.tapestry5.ioc.internal.util.CollectionFactory;
 
 import java.lang.annotation.RetentionPolicy;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 
 public class AutocompleteDemo
@@ -43,19 +44,27 @@ public class AutocompleteDemo
     @Property
     private String withContext;
 
+    @Persist
+    @Property
+    private String required;
+
     @Inject
     private AlertManager alertManager;
-    
+
     public Object[] getContext() {
         return new Object[] {1, RetentionPolicy.RUNTIME, AnnotationUseContext.MIXIN};
     }
-    
+
     List onProvideCompletionsFromWithContext(String partial, Integer integer,
             RetentionPolicy retentionPolicy, AnnotationUseContext annotationUseContext) {
         return Arrays.asList(String.format("%s : %03d, %s, %s", partial,
                 integer, retentionPolicy, annotationUseContext));
     }
 
+    List onProvideCompletionsFromRequired(String partial) {
+        return Collections.singletonList("foo");
+    }
+
     List onProvideCompletionsFromTitle(String partialTitle) throws Exception
     {
         boolean roundabout = false;
@@ -84,6 +93,7 @@ public class AutocompleteDemo
     void onSuccess() {
         alertManager.alert(Duration.SINGLE, Severity.INFO, String.format("Title: %s", title));
         alertManager.alert(Duration.SINGLE, Severity.INFO, String.format("With context: %s", withContext));
+        alertManager.alert(Duration.SINGLE, Severity.INFO, String.format("required: %s", required));
     }
 
 }


[2/2] tapestry-5 git commit: add test for TAP5-2440

Posted by jk...@apache.org.
add test for TAP5-2440


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/cf101cce
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/cf101cce
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/cf101cce

Branch: refs/heads/master
Commit: cf101cce3e7d74db40169661aa936fce084cfe96
Parents: 9dec1b4
Author: Jochen Kemnade <jo...@eddyson.de>
Authored: Thu Apr 9 14:44:42 2015 +0200
Committer: Jochen Kemnade <jo...@eddyson.de>
Committed: Thu Apr 9 14:44:42 2015 +0200

----------------------------------------------------------------------
 tapestry-core/src/test/app1/AutocompleteDemo.tml |  1 +
 .../tapestry5/integration/app1/AjaxTests.java    | 19 ++++++++++++++++---
 .../integration/app1/pages/AutocompleteDemo.java | 14 ++++++++++++--
 3 files changed, 29 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/cf101cce/tapestry-core/src/test/app1/AutocompleteDemo.tml
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/app1/AutocompleteDemo.tml b/tapestry-core/src/test/app1/AutocompleteDemo.tml
index 32a52ab..43ae614 100644
--- a/tapestry-core/src/test/app1/AutocompleteDemo.tml
+++ b/tapestry-core/src/test/app1/AutocompleteDemo.tml
@@ -7,6 +7,7 @@
 
         <t:textfield t:id="title" t:mixins="autocomplete,formgroup" maxSuggestions="10" size="60"/>
         <t:textfield t:id="withContext" t:mixins="autocomplete,formgroup" context="context"/>
+        <t:textfield t:id="required" t:mixins="autocomplete,formgroup" validate="required"/>
 
         <div class="form-actions">
             <input type="submit" class="btn btn-primary" value="Show Track"/>

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/cf101cce/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java
index 9a68365..5d3ca65 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java
@@ -26,9 +26,22 @@ public class AjaxTests extends App1TestCase
 
         // And that's as far as we can go currently, because
         // of limitations in Selenium 0.8.3 and bugs in Selenium 0.9.2.
-        
+
         // also test Autocomplete with context
-        
+
+    }
+
+    @Test
+    // TAP5-2440
+    public void autocomplete_mixin_on_required_field()
+    {
+        openLinks("Autocomplete Mixin Demo");
+
+        type("required", "foo");
+
+        clickAndWait(SUBMIT);
+
+        assertTextPresent("required: foo");
     }
 
     @Test
@@ -202,7 +215,7 @@ public class AjaxTests extends App1TestCase
 
         assertText("sum", "0.0");
     }
-    
+
     @Test
     public void remove_ajaxformloop_values_using_buttons_with_nested_elements()
     {

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/cf101cce/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/AutocompleteDemo.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/AutocompleteDemo.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/AutocompleteDemo.java
index 245a7c9..7a76fcb 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/AutocompleteDemo.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/AutocompleteDemo.java
@@ -28,6 +28,7 @@ import org.apache.tapestry5.ioc.internal.util.CollectionFactory;
 
 import java.lang.annotation.RetentionPolicy;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 
 public class AutocompleteDemo
@@ -43,19 +44,27 @@ public class AutocompleteDemo
     @Property
     private String withContext;
 
+    @Persist
+    @Property
+    private String required;
+
     @Inject
     private AlertManager alertManager;
-    
+
     public Object[] getContext() {
         return new Object[] {1, RetentionPolicy.RUNTIME, AnnotationUseContext.MIXIN};
     }
-    
+
     List onProvideCompletionsFromWithContext(String partial, Integer integer,
             RetentionPolicy retentionPolicy, AnnotationUseContext annotationUseContext) {
         return Arrays.asList(String.format("%s : %03d, %s, %s", partial,
                 integer, retentionPolicy, annotationUseContext));
     }
 
+    List onProvideCompletionsFromRequired(String partial) {
+        return Collections.singletonList("foo");
+    }
+
     List onProvideCompletionsFromTitle(String partialTitle) throws Exception
     {
         boolean roundabout = false;
@@ -84,6 +93,7 @@ public class AutocompleteDemo
     void onSuccess() {
         alertManager.alert(Duration.SINGLE, Severity.INFO, String.format("Title: %s", title));
         alertManager.alert(Duration.SINGLE, Severity.INFO, String.format("With context: %s", withContext));
+        alertManager.alert(Duration.SINGLE, Severity.INFO, String.format("required: %s", required));
     }
 
 }