Changed to use Authenticate asp.net event instead of Authorize
[castle.git] / MonoRail / Castle.MonoRail.Views.Brail.Tests / BrailAjaxTestCase.cs
blobf757fb5ffb0f4e3eb9bc0460b3bb6f4f0443f0fc
1 // Copyright 2004-2007 Castle Project - http://www.castleproject.org/
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.
15 namespace Castle.MonoRail.Views.Brail.Tests
17 using Castle.MonoRail.Framework.Tests;
18 using NUnit.Framework;
20 [TestFixture]
21 public class BrailAjaxTestCase : AbstractTestCase
23 [Test]
24 public void BuildFormRemoteTag()
26 DoGet("ajax/BuildFormRemoteTag.rails");
27 string expected =
28 "<form onsubmit=\"new Ajax.Request('url', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;\" enctype=\"multipart/form-data\" action=\"url\" method=\"post\" >";
29 AssertSuccess();
30 AssertReplyEqualTo(expected);
33 [Test]
34 public void JsFunctions()
36 DoGet("ajax/JsFunctions.rails");
37 string expected = "<script type=\"text/javascript\" src=\"/MonoRail/Files/AjaxScripts.rails?RC3_0006\"></script>";
38 AssertSuccess();
39 AssertReplyEqualTo(expected);
42 [Test]
43 public void LinkToFunction()
45 DoGet("ajax/LinkToFunction.rails");
46 string expected =
47 "<a href=\"javascript:void(0);\" onclick=\"alert('Ok'); return false;\" ><img src='myimg.gid'></a>";
48 AssertSuccess();
49 AssertReplyEqualTo(expected);
52 [Test]
53 public void LinkToRemote()
55 DoGet("ajax/LinkToRemote.rails");
56 string expected =
57 "<a href=\"javascript:void(0);\" onclick=\"new Ajax.Request('/controller/action.rails', {asynchronous:true, evalScripts:true}); return false;\" ><img src='myimg.gid'></a>";
58 AssertSuccess();
59 AssertReplyEqualTo(expected);
62 [Test]
63 public void ObserveField()
65 DoGet("ajax/ObserveField.rails");
66 string expected =
67 "<script type=\"text/javascript\">new Form.Element.Observer('myfieldid', 2, function(element, value) { new Ajax.Updater('elementToBeUpdated', '/url', {asynchronous:true, evalScripts:true, parameters:newcontent}) })</script>";
68 AssertSuccess();
69 AssertReplyEqualTo(expected);
72 [Test]
73 public void ObserveForm()
75 DoGet("ajax/ObserveForm.rails");
76 string expected =
77 "<script type=\"text/javascript\">new Form.Observer('myfieldid', 2, function(element, value) { new Ajax.Updater('elementToBeUpdated', '/url', {asynchronous:true, evalScripts:true, parameters:newcontent}) })</script>";
78 AssertSuccess();
79 AssertReplyEqualTo(expected);