properties.aspx 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <%@ Page Language="C#" AutoEventWireup="True" %>
  2. <html>
  3. <head>
  4. </head>
  5. <body>
  6. <h3>RegularExpressionValidator render tests</h3>
  7. <form runat="server">
  8. <asp:TextBox id="TextBox1"
  9. runat="server"/>
  10. <asp:RegularExpressionValidator id="RE_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:RegularExpressionValidator id="RE_static_downlevel"
  17. ControlToValidate="TextBox1"
  18. Display="Static"
  19. ErrorMessage="Your value doesn't match the expected results"
  20. EnableClientScript="False"
  21. runat="server"/>
  22. <!-- just a validator with a non-default ValidationExpression -->
  23. <asp:RegularExpressionValidator id="RE_validationexpression"
  24. ControlToValidate="TextBox1"
  25. ValidationExpression="\d{5}"
  26. runat="server"/>
  27. <!-- a dynamic uplevel validator. -->
  28. <asp:RegularExpressionValidator id="RE_dynamic_uplevel"
  29. ControlToValidate="TextBox1"
  30. ValidationExpression="\d{5}"
  31. Display="Dynamic"
  32. ErrorMessage="Your value doesn't match the expected results"
  33. runat="server"/>
  34. </form>
  35. <script Language="JavaScript">
  36. var TestFixture = {
  37. RE_noattributes : function () {
  38. JSUnit_BindElement ("RE_noattributes");
  39. Assert.NotNull ("JSUnit_GetElement ()", "exists");
  40. Assert.AttributeHasValue ("TextBox1", "controltovalidate", "controltovalidate");
  41. Assert.IsFunction ("JSUnit_GetAttribute ('evaluationfunction')", "evaluationfunction");
  42. Assert.AttributeHasValue (null, "validationexpression", "validationexpression");
  43. Assert.AreEqualCase ("red", "JSUnit_GetAttribute ('style')['color']", "color style");
  44. Assert.AreEqualCase ("hidden", "JSUnit_GetAttribute ('style')['visibility']", "visibility style");
  45. },
  46. RE_validationexpression: function () {
  47. JSUnit_BindElement ("RE_validationexpression");
  48. Assert.AttributeHasValue ("\\d{5}", "validationexpression", "validationexpression");
  49. },
  50. RE_static_downlevel: function () {
  51. JSUnit_BindElement ("RE_static_downlevel");
  52. Assert.IsNull ("JSUnit_GetElement ()", "does not exist");
  53. },
  54. RE_dynamic_uplevel: function () {
  55. JSUnit_BindElement ("RE_dynamic_uplevel");
  56. Assert.NotNull ("JSUnit_GetElement ()", "exists");
  57. Assert.AttributeHasValue ("TextBox1", "controltovalidate", "controltovalidate");
  58. Assert.IsFunction ("JSUnit_GetAttribute ('evaluationfunction')", "evaluationfunction");
  59. Assert.AttributeHasValue ("\\d{5}", "validationexpression", "validationexpression");
  60. Assert.AttributeHasValue ("Dynamic", "display", "display");
  61. Assert.AttributeHasValue ("Your value doesn't match the expected results", "errormessage", "errormessage");
  62. Assert.AreEqualCase ("red", "JSUnit_GetAttribute ('style')['color']", "color style");
  63. Assert.AreEqualCase ("none", "JSUnit_GetAttribute ('style')['display']", "display style");
  64. Assert.AreEqual ("Your value doesn't match the expected results", "JSUnit_GetElement ().innerHTML", "innerHTML");
  65. }
  66. };
  67. </script>
  68. </body>
  69. </html>