click3.aspx 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <%@ Page Language="C#" Debug="true" %>
  2. <script runat="server">
  3. void Click (object sender, EventArgs e)
  4. {
  5. label2.Text = button.Text;
  6. button.Text = "HEY";
  7. }
  8. </script>
  9. <html>
  10. <body>
  11. <p>should be blank after you click.
  12. <asp:Label runat="server" id="label2" />
  13. <p>Should say ABCD EFG HIJK before you click. Should say "HEY" after you click<p>
  14. <form runat="server">
  15. <asp:LinkButton id="button" OnClick="Click" runat="server">
  16. ABCD <asp:Label runat="server" id="label3" Text="EFG"/> HIJK
  17. </asp:LinkButton>
  18. <asp:LinkButton id="button2" OnClick="Click" runat="server"> button2 </asp:LinkButton>
  19. </form>
  20. <script Language="JavaScript">
  21. var TestFixture = {
  22. LB_click3_pre: function () {
  23. JSUnit_BindElement ("button");
  24. JSUnit_TestCausesPageLoad ();
  25. var linkbutton = JSUnit_GetElement ();
  26. /* IE fails this one because it capitalizes SPAN (which
  27. AreEqualCase fixes), but it also leaves out the quotes
  28. around "label3".. but only in the innerHTML property, not
  29. in the actual html. weird. */
  30. JSUnit_ExpectFailure ("IE fails to quote the id attribute properly");
  31. Assert.AreEqualCase ("ABCD <span id=\"label3\">EFG</span> HIJK", "JSUnit_GetElement ().innerHTML", "linkbutton inner html");
  32. Assert.AreEqual ("", "JSUnit_GetElement ('label2').innerHTML", "label2 inner html");
  33. JSUnit_Click (linkbutton);
  34. },
  35. LB_click3_post: function () {
  36. JSUnit_BindElement ("button");
  37. JSUnit_TestCausesPageLoad ();
  38. Assert.AreEqual ("HEY", "JSUnit_GetElement ('button').innerHTML", "linkbutton inner html");
  39. Assert.AreEqual ("", "JSUnit_GetElement ('label2').innerHTML", "label2 inner html");
  40. var linkbutton = JSUnit_GetElement ();
  41. JSUnit_Click (linkbutton);
  42. },
  43. LB_click3_postpost: function () {
  44. JSUnit_BindElement ("button");
  45. Trace.debug("made it to LB_click3_postpost");
  46. Assert.AreEqual ("HEY", "JSUnit_GetElement ().innerHTML", "linkbutton inner html");
  47. Assert.AreEqual ("HEY", "JSUnit_GetElement ('label2').innerHTML", "label2 inner html");
  48. }
  49. };
  50. </script>
  51. </body>
  52. </html>