diff options
author | Manolo Carrasco <manolo@apache.org> | 2015-01-14 23:54:43 +0100 |
---|---|---|
committer | Manolo Carrasco <manolo@apache.org> | 2015-01-14 23:54:43 +0100 |
commit | 2413750e9679d1a1ac38d961c144e1189f8f1080 (patch) | |
tree | 4cfa13fafff760b3074301d632f53a8357f6f8b9 /gwtquery-core/src/test | |
parent | 2e7592b13ad3d06f770fab042bf12ace7ea6659a (diff) | |
download | gwtquery-2413750e9679d1a1ac38d961c144e1189f8f1080.tar.gz gwtquery-2413750e9679d1a1ac38d961c144e1189f8f1080.zip |
Utility method to export a function
Diffstat (limited to 'gwtquery-core/src/test')
-rw-r--r-- | gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCoreTestGwt.java | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCoreTestGwt.java b/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCoreTestGwt.java index 4df6b85c..54181621 100644 --- a/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCoreTestGwt.java +++ b/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCoreTestGwt.java @@ -20,6 +20,14 @@ import static com.google.gwt.query.client.GQuery.$$; import static com.google.gwt.query.client.GQuery.document; import static com.google.gwt.query.client.GQuery.window; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +import junit.framework.Assert; + import com.google.gwt.dom.client.Document; import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.InputElement; @@ -41,6 +49,7 @@ import com.google.gwt.query.client.js.JsNodeArray; import com.google.gwt.query.client.js.JsUtils; import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.Event; +import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.Label; @@ -48,14 +57,6 @@ import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.ui.TextArea; import com.google.gwt.user.client.ui.Widget; -import junit.framework.Assert; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; - /** * Test class for testing gwtquery-core api. */ @@ -1046,6 +1047,18 @@ public class GQueryCoreTestGwt extends GWTTestCase { assertNull(e); } + public void testUtilsJsniExport() { + JsUtils.export("foo", new Function() { + public Object f(Object... args) { + assertEquals("bar", (String)args[0]); + assertEquals(3.5, (Double)args[1]); + return "OK"; + } + }); + assertTrue(JsUtils.hasProperty(window, "foo")); + assertEquals("OK", JsUtils.jsni("foo", "bar", 3.5)); + } + public void testVal_issue98() { $(e).html("" +"<input type='text' id='inputText' name='inputText' value='original' />" |