You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by an...@apache.org on 2007/02/12 18:59:19 UTC
svn commit: r506556 - in /tapestry/tapestry4/trunk/tapestry-framework/src:
java/org/apache/tapestry/html/ scripts/ test/org/apache/tapestry/junit/mock/
test/org/apache/tapestry/junit/mock/app/
Author: andyhot
Date: Mon Feb 12 09:59:18 2007
New Revision: 506556
URL: http://svn.apache.org/viewvc?view=rev&rev=506556
Log:
TAPESTRY-1266: dont output anything for @Style if no href or body given
Modified:
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Relation.java
tapestry/tapestry4/trunk/tapestry-framework/src/scripts/TestShellAndRelation.xml
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/junit/mock/TestMockApplications.java
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/junit/mock/app/Styled.html
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Relation.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Relation.java?view=diff&rev=506556&r1=506555&r2=506556
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Relation.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Relation.java Mon Feb 12 09:59:18 2007
@@ -90,6 +90,10 @@
protected void renderStyleTag(Shell shell, IMarkupWriter writer, IRequestCycle cycle)
{
+ if (getBody()==null) //nothing to include
+ {
+ return;
+ }
StringWriter sWriter = new StringWriter();
IMarkupWriter nested = getMarkupWriterSource().newMarkupWriter(new PrintWriter(sWriter),
new ContentType(writer.getContentType()));
@@ -99,7 +103,7 @@
nested.attribute("media", getMedia());
if (getTitle()!=null)
nested.attribute("title", getTitle());
-
+
renderBody(nested, cycle);
nested.close();
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/scripts/TestShellAndRelation.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/scripts/TestShellAndRelation.xml?view=diff&rev=506556&r1=506555&r2=506556
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/scripts/TestShellAndRelation.xml (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/scripts/TestShellAndRelation.xml Mon Feb 12 09:59:18 2007
@@ -42,9 +42,15 @@
a {background:yellow;}
</style>
]]>
- </assert-output>
-
- </request>
+ </assert-output>
+
+ <assert-no-output name="Drop style if no body">
+<![CDATA[
+<style type="text/css" media="unknown"></style>
+]]>
+ </assert-no-output>
+
+ </request>
</mock-test>
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/junit/mock/TestMockApplications.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/junit/mock/TestMockApplications.java?view=diff&rev=506556&r1=506555&r2=506556
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/junit/mock/TestMockApplications.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/junit/mock/TestMockApplications.java Mon Feb 12 09:59:18 2007
@@ -582,7 +582,7 @@
/**
* Handles <assert-no-output> elements inside <request>. Checks that a substring
- * appears in the output. Content of element is the substring to search for.
+ * does not appear in the output. Content of element is the substring to search for.
* <p>
* Attribute name is used in error messages.
*/
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/junit/mock/app/Styled.html
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/junit/mock/app/Styled.html?view=diff&rev=506556&r1=506555&r2=506556
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/junit/mock/app/Styled.html (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/junit/mock/app/Styled.html Mon Feb 12 09:59:18 2007
@@ -6,6 +6,7 @@
Empty page...
<style jwcid="@Style" media="all">
a {background:yellow;}
-</style>
+</style>
+<style jwcid="@Style" media="unknown"/>
</span>
</span>