You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by mi...@apache.org on 2005/08/02 23:40:56 UTC

cvs commit: jakarta-tapestry/framework/src/scripts TestFor.xml

mindbridge    2005/08/02 14:40:56

  Modified:    framework/src/test-data/context34 Home.html
               framework/src/scripts TestFor.xml
  Added:       framework/src/test/org/apache/tapestry/junit/mock/c34
                        Home.java
               framework/src/test-data/context34/WEB-INF Home.page
  Log:
  More elaborate and complete unit tests of the For component
  
  Revision  Changes    Path
  1.3       +16 -23    jakarta-tapestry/framework/src/test/org/apache/tapestry/junit/mock/c34/Home.java
  
  
  
  
  1.4       +24 -11    jakarta-tapestry/framework/src/test-data/context34/Home.html
  
  Index: Home.html
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/test-data/context34/Home.html,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Home.html	4 Jul 2005 21:41:13 -0000	1.3
  +++ Home.html	2 Aug 2005 21:40:56 -0000	1.4
  @@ -5,37 +5,50 @@
   Check the behavour of If, Else, and For.
   </p>
   
  -	<span jwcid="@If" condition="!false">Show text!</span>
  +	<span jwcid="@If" condition="ognl: !false">Show text!</span>
   	<span jwcid="@Else">Do not show this</span>
   
   	<span jwcid="@If" condition="false">Do not show this either</span>
   	<span jwcid="@Else">But show this too!</span>
       
   
  -	<span jwcid="for1@For" source="{ 'one', 'two' }">
  -        for1 <span jwcid="@Insert" value="components.for1.index"/> : <span jwcid="@Insert" value="components.for1.value"/>
  +	<span jwcid="for1@For" source="ognl: { 'one', 'two' }">
  +        for1 <span jwcid="@Insert" value="ognl: components.for1.index"/> : <span jwcid="@Insert" value="ognl: components.for1.value"/>
       </span>
   
  +    <p>Rewinded index count: <span jwcid="@Insert" value="ognl: rewindedIndexes.size()"/></p>
  +    <span jwcid="inds@For" source="ognl: rewindedIndexes" element="p">
  +        Rewinded index <span jwcid="@Insert" value="ognl: components.inds.index"/> is <span jwcid="@Insert" value="ognl: components.inds.value"/>
  +    </span>
  +    
  +    <p>Rewinded value count: <span jwcid="@Insert" value="ognl: rewindedValues.size()"/></p>
  +    <span jwcid="vals@For" source="ognl: rewindedValues" element="p">
  +        Rewinded value <span jwcid="@Insert" value="ognl: components.vals.index"/> is <span jwcid="@Insert" value="ognl: components.vals.value"/>
  +    </span>
       
       <span jwcid="@Form">
  -		<span jwcid="@If" condition="!false">Show form text!</span>
  +		<span jwcid="@If" condition="ognl: !false">Show form text!</span>
   		<span jwcid="@Else">Do not show form text</span>
   	
   		<span jwcid="@If" condition="false">Do not show this form text either</span>
   		<span jwcid="@Else">But show this form text too!</span>
   	    
   	
  -		<span jwcid="for2@For" source="{ 'uno', 'due' }">
  -	        for2 <span jwcid="@Insert" value="components.for2.index"/> : <span jwcid="@Insert" value="components.for2.value"/>
  +		<span jwcid="for2@For" source="ognl: { 'uno', 'due' }" 
  +            index="ognl: index" value="ognl: value">
  +	        for2 <span jwcid="@Insert" value="ognl: components.for2.index"/> : <span jwcid="@Insert" value="ognl: components.for2.value"/>
   	    </span>
   	
  -		<span jwcid="for3@For" source="{ @java.util.Locale@US, @java.util.Locale@GERMANY }" 
  -            fullSource="@java.util.Locale@getAvailableLocales()" keyExpression="toString()">
  -	        for3 <span jwcid="@Insert" value="components.for3.index"/> : <span jwcid="@Insert" value="components.for3.value"/>
  +		<span jwcid="for3@For" source="ognl: { @java.util.Locale@US, @java.util.Locale@GERMANY }" 
  +            fullSource="ognl: @java.util.Locale@getAvailableLocales()" keyExpression="toString()"
  +            index="ognl: index" value="ognl: value">
  +	        for3 <span jwcid="@Insert" value="ognl: components.for3.index"/> : <span jwcid="@Insert" value="ognl: components.for3.value"/>
   	    </span>
   	
  -		<span jwcid="for4@For" source="{ @java.util.Locale@US, @java.util.Locale@GERMANY }" keyExpression="toString()" defaultValue="@java.util.Locale@ENGLISH">
  -	        for4 <span jwcid="@Insert" value="components.for4.index"/> : <span jwcid="@Insert" value="components.for4.value"/>
  +		<span jwcid="for4@For" source="ognl: { @java.util.Locale@US, @java.util.Locale@GERMANY }" keyExpression="toString()" 
  +            defaultValue="ognl: @java.util.Locale@ENGLISH"
  +            index="ognl: index" value="ognl: value">
  +	        for4 <span jwcid="@Insert" value="ognl: components.for4.index"/> : <span jwcid="@Insert" value="ognl: components.for4.value"/>
   	    </span>
   	</span>        
       
  
  
  
  1.3       +11 -11    jakarta-tapestry/framework/src/test-data/context34/WEB-INF/Home.page
  
  
  
  
  1.2       +106 -0    jakarta-tapestry/framework/src/scripts/TestFor.xml
  
  Index: TestFor.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/scripts/TestFor.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestFor.xml	4 Jul 2005 21:41:13 -0000	1.1
  +++ TestFor.xml	2 Aug 2005 21:40:56 -0000	1.2
  @@ -56,5 +56,111 @@
           
   	</request>		
   
  +	<request>
  +	  	<parameter name="formids" value="$If$1,$If$2,for2,for3,for4"/>
  +	  	<parameter name="component" value="$Form"/>
  +	  	<parameter name="page" value="Home"/>
  +	  	<parameter name="service" value="direct"/>
  +	  	<parameter name="submitmode" value=""/>
  +	  	<parameter name="$If$1" value="T"/>
  +	  	<parameter name="$If$2" value="F"/>
  +	  	<parameter name="for2">
  +              <value>VV</value>
  +              <value>Suno</value>
  +              <value>Sdue</value>
  +        </parameter>
  +	  	<parameter name="for3">
  +              <value>PP</value>
  +              <value>Sbg_BG</value>
  +              <value>Sde_DE</value>
  +        </parameter>
  +	  	<parameter name="for4">
  +              <value>PP</value>
  +              <value>Sen_US</value>
  +              <value>Sbg_BG</value>
  +        </parameter>
  +
  +		<assert-output name="Test If 1">
  +Show text!
  +		</assert-output>
  +
  +		<assert-no-output name="Test If 2">
  +Do not show this
  +		</assert-no-output>
  +
  +		<assert-no-output name="Test If 3">
  +Do not show this either
  +		</assert-no-output>
  +
  +		<assert-output name="Test If 4">
  +But show this too!
  +		</assert-output>
  +
  +		<assert-output name="Test Form If 1">
  +Show form text!
  +		</assert-output>
  +
  +		<assert-no-output name="Test Form If 2">
  +Do not show form text
  +		</assert-no-output>
  +
  +		<assert-no-output name="Test Form If 3">
  +Do not show this form text either
  +		</assert-no-output>
  +
  +		<assert-output name="Test If 4">
  +But show this form text too!
  +		</assert-output>
  +        
  +		<assert-output name="Test For index 0">
  +Rewinded index 0 is 0
  +		</assert-output>
  +                  
  +		<assert-output name="Test For index 1">
  +Rewinded index 1 is 1
  +		</assert-output>
  +                  
  +		<assert-output name="Test For index 2">
  +Rewinded index 2 is 0
  +		</assert-output>
  +                  
  +		<assert-output name="Test For index 3">
  +Rewinded index 3 is 1
  +		</assert-output>
  +                  
  +		<assert-output name="Test For index 4">
  +Rewinded index 4 is 0
  +		</assert-output>
  +                  
  +		<assert-output name="Test For index 5">
  +Rewinded index 5 is 1
  +		</assert-output>
  +                  
  +		<assert-output name="Test For value 0">
  +Rewinded value 0 is uno
  +		</assert-output>
  +                  
  +		<assert-output name="Test For value 1">
  +Rewinded value 1 is due
  +		</assert-output>
  +                  
  +		<assert-output name="Test For value 2">
  +Rewinded value 2 is bg_BG
  +		</assert-output>
  +                  
  +		<assert-output name="Test For value 3">
  +Rewinded value 3 is de_DE
  +		</assert-output>
  +                  
  +		<assert-output name="Test For value 4">
  +Rewinded value 4 is en_US
  +		</assert-output>
  +                  
  +		<assert-output name="Test For value 5">
  +Rewinded value 5 is en
  +		</assert-output>
  +                  
  +	</request>		
  +    
   </mock-test>
       	
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org