You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by da...@apache.org on 2009/01/17 19:49:44 UTC

svn commit: r735326 - in /tapestry/tapestry5/trunk/tapestry-core/src: main/resources/org/apache/tapestry5/corelib/components/palette.js test/java/org/apache/tapestry5/integration/IntegrationTests.java

Author: dadams
Date: Sat Jan 17 10:49:44 2009
New Revision: 735326

URL: http://svn.apache.org/viewvc?rev=735326&view=rev
Log:
TAP5-298: JS error in Palette for disabled options

Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/palette.js
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/IntegrationTests.java

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/palette.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/palette.js?rev=735326&r1=735325&r2=735326&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/palette.js (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/palette.js Sat Jan 17 10:49:44 2009
@@ -133,6 +133,11 @@
 
     transferOptions : function (from, to, atEnd)
     {
+		// don't bother moving the options if nothing is selected. this can happen
+		// if you double-click a disabled option
+		if (from.selectedIndex == -1)
+			return;		
+
         // from: SELECT to move option(s) from (those that are selected)
         // to: SELECT to add option(s) to
         // atEnd : if true, add at end, otherwise by natural sort order

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/IntegrationTests.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/IntegrationTests.java?rev=735326&r1=735325&r2=735326&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/IntegrationTests.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/IntegrationTests.java Sat Jan 17 10:49:44 2009
@@ -991,6 +991,20 @@
 
         assertTextPresent("[ERLANG, RUBY, HASKELL, JAVA, LISP, ML, PYTHON, PERL]");
     }
+    
+    /** TAP5-298 */
+    @Test
+    public void palette_component_disabled_options() {
+        start("Palette Demo", "reset");
+
+        /* force of the options to be disabled rather than creating the model with it disabled in the page.
+         * it is possible to get into this state by creating a model with disabled options.
+         */
+        getEval("this.browserbot.findElement('//select[@id=\"languages:avail\"]/option[1]').disabled = 'disabled';");
+        
+        // causes an error in the js console but does not throw an exception here. optimally, this would make the test case fail.
+        doubleClick("//select[@id=\"languages:avail\"]/option[1]");
+    }
 
     @Test
     public void event_handler_return_types()