You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by ul...@apache.org on 2010/02/26 16:07:14 UTC

svn commit: r916706 - in /tapestry/tapestry5/trunk/tapestry-core/src: main/resources/org/apache/tapestry5/tapestry.js test/java/org/apache/tapestry5/integration/app1/ZoneTests.java

Author: uli
Date: Fri Feb 26 15:07:13 2010
New Revision: 916706

URL: http://svn.apache.org/viewvc?rev=916706&view=rev
Log:
TAP5-707: Yellow highlight remains on updated zone if zone is re-updated too quickly

Modified:
    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/ZoneTests.java

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=916706&r1=916705&r2=916706&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 Fri Feb 26 15:07:13 2010
@@ -535,7 +535,7 @@
 
             if (current.tagName == "FORM") break;
 
-            current = $(current.parentNode)
+            current = $(current.parentNode);
         }
 
         return true;
@@ -717,7 +717,7 @@
                 $(rowInjector).trigger();
 
                 Event.stop(event);
-            })
+            });
         });
     },
 
@@ -748,7 +748,7 @@
                         container.remove();
                     };
                 }
-            }
+            };
 
             Tapestry.ajaxRequest(spec.url, successHandler);
         });
@@ -887,7 +887,7 @@
 
     formFragment : function(spec)
     {
-        new Tapestry.FormFragment(spec)
+        new Tapestry.FormFragment(spec);
     },
 
     formInjector : function(spec)
@@ -1365,8 +1365,11 @@
     },
 
     /** The classic yellow background fade. */
-    highlight : function(element)
+    highlight : function(element, color)
     {
+        if(color)
+            return new Effect.Highlight(element, { endcolor: color, restorecolor: color});
+        
         return new Effect.Highlight(element);
     },
 
@@ -1405,6 +1408,9 @@
         this.element = $(spec.element);
         this.showFunc = Tapestry.ElementEffect[spec.show] || Tapestry.ElementEffect.show;
         this.updateFunc = Tapestry.ElementEffect[spec.update] || Tapestry.ElementEffect.highlight;
+        
+        // TAP5-707: store the old background color of the element or take white as a default
+        this.endcolor = this.element.getStyle('background-color').parseColor('#ffffff');
 
         // Link the div back to this zone.
 
@@ -1436,7 +1442,7 @@
 
         var func = this.element.visible() ? this.updateFunc : this.showFunc;
 
-        func.call(this, this.element);
+        func.call(this, this.element, this.endcolor);
 
         this.element.fire(Tapestry.ZONE_UPDATED_EVENT);
     },

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ZoneTests.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ZoneTests.java?rev=916706&r1=916705&r2=916706&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ZoneTests.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ZoneTests.java Fri Feb 26 15:07:13 2010
@@ -203,5 +203,29 @@
 
         assertTextPresent(Form.class.getName() + "[form--form]");
     }
+    
+    /**
+     * TAP5-707
+     */
+    
+    @Test
+    public void zone_fade_back_backgroundcolor()
+    {
+        clickThru("Form Zone Demo");
+        
+        type("longValue", "12");
+        
+        click(SUBMIT);
+        
+        click(SUBMIT);
+        
+        // wait some time to let the fade go away
+        sleep(4050);
+
+        // will only work in firefox.
+        String color = getEval("selenium.browserbot.getCurrentWindow().getComputedStyle(this.page().findElement(\"xpath=//div[@id='valueZone']\"),'').getPropertyValue('background-color').toLowerCase()");
+        
+        assertEquals(color, "rgb(255, 255, 255)");
+    }
 
 }