properties.aspx 3.0 KB

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