[z3-checkins] r33744 - z3/deliverance/branches/packaged/deliverance/test-data
rmarianski at codespeak.net
rmarianski at codespeak.net
Thu Oct 26 00:15:36 CEST 2006
Author: rmarianski
Date: Thu Oct 26 00:15:26 2006
New Revision: 33744
Added:
z3/deliverance/branches/packaged/deliverance/test-data/test_drop.xml
Log:
added tests for drop rule
Added: z3/deliverance/branches/packaged/deliverance/test-data/test_drop.xml
==============================================================================
--- (empty file)
+++ z3/deliverance/branches/packaged/deliverance/test-data/test_drop.xml Thu Oct 26 00:15:26 2006
@@ -0,0 +1,168 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deliverance-test-suite>
+
+<!-- drop a simple div tag in theme -->
+<deliverance-test>
+ <rules xmlns="http://www.plone.org/deliverance">
+ <drop theme="//div[@id='foo']"/>
+ </rules>
+
+ <theme base="http://example.com">
+ <html><head><title>Blah</title></head><body><div id="foo">Dummy Content</div></body></html>
+ </theme>
+
+ <content>
+ <html><body>Real Content</body></html>
+ </content>
+
+ <output>
+ <html><head><title>Blah</title></head><body></body></html>
+ </output>
+</deliverance-test>
+
+<!-- drop 2 div tags in theme -->
+<deliverance-test>
+ <rules xmlns="http://www.plone.org/deliverance">
+ <drop theme="//div[@id='foo']"/>
+ <drop theme="//div[@id='bar']"/>
+ </rules>
+
+ <theme base="http://example.com">
+ <html><body><div id="foo">foo</div><div id="bar">bar</div><div id="urn">urn</div></body></html>
+ </theme>
+
+ <content>
+ <html><body>Real Content</body></html>
+ </content>
+
+ <output>
+ <html><body><div id="urn">urn</div></body></html>
+ </output>
+</deliverance-test>
+
+<!-- drop element from content -->
+<deliverance-test>
+ <rules xmlns="http://www.plone.org/deliverance">
+ <drop content="//div[@id='foo']"/>
+ <copy theme=".//body" content="//body/child::node()"/>
+ </rules>
+
+ <theme base="http://example.com">
+ <html><body><div id="urn"></div></body></html>
+ </theme>
+
+ <content>
+ <html>
+ <body>
+ <div id="foo">shouldn't appear</div>
+ <div id="bar">should appear</div>
+ </body>
+ </html>
+ </content>
+
+ <output>
+ <html><body><div id="bar">should appear</div></body></html>
+ </output>
+</deliverance-test>
+
+<!-- drop element from both theme and content -->
+<deliverance-test>
+ <rules xmlns="http://www.plone.org/deliverance">
+ <drop content="//div[@id='foo']"/>
+ <drop theme="//div[@id='bar']"/>
+ <copy theme=".//body" content="//body/child::node()"/>
+ </rules>
+
+ <theme base="http://example.com">
+ <html>
+ <body>
+ <div id="bar">disappear</div>
+ </body>
+ </html>
+ </theme>
+
+ <content>
+ <html>
+ <body>
+ <div id="foo">disappear</div>
+ <div id="urn">appear</div>
+ </body>
+ </html>
+ </content>
+
+ <output>
+ <html><body><div id="urn">appear</div></body></html>
+ </output>
+</deliverance-test>
+
+<!-- dropping a tag drops itself and all its children -->
+<deliverance-test>
+ <rules xmlns="http://www.plone.org/deliverance">
+ <drop theme="//div[@id='foo']"/>
+ </rules>
+
+ <theme base="http://example.com">
+ <html>
+ <body>
+ <div id="foo"><p>none</p><p>of these<b>should appear</b></p></div>
+ </body>
+ </html>
+ </theme>
+
+ <content>
+ <html><body>Real Content</body></html>
+ </content>
+
+ <output>
+ <html><body></body></html>
+ </output>
+</deliverance-test>
+
+<!-- dropping missing tag generates an error -->
+<!-- XXX currently does not generate error, should it? -->
+<!--deliverance-test>
+ <rules xmlns="http://www.plone.org/deliverance">
+ <drop theme="//div[@id='foo']"/>
+ </rules>
+
+ <theme base="http://example.com">
+ <html><body>Dummy Content</body></html>
+ </theme>
+
+ <content>
+ <html><body>Real Content</body></html>
+ </content>
+
+ <output>
+ <html>
+ <body>
+ Dummy Content
+ <div class="deliverance-error">Deliverance error: no element found in theme<br/>rule: <drop theme=".//div[@id='foo']"/>
+ </div>
+ </body>
+ </html>
+ </output>
+</deliverance-test-->
+
+<!-- dropping a tag that doesn't exist and ignoring errors
+ should squash error messages -->
+<deliverance-test>
+ <rules xmlns="http://www.plone.org/deliverance">
+ <drop theme="//div[@id='foo']" nocontent='ignore'/>
+ </rules>
+
+ <theme base="http://example.com">
+ <html><body>Dummy Content</body></html>
+ </theme>
+
+ <content>
+ <html><body>Real Content</body></html>
+ </content>
+
+ <output>
+ <html><body>Dummy Content</body></html>
+ </output>
+</deliverance-test>
+
+</deliverance-test-suite>
+
More information about the z3-checkins
mailing list