rt/emul/compacttest/src/test/java/org/apidesign/bck2brwsr/vmtest/impl/HtmlAnnotationsTest.java
1.1 --- a/rt/emul/compacttest/src/test/java/org/apidesign/bck2brwsr/vmtest/impl/HtmlAnnotationsTest.java Wed Nov 19 19:32:00 2014 +0100
1.2 +++ b/rt/emul/compacttest/src/test/java/org/apidesign/bck2brwsr/vmtest/impl/HtmlAnnotationsTest.java Sun Nov 30 16:21:27 2014 +0100
1.3 @@ -31,7 +31,7 @@
1.4
1.5 private void assertMulNotDefinedForTheFirstTime() {
1.6 if (firstCheck++ == 0) {
1.7 - Object mul = windowMul();
1.8 + Object mul = window("mul");
1.9 assert mul == null : "htmlannotations.js should not be processed before first call to HtmlAnnotations class";
1.10 }
1.11 }
1.12 @@ -70,6 +70,14 @@
1.13 assertEquals(HtmlAnnotations.onError(instance, 42.0), 42.0);
1.14 }
1.15
1.16 + @BrwsrTest public void quotedStar() throws Exception {
1.17 + assertMulNotDefinedForTheFirstTime();
1.18 + HtmlAnnotations.empty();
1.19 + Object fn = window("all");
1.20 + String msg = invoke(fn);
1.21 + assert "*/*".equals(msg) : "String '*/*' as expected: " + msg;
1.22 + }
1.23 +
1.24 private static void assertEquals(double real, double exp) {
1.25 if (real - exp < 0.01) {
1.26 return;
1.27 @@ -81,8 +89,10 @@
1.28 assert obj != null : msg;
1.29 }
1.30
1.31 - @JavaScriptBody(args = {}, body = "return window.mul ? window.mul : null;")
1.32 - private static native Object windowMul();
1.33 + @JavaScriptBody(args = { "n" }, body = "return window[n] ? window[n] : null;")
1.34 + private static native Object window(String name);
1.35 + @JavaScriptBody(args = { "fn" }, body = "return fn();")
1.36 + private static native String invoke(Object fn);
1.37
1.38 @Factory public static Object[] create() {
1.39 return VMTest.create(HtmlAnnotationsTest.class);