click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sa...@apache.org
Subject svn commit: r928165 - in /click/trunk/click/extras/test/org/apache/click/extras/control: MenuTest$MyMenu.properties MenuTest.java
Date Sat, 27 Mar 2010 07:30:47 GMT
Author: sabob
Date: Sat Mar 27 07:30:47 2010
New Revision: 928165

URL: http://svn.apache.org/viewvc?rev=928165&view=rev
Log:
added test for i18n menu support

Added:
    click/trunk/click/extras/test/org/apache/click/extras/control/MenuTest$MyMenu.properties
Modified:
    click/trunk/click/extras/test/org/apache/click/extras/control/MenuTest.java

Added: click/trunk/click/extras/test/org/apache/click/extras/control/MenuTest$MyMenu.properties
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/test/org/apache/click/extras/control/MenuTest%24MyMenu.properties?rev=928165&view=auto
==============================================================================
--- click/trunk/click/extras/test/org/apache/click/extras/control/MenuTest$MyMenu.properties
(added)
+++ click/trunk/click/extras/test/org/apache/click/extras/control/MenuTest$MyMenu.properties
Sat Mar 27 07:30:47 2010
@@ -0,0 +1,2 @@
+mymenu.label=Root Label
+mymenu.title=Root Title
\ No newline at end of file

Modified: click/trunk/click/extras/test/org/apache/click/extras/control/MenuTest.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/test/org/apache/click/extras/control/MenuTest.java?rev=928165&r1=928164&r2=928165&view=diff
==============================================================================
--- click/trunk/click/extras/test/org/apache/click/extras/control/MenuTest.java (original)
+++ click/trunk/click/extras/test/org/apache/click/extras/control/MenuTest.java Sat Mar 27
07:30:47 2010
@@ -20,19 +20,19 @@ package org.apache.click.extras.control;
 
 import junit.framework.TestCase;
 import org.apache.click.MockContext;
-import org.apache.click.control.Form;
+import org.apache.click.Page;
 
 public class MenuTest extends TestCase {
 
     /**
-     * Check that FileField value is escaped.
+     * Check that Menu value is escaped.
      */
     public void testEscapeValue() {
         MockContext.initContext();
 
-        Form form = new Form("form");
+        Menu rootMenu = new Menu("root");
         Menu menu = new Menu("menu");
-        form.add(menu);
+        rootMenu.add(menu);
 
         String value = "<script>";
         String expected = "title=\"&lt;script&gt;\"";
@@ -42,4 +42,24 @@ public class MenuTest extends TestCase {
 
         assertTrue(menu.toString().indexOf(expected) > 1);
     }
+
+    public void testI18N() {
+        MockContext.initContext();
+
+        Page page = new Page();
+        Menu rootMenu = new MyMenu("root");
+        page.addControl(rootMenu);
+
+        Menu menu = new MyMenu("mymenu");
+        rootMenu.add(menu);
+
+        assertEquals("Root Label", menu.getLabel());
+        assertEquals("Root Title", menu.getTitle());
+    }
+
+    public class MyMenu extends Menu {
+        public MyMenu(String name) {
+            super(name);
+        }
+    }
 }



Mime
View raw message