You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2012/02/22 10:28:42 UTC

[1/3] git commit: WICKET-4425 Wicket 1.5 rewrites template content where it should not

Updated Branches:
  refs/heads/master a4a725b58 -> e721aac08


WICKET-4425 Wicket 1.5 rewrites template content where it should not

Add a test case


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/e721aac0
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/e721aac0
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/e721aac0

Branch: refs/heads/master
Commit: e721aac08a5076d6cd70047a8f57e10046f66c8d
Parents: d63549c
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Wed Feb 22 10:28:30 2012 +0100
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Wed Feb 22 10:28:30 2012 +0100

----------------------------------------------------------------------
 .../parser/filter/PageWithScriptTemplate.html      |   33 +++++++++++
 .../parser/filter/PageWithScriptTemplate.java      |   28 ++++++++++
 .../filter/PageWithScriptTemplate_expected.html    |   37 +++++++++++++
 .../filter/StyleAndScriptIdentifierTest.java       |   42 +++++++++++++++
 4 files changed, 140 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/e721aac0/wicket-core/src/test/java/org/apache/wicket/markup/parser/filter/PageWithScriptTemplate.html
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/markup/parser/filter/PageWithScriptTemplate.html b/wicket-core/src/test/java/org/apache/wicket/markup/parser/filter/PageWithScriptTemplate.html
new file mode 100644
index 0000000..ef7d1b6
--- /dev/null
+++ b/wicket-core/src/test/java/org/apache/wicket/markup/parser/filter/PageWithScriptTemplate.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+	<meta charset="utf-8" />
+	<title>Apache Wicket Quickstart</title>
+	<link href='http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz:regular,bold' rel='stylesheet' type='text/css' />
+	<link rel="stylesheet" href="style.css" type="text/css" media="screen" title="Stylesheet" />
+</head>
+<body>
+<div id="hd">
+	<div id="logo">
+		<img src="logo.png" width="50px" height="50px" alt="Wicket Logo" />
+		<h1>Apache Wicket</h1>
+	</div>
+</div>
+<div id="bd">
+	<h2>Check the alert!</h2>
+	<p>
+		If the text of the alert popup starts with /*&lt;![CDATA[*/ that is a bug. See the bug report for the expected behavior.
+	</p>
+</div>
+<div id="ft">
+</div>
+<script id="script1" type="text/x-jquery-tmpl">
+	This is a "Script" that Wicket should not alter
+</script>
+<script type="text/javascript">/*<![CDATA[*/
+alert(document.getElementById("script1").innerHTML);
+/*]]>*/</script>
+
+<script type="text/javascript">console.log('Nice')</script>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/wicket/blob/e721aac0/wicket-core/src/test/java/org/apache/wicket/markup/parser/filter/PageWithScriptTemplate.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/markup/parser/filter/PageWithScriptTemplate.java b/wicket-core/src/test/java/org/apache/wicket/markup/parser/filter/PageWithScriptTemplate.java
new file mode 100644
index 0000000..960f934
--- /dev/null
+++ b/wicket-core/src/test/java/org/apache/wicket/markup/parser/filter/PageWithScriptTemplate.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.markup.parser.filter;
+
+import org.apache.wicket.markup.html.WebPage;
+
+/**
+ * Test page for StyleAndScriptIdentifierTest
+ *
+ * @since 6.0
+ */
+public class PageWithScriptTemplate extends WebPage
+{
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/e721aac0/wicket-core/src/test/java/org/apache/wicket/markup/parser/filter/PageWithScriptTemplate_expected.html
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/markup/parser/filter/PageWithScriptTemplate_expected.html b/wicket-core/src/test/java/org/apache/wicket/markup/parser/filter/PageWithScriptTemplate_expected.html
new file mode 100644
index 0000000..b68cb50
--- /dev/null
+++ b/wicket-core/src/test/java/org/apache/wicket/markup/parser/filter/PageWithScriptTemplate_expected.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>
+<head>
+	<meta charset="utf-8" />
+	<title>Apache Wicket Quickstart</title>
+	<link href='http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz:regular,bold' rel='stylesheet' type='text/css' />
+	<link rel="stylesheet" href="../../style.css" type="text/css" media="screen" title="Stylesheet"/>
+</head>
+<body>
+<div id="hd">
+	<div id="logo">
+		<img src="../../logo.png" width="50px" height="50px" alt="Wicket Logo"/>
+		<h1>Apache Wicket</h1>
+	</div>
+</div>
+<div id="bd">
+	<h2>Check the alert!</h2>
+	<p>
+		If the text of the alert popup starts with /*&lt;![CDATA[*/ that is a bug. See the bug report for the expected behavior.
+	</p>
+</div>
+<div id="ft">
+</div>
+<script id="script1" type="text/x-jquery-tmpl">
+	This is a "Script" that Wicket should not alter
+</script>
+<script type="text/javascript">/*<![CDATA[*/
+alert(document.getElementById("script1").innerHTML);
+/*]]>*/</script>
+
+<script type="text/javascript">
+/*<![CDATA[*/
+console.log('Nice')
+/*]]>*/
+</script>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/wicket/blob/e721aac0/wicket-core/src/test/java/org/apache/wicket/markup/parser/filter/StyleAndScriptIdentifierTest.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/markup/parser/filter/StyleAndScriptIdentifierTest.java b/wicket-core/src/test/java/org/apache/wicket/markup/parser/filter/StyleAndScriptIdentifierTest.java
new file mode 100644
index 0000000..37e63a0
--- /dev/null
+++ b/wicket-core/src/test/java/org/apache/wicket/markup/parser/filter/StyleAndScriptIdentifierTest.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.markup.parser.filter;
+
+import org.apache.wicket.WicketTestCase;
+import org.junit.Test;
+
+/**
+ * @since 6.0
+ */
+public class StyleAndScriptIdentifierTest extends WicketTestCase
+{
+	/**
+	 * https://issues.apache.org/jira/browse/WICKET-4425
+	 *
+	 * Verifies that the content of <script id="script1" type="text/x-jquery-tmpl">
+	 * wont be wrapped in CDATA, while all <script type="text/javascript"> will
+	 * be wrapped unless they have their body already wrapped
+	 *
+	 * @throws Exception
+	 */
+	@Test
+	public void doNotWrapScriptTemplates() throws Exception
+	{
+		executeTest(PageWithScriptTemplate.class, "PageWithScriptTemplate_expected.html");
+	}
+
+}