/[Apache-SVN]/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/TestButton.java
ViewVC logotype

Contents of /tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/TestButton.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 481488 - (show annotations)
Sat Dec 2 01:56:38 2006 UTC (2 years, 11 months ago) by jkuhnert
File size: 3128 byte(s)
Resolved TAPESTRY-848 (was our most popular issue! ) 

Removed old PageLoader sync blocks as they were ineffective against a large block in DisableCachingFilter which 
is where the locking logic was moved. 

Updated testng tests to run in parallel mode for faster testing and cleaned up subsequent failing tests.
1 // Copyright 2005 The Apache Software Foundation
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 package org.apache.tapestry.form;
16
17 import org.apache.tapestry.BaseComponentTestCase;
18 import org.apache.tapestry.IBinding;
19 import org.apache.tapestry.IMarkupWriter;
20 import org.apache.tapestry.IRequestCycle;
21 import org.apache.tapestry.spec.ComponentSpecification;
22 import org.testng.annotations.Test;
23
24 @Test(sequential=true)
25 public class TestButton extends BaseComponentTestCase
26 {
27 public void testRender()
28 {
29 Button b = newInstance(Button.class, new Object[]
30 { "name", "assignedName" });
31
32 IMarkupWriter writer = newBufferWriter();
33 IRequestCycle cycle = newCycle();
34
35 replay();
36
37 b.renderFormComponent(writer, cycle);
38
39 verify();
40
41 assertBuffer("<button type=\"button\" name=\"assignedName\"></button>");
42 }
43
44 public void testRenderLabel()
45 {
46 Button b = newInstance(Button.class, new Object[]
47 { "name", "assignedName", "label", "Label" });
48
49 IMarkupWriter writer = newBufferWriter();
50 IRequestCycle cycle = newCycle();
51
52 replay();
53
54 b.renderFormComponent(writer, cycle);
55
56 verify();
57
58 assertBuffer("<button type=\"button\" name=\"assignedName\">Label</button>");
59 }
60
61 public void testRenderInformalParameters()
62 {
63 Button b = newInstance(Button.class, new Object[]
64 { "name", "assignedName", "specification", new ComponentSpecification() });
65
66 IMarkupWriter writer = newBufferWriter();
67 IRequestCycle cycle = newCycle();
68
69 IBinding binding = newBinding("informal-value");
70
71 b.setBinding("informal", binding);
72
73 replay();
74
75 b.renderFormComponent(writer, cycle);
76
77 verify();
78
79 assertBuffer("<button type=\"button\" name=\"assignedName\" informal=\"informal-value\"></button>");
80 }
81
82 public void testRenderWithId()
83 {
84 Button b = newInstance(Button.class, new Object[]
85 { "clientId", "assignedId", "name", "assignedId"});
86
87 IMarkupWriter writer = newBufferWriter();
88 IRequestCycle cycle = newCycle();
89
90 replay();
91
92 b.renderFormComponent(writer, cycle);
93
94 verify();
95
96 assertBuffer("<button type=\"button\" name=\"assignedId\" id=\"assignedId\"></button>");
97 }
98
99 public void testSubmit()
100 {
101 Button b = (Button) newInstance(Button.class);
102
103 IMarkupWriter writer = newWriter();
104 IRequestCycle cycle = newCycle();
105
106 replay();
107
108 b.rewindFormComponent(writer, cycle);
109
110 verify();
111 }
112 }

Properties

Name Value
svn:eol-style native

apache@apache.org
ViewVC Help
Powered by ViewVC 1.1.2