1 // Copyright 2004-2007 Castle Project - http://www.castleproject.org/
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
7 // http://www.apache.org/licenses/LICENSE-2.0
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.
15 namespace Castle
.MonoRail
.Framework
.Tests
.Helpers
19 using NUnit
.Framework
;
21 using Castle
.MonoRail
.Framework
.Helpers
;
25 public class HtmlHelperTestCase
: AbstractTestCase
30 HtmlHelper helper
= new HtmlHelper();
31 Assert
.AreEqual( "<form method=\"post\" action=\"something.rails\">" + Environment
.NewLine
,
32 helper
.Form("something.rails") );
36 public void EndFormTag()
38 HtmlHelper helper
= new HtmlHelper();
39 Assert
.AreEqual( "</form>", helper
.EndForm() );
43 public void LabelFor()
45 HtmlHelper helper
= new HtmlHelper();
46 Assert
.AreEqual( "<label for=\"x\">name</label>" + Environment
.NewLine
, helper
.LabelFor("x", "name") );
50 public void BuildUnorderedList1()
52 String
[] args
= new String
[] { "arg1", "arg2" }
;
53 HtmlHelper helper
= new HtmlHelper();
54 Assert
.AreEqual( "<ul>" + Environment
.NewLine
+ "<li>arg1</li>" + Environment
.NewLine
+ "<li>arg2</li>" + Environment
.NewLine
+ "</ul>" + Environment
.NewLine
,
55 helper
.BuildUnorderedList(args
) );
59 public void BuildUnorderedList2()
61 String
[] args
= new String
[] { "arg1" }
;
62 HtmlHelper helper
= new HtmlHelper();
63 Assert
.AreEqual( "<ul class=\"style1\">" + Environment
.NewLine
+ "<li class=\"style2\">arg1</li>" + Environment
.NewLine
+ "</ul>" + Environment
.NewLine
,
64 helper
.BuildUnorderedList(args
, "style1", "style2") );
70 DoGet("helper/linkto.rails", "name=Click", "action=href");
73 AssertReplyEqualTo("<a href=\"/helper/href.rails\">Click</a>");
75 DoGet("test/helper2/linkto.rails", "name=Click", "action=href");
78 AssertReplyEqualTo("<a href=\"/test/helper2/href.rails\">Click</a>");