properties.aspx 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <%@ Page Language="C#" AutoEventWireup="True" %>
  2. <html>
  3. <head>
  4. </head>
  5. <body>
  6. <h3>RangeValidator render tests</h3>
  7. <form runat="server">
  8. <asp:TextBox id="TextBox1"
  9. runat="server"/>
  10. <asp:RangeValidator id="RA_noattributes"
  11. ControlToValidate="TextBox1"
  12. runat="server"/>
  13. <!-- this control should render as a single &nbsp;
  14. unfortunately there's no way to test this except
  15. through looking at the source. -->
  16. <asp:RangeValidator id="RA_static_downlevel"
  17. ControlToValidate="TextBox1"
  18. Display="Static"
  19. ErrorMessage="Your value isn't within min/max"
  20. EnableClientScript="False"
  21. runat="server"/>
  22. <!-- just a validator with a non-default Min/Max values -->
  23. <asp:RangeValidator id="RA_minmax"
  24. ControlToValidate="TextBox1"
  25. Type="Integer"
  26. MinimumValue="1"
  27. MaximumValue="10"
  28. runat="server"/>
  29. <!-- a dynamic uplevel validator. -->
  30. <asp:RangeValidator id="RA_dynamic_uplevel"
  31. ControlToValidate="TextBox1"
  32. Type="Integer"
  33. MinimumValue="1"
  34. MaximumValue="10"
  35. Display="Dynamic"
  36. ErrorMessage="Your value isn't within min/max"
  37. runat="server"/>
  38. <asp:Label id="Label1"
  39. runat="server"/>
  40. </form>
  41. <script Language="JavaScript">
  42. var TestFixture = {
  43. RA_noattributes : function () {
  44. JSUnit_BindElement ("RA_noattributes");
  45. Assert.NotNull ("JSUnit_GetElement ()", "exists");
  46. Assert.AttributeHasValue ("TextBox1", "controltovalidate", "controltovalidate");
  47. Assert.IsFunction ("JSUnit_GetAttribute ('evaluationfunction')", "evaluationfunction");
  48. Assert.AttributeHasValue ("", "minimumvalue", "minimumvalue");
  49. Assert.AttributeHasValue ("", "maximumvalue", "maximumvalue");
  50. Assert.AreEqualCase ("red", "JSUnit_GetAttribute ('style')['color']", "color style");
  51. Assert.AreEqualCase ("hidden", "JSUnit_GetAttribute ('style')['visibility']", "visibility style");
  52. },
  53. RA_minmax: function () {
  54. JSUnit_BindElement ("RA_minmax");
  55. Assert.AttributeHasValue ("1", "minimumvalue", "minimumvalue");
  56. Assert.AttributeHasValue ("10", "maximumvalue", "maximumvalue");
  57. },
  58. RA_static_downlevel: function () {
  59. JSUnit_BindElement ("RA_static_downlevel");
  60. Assert.IsNull ("JSUnit_GetElement ()", "does not exist");
  61. },
  62. RA_dynamic_uplevel: function () {
  63. JSUnit_BindElement ("RA_dynamic_uplevel");
  64. Assert.NotNull ("JSUnit_GetElement ()", "exists");
  65. Assert.AttributeHasValue ("TextBox1", "controltovalidate", "controltovalidate");
  66. Assert.IsFunction ("JSUnit_GetAttribute ('evaluationfunction')", "evaluationfunction");
  67. Assert.AttributeHasValue ("1", "minimumvalue", "minimumvalue");
  68. Assert.AttributeHasValue ("10", "maximumvalue", "maximumvalue");
  69. Assert.AttributeHasValue ("Dynamic", "display", "display");
  70. Assert.AttributeHasValue ("Your value isn't within min/max", "errormessage", "errormessage");
  71. Assert.AreEqualCase ("red", "JSUnit_GetAttribute ('style')['color']", "color style");
  72. Assert.AreEqualCase ("none", "JSUnit_GetAttribute ('style')['display']", "display style");
  73. Assert.AreEqual ("Your value isn't within min/max", "JSUnit_GetElement ().innerHTML", "innerHTML");
  74. }
  75. };
  76. </script>
  77. </body>
  78. </html>