diff --git a/zats-mimic/src/main/java/org/zkoss/zats/mimic/DesktopAgent.java b/zats-mimic/src/main/java/org/zkoss/zats/mimic/DesktopAgent.java
index 84db8335..d2925eb7 100644
--- a/zats-mimic/src/main/java/org/zkoss/zats/mimic/DesktopAgent.java
+++ b/zats-mimic/src/main/java/org/zkoss/zats/mimic/DesktopAgent.java
@@ -15,6 +15,8 @@
import org.zkoss.zats.mimic.operation.OperationAgent;
import org.zkoss.zk.ui.Component;
+import org.zkoss.zk.ui.Desktop;
+
/**
* The desktop agent, represents a server-side ZK desktop
*
@@ -62,7 +64,15 @@ public interface DesktopAgent extends QueryAgent {
* Gets the Clients.log
results.
*
* @return Messages. An empty list if no message.
- * @since 2.0.1
+ * @since 2.1.0
*/
List getZkLog();
+
+ /**
+ * Get the attached {@link Desktop} instance.
+ *
+ * @return the attached {@link Desktop} instance.
+ * @since 2.1.0
+ */
+ Desktop getDesktop();
}
diff --git a/zats-mimic/src/main/java/org/zkoss/zats/mimic/impl/EmulatorClient.java b/zats-mimic/src/main/java/org/zkoss/zats/mimic/impl/EmulatorClient.java
index 628c1189..ed3fb4c1 100644
--- a/zats-mimic/src/main/java/org/zkoss/zats/mimic/impl/EmulatorClient.java
+++ b/zats-mimic/src/main/java/org/zkoss/zats/mimic/impl/EmulatorClient.java
@@ -164,8 +164,6 @@ public DesktopAgent connect(String zulPath) {
flush(desktopAgent.getId());
return desktopAgent;
- } catch (Exception e) {
- throw new ZatsException(e.getMessage(), e);
} catch (Throwable t) {
throw new ZatsException(t.getMessage(), t);
} finally {
diff --git a/zats-mimic/src/main/java/org/zkoss/zats/mimic/impl/au/AuUtility.java b/zats-mimic/src/main/java/org/zkoss/zats/mimic/impl/au/AuUtility.java
index 5da68da3..d0af8cec 100644
--- a/zats-mimic/src/main/java/org/zkoss/zats/mimic/impl/au/AuUtility.java
+++ b/zats-mimic/src/main/java/org/zkoss/zats/mimic/impl/au/AuUtility.java
@@ -141,11 +141,11 @@ public static Map parseAuResponseFromLayout(String raw) {
Elements scripts = doc.getElementsByTag("script");
for (Element script : scripts) {
// fetch arguments of zkmx()
- String text = script.html().replaceAll("[\\n\\r]", "");
+ String text = script.html();
// ZATS-34: layout response might have other client-side scripts
// using JS parser to fetch argument of zkmx()
if (text.contains("zkmx(")) {
- zkmxArgs = fetchJavascriptFuntionArguments("zkmx", text);
+ zkmxArgs = fetchJavascriptFunctionArguments("zkmx", text);
if(zkmxArgs != null) {
break; // find first
}
@@ -183,7 +183,7 @@ public static Map parseAuResponseFromLayout(String raw) {
return map;
} catch (Exception e) {
- throw new ZatsException(e.getMessage(), e);
+ throw new ZatsException("Code could not be parsed:\n" + raw, e);
}
}
@@ -191,7 +191,7 @@ public static Map parseAuResponseFromLayout(String raw) {
/**
* @return an json array text contained specified function's arguments, or null otherwise.
*/
- public static String fetchJavascriptFuntionArguments(final String funcName, String code) {
+ public static String fetchJavascriptFunctionArguments(final String funcName, String code) {
if (funcName == null || code == null) {
return null;
}
diff --git a/zats-mimic/src/test/java/org/zkoss/zats/testcase/ScriptTest.java b/zats-mimic/src/test/java/org/zkoss/zats/testcase/ScriptTest.java
new file mode 100644
index 00000000..94274d08
--- /dev/null
+++ b/zats-mimic/src/test/java/org/zkoss/zats/testcase/ScriptTest.java
@@ -0,0 +1,41 @@
+package org.zkoss.zats.testcase;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.zkoss.zats.mimic.ComponentAgent;
+import org.zkoss.zats.mimic.DesktopAgent;
+import org.zkoss.zats.mimic.Zats;
+import org.zkoss.zul.Listcell;
+
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public class ScriptTest {
+
+ @BeforeClass
+ public static void init() {
+ Zats.init(".");
+ }
+
+ @AfterClass
+ public static void end() {
+ Zats.end();
+ }
+
+ @After
+ public void after() {
+ Zats.cleanup();
+ }
+
+ @Test
+ public void testSyntaxError() {
+ DesktopAgent desktopAgent = Zats.newClient().connect("/~./basic/script.zul");
+ assertTrue(true);
+ }
+
+
+}
diff --git a/zats-mimic/src/test/resources/web/basic/script.zul b/zats-mimic/src/test/resources/web/basic/script.zul
new file mode 100644
index 00000000..e5d6563f
--- /dev/null
+++ b/zats-mimic/src/test/resources/web/basic/script.zul
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/zats/release-note b/zats/release-note
index b7c13ca5..e446e9c6 100644
--- a/zats/release-note
+++ b/zats/release-note
@@ -4,6 +4,7 @@ ZATS Mimic 2.1.0
* Bugs
ZATS-69: Clients.clearBusy causes a NPE
+ ZATS-70: JS Line comments parse errors
* Upgrade Notes
+ Jetty dependency upped to 9.4.18