Пример #1
0
        public void TreeNode_NavigateUrl()
        {
            WebTest t = new WebTest(PageInvoker.CreateOnLoad(pageLoadNavigateUrl));

#if NET_4_0
            string strTarget = "<a href=\"#treeview1_SkipLink\"><img alt=\"Skip Navigation Links.\" src=\"/NunitWeb/WebResource.axd?d=8VpphgAbakKUC_J8R6hR0Q2&amp;t=634067491135766272\" width=\"0\" height=\"0\" style=\"border-width:0px;\" /></a><div id=\"treeview1\">\r\n\t<table cellpadding=\"0\" cellspacing=\"0\" style=\"border-width:0;\">\r\n\t\t<tr>\r\n\t\t\t<td><img src=\"/NunitWeb/WebResource.axd?d=Me-CdxEHiTTT3lXTDd0I2ilpe6vhhhJjssENmbNkrSY1&amp;t=634067491135766272\" alt=\"\" /></td><td style=\"white-space:nowrap;\"><a class=\"treeview1_0\" href=\"NavigateUrl\" id=\"treeview1t0\">TreeNode1</a></td>\r\n\t\t</tr>\r\n\t</table>\r\n</div><a id=\"treeview1_SkipLink\"></a>";
#else
            string strTarget =
                @"<a href=""#treeview1_SkipLink""><img alt=""Skip Navigation Links."" src=""/NunitWeb/WebResource.axd?d=kffkK8wYLPknq-W8AKNdNQ2&amp;t=632883840303269703"" width=""0"" height=""0"" style=""border-width:0px;"" /></a><div id=""treeview1"">
	<table cellpadding=""0"" cellspacing=""0"" style=""border-width:0;"">
		<tr>
			<td><img src=""/NunitWeb/WebResource.axd?d=edXX1vkoy5lI0CekgaZ5zZhMbc1ZCZv4nlS9J-l53l41&amp;t=632883840303269703"" alt="""" /></td><td style=""white-space:nowrap;""><a class=""treeview1_0"" href=""NavigateUrl"" id=""treeview1t0"">TreeNode1</a></td>
		</tr>
	</table>
</div><a id=""treeview1_SkipLink""></a>";
#endif
            string str = HtmlDiff.GetControlFromPageHtml(t.Run());
            HtmlDiff.AssertAreEqual(strTarget, str, "PostbackNavigate");
        }
Пример #2
0
        public void Button_Render2()
        {
            StringWriter   sw = new StringWriter();
            HtmlTextWriter tw = new HtmlTextWriter(sw);

            Button b = new Button();

            b.ID   = "MyButton";
            b.Text = "Hello";
            b.UseSubmitBehavior = false;
            b.Enabled           = false;
            b.ToolTip           = "Hello_ToolTip";
            b.RenderControl(tw);

            string strTarget = "<input type=\"button\" name=\"MyButton\" value=\"Hello\" id=\"MyButton\" disabled=\"disabled\" title=\"Hello_ToolTip\" />";
            string str       = sw.ToString();

            HtmlDiff.AssertAreEqual(strTarget, str, "Button_Render2");
        }
Пример #3
0
        public void ValidationGroup()
        {
#if VISUAL_STUDIO
            WebTest.CopyResource(GetType(), "MonoTests.System.Web.UI.WebControls.Resources.NoEventValidation.aspx", "NoEventValidation.aspx");
#else
            WebTest.CopyResource(GetType(), "NoEventValidation.aspx", "NoEventValidation.aspx");
#endif
            WebTest t = new WebTest("NoEventValidation.aspx");
            t.Invoker = PageInvoker.CreateOnLoad(ValidationGroup_Load);
            string html = HtmlDiff.GetControlFromPageHtml(t.Run());
            if (html.IndexOf("onclick") == -1)
            {
                Assert.Fail("Validation script not created");
            }
            if (html.IndexOf("MyValidationGroup") == -1)
            {
                Assert.Fail("Validation group not set fail");
            }
        }
        public void InitializeCell()
        {
            string            origHtml = "<table><tr><td>&nbsp;</td><td>&nbsp;</td><td>one</td><td>two</td><td>three</td></tr><tr><td><a>Edit</a></td><td><input name=\"sucker$ctl02$ctl00\" type=\"submit\" value=\"Bearbeiten\" /></td><td>1</td><td>2</td><td>3</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>";
            DataGridTest      p        = new DataGridTest();
            DataTable         table    = new DataTable();
            EditCommandColumn e;
            string            markup;

            e            = new EditCommandColumn();
            e.ButtonType = ButtonColumnType.LinkButton;
            e.CancelText = "Cancel";
            e.EditText   = "Edit";
            e.UpdateText = "Update";

            table.Columns.Add(new DataColumn("one", typeof(string)));
            table.Columns.Add(new DataColumn("two", typeof(string)));
            table.Columns.Add(new DataColumn("three", typeof(string)));
            table.Rows.Add(new object [] { "1", "2", "3" });

            p.DataSource = new DataView(table);
            p.Columns.Add(e);

            e            = new EditCommandColumn();
            e.ButtonType = ButtonColumnType.PushButton;
            e.CancelText = "Abbrechen";
            e.EditText   = "Bearbeiten";
            e.UpdateText = "Refresh";
            p.Columns.Add(e);

            // This will trigger EditCommandColumn.InitializeCell, without any EditItem set, tests the EditText render
            p.CreateControls(true);
            p.ID = "sucker";

            Assert.AreEqual(2, p.Columns.Count, "I1");
            markup = ControlMarkup(p.Controls[0]);
            markup = markup.Replace("\t", "");
            markup = markup.Replace("\r", "");
            markup = markup.Replace("\n", "");

            HtmlDiff.AssertAreEqual(origHtml, markup, "I2");

            //ShowControlsRecursive (p.Controls [0], 1);
        }
Пример #5
0
        public void ImageMap_PostBack_RenderAfter()
        {
            WebTest t = new WebTest(PageInvoker.CreateOnLoad(myPageLoad));

            t.Run();
            FormRequest fr = new FormRequest(t.Response, "form1");

            fr.Controls.Add("__EVENTTARGET");
            fr.Controls.Add("__EVENTARGUMENT");
            fr.Controls["__EVENTTARGET"].Value   = "imgmap";
            fr.Controls["__EVENTARGUMENT"].Value = "0";
            t.Request = fr;
            #region orig
            string strTarget = "<img id=\"imgmap\" src=\"\" usemap=\"#ImageMapimgmap\" /><map name=\"ImageMapimgmap\" id=\"ImageMapimgmap\">\r\n\t<area shape=\"rect\" coords=\"0,0,0,0\" href=\"javascript:__doPostBack(&#39;imgmap&#39;,&#39;0&#39;)\" title=\"\" alt=\"\" /><area shape=\"poly\" coords=\"\" href=\"javascript:__doPostBack(&#39;imgmap&#39;,&#39;1&#39;)\" title=\"\" alt=\"\" /><area shape=\"circle\" coords=\"0,0,0\" href=\"javascript:__doPostBack(&#39;imgmap&#39;,&#39;2&#39;)\" title=\"\" alt=\"\" />\r\n</map>";
            #endregion
            string RenderedPageHtml    = t.Run();
            string RenderedControlHtml = HtmlDiff.GetControlFromPageHtml(RenderedPageHtml);
            HtmlDiff.AssertAreEqual(strTarget, RenderedControlHtml, "AfterPostBack");
        }
Пример #6
0
        public static List <StoriesHistoryModel> GetModels(string tag)
        {
            List <StoriesHistoryModel> ret = new List <StoriesHistoryModel>();

            using (var ctx = new Entities())
            {
                var    list = ctx.GetRequirementHistory(tag, null).ToList();
                string previous = string.Empty, text;

                foreach (var i in list)
                {
                    text = String.Format("<p><strong>{0}</strong></p>{1}", i.Title, i.Text);
                    ret.Add(new StoriesHistoryModel(i, HtmlDiff.Execute(previous, text)));
                    previous = text;
                }
            }

            return((from i in ret orderby i.RevisionNumber descending select i).ToList());
        }
Пример #7
0
        public void Render()
        {
            TestHtmlInputCheckBox c = new TestHtmlInputCheckBox();

            c.ID = "*1*";

            string s = c.Render();

            Assert.IsTrue(s.IndexOf(" type=\"checkbox\"") > 0, "type");

            c.Checked = true;
            s         = c.Render();

#if NET_2_0
            HtmlDiff.AssertAreEqual("<input name=\"*1*\" id=\"*1*\" type=\"checkbox\" checked=\"checked\" />", s, "Render fail");
#else
            HtmlDiff.AssertAreEqual("<input name=\"*1*\" type=\"checkbox\" id=\"*1*\" checked=\"checked\" />", s, "Render fail");
#endif
        }
Пример #8
0
        public void CheckBoxList_Bug600415()
        {
            WebTest t = new WebTest("CheckBoxList_Bug600415.aspx");

#if NET_4_0
            string origHtmlFirst  = "<table id=\"checkBoxList\">\r\n\t<tr>\r\n\t\t<td><input id=\"checkBoxList_0\" type=\"checkbox\" name=\"checkBoxList$0\" checked=\"checked\" value=\"Item 1\" /><label for=\"checkBoxList_0\">Item 1</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_1\" type=\"checkbox\" name=\"checkBoxList$1\" value=\"Item 2\" /><label for=\"checkBoxList_1\">Item 2</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_2\" type=\"checkbox\" name=\"checkBoxList$2\" checked=\"checked\" value=\"Item 3\" /><label for=\"checkBoxList_2\">Item 3</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_3\" type=\"checkbox\" name=\"checkBoxList$3\" value=\"Item 4\" /><label for=\"checkBoxList_3\">Item 4</label></td>\r\n\t</tr>\r\n</table>";
            string origHtmlSecond = "<table id=\"checkBoxList\">\r\n\t<tr>\r\n\t\t<td><input id=\"checkBoxList_0\" type=\"checkbox\" name=\"checkBoxList$0\" value=\"Item 1\" /><label for=\"checkBoxList_0\">Item 1</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_1\" type=\"checkbox\" name=\"checkBoxList$1\" value=\"Item 2\" /><label for=\"checkBoxList_1\">Item 2</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_2\" type=\"checkbox\" name=\"checkBoxList$2\" value=\"Item 3\" /><label for=\"checkBoxList_2\">Item 3</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_3\" type=\"checkbox\" name=\"checkBoxList$3\" value=\"Item 4\" /><label for=\"checkBoxList_3\">Item 4</label></td>\r\n\t</tr>\r\n</table>";
            string origHtmlThird  = "<table id=\"checkBoxList\">\r\n\t<tr>\r\n\t\t<td><input id=\"checkBoxList_0\" type=\"checkbox\" name=\"checkBoxList$0\" checked=\"checked\" value=\"Item 1\" /><label for=\"checkBoxList_0\">Item 1</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_1\" type=\"checkbox\" name=\"checkBoxList$1\" checked=\"checked\" value=\"Item 2\" /><label for=\"checkBoxList_1\">Item 2</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_2\" type=\"checkbox\" name=\"checkBoxList$2\" checked=\"checked\" value=\"Item 3\" /><label for=\"checkBoxList_2\">Item 3</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_3\" type=\"checkbox\" name=\"checkBoxList$3\" checked=\"checked\" value=\"Item 4\" /><label for=\"checkBoxList_3\">Item 4</label></td>\r\n\t</tr>\r\n</table>";
#else
            string origHtmlFirst  = "<table id=\"checkBoxList\" border=\"0\">\r\n\t<tr>\r\n\t\t<td><input id=\"checkBoxList_0\" type=\"checkbox\" name=\"checkBoxList$0\" checked=\"checked\" /><label for=\"checkBoxList_0\">Item 1</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_1\" type=\"checkbox\" name=\"checkBoxList$1\" /><label for=\"checkBoxList_1\">Item 2</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_2\" type=\"checkbox\" name=\"checkBoxList$2\" checked=\"checked\" /><label for=\"checkBoxList_2\">Item 3</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_3\" type=\"checkbox\" name=\"checkBoxList$3\" /><label for=\"checkBoxList_3\">Item 4</label></td>\r\n\t</tr>\r\n</table>";
            string origHtmlSecond = "<table id=\"checkBoxList\" border=\"0\">\r\n\t<tr>\r\n\t\t<td><input id=\"checkBoxList_0\" type=\"checkbox\" name=\"checkBoxList$0\" /><label for=\"checkBoxList_0\">Item 1</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_1\" type=\"checkbox\" name=\"checkBoxList$1\" /><label for=\"checkBoxList_1\">Item 2</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_2\" type=\"checkbox\" name=\"checkBoxList$2\" /><label for=\"checkBoxList_2\">Item 3</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_3\" type=\"checkbox\" name=\"checkBoxList$3\" /><label for=\"checkBoxList_3\">Item 4</label></td>\r\n\t</tr>\r\n</table>";
            string origHtmlThird  = "<table id=\"checkBoxList\" border=\"0\">\r\n\t<tr>\r\n\t\t<td><input id=\"checkBoxList_0\" type=\"checkbox\" name=\"checkBoxList$0\" checked=\"checked\" /><label for=\"checkBoxList_0\">Item 1</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_1\" type=\"checkbox\" name=\"checkBoxList$1\" checked=\"checked\" /><label for=\"checkBoxList_1\">Item 2</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_2\" type=\"checkbox\" name=\"checkBoxList$2\" checked=\"checked\" /><label for=\"checkBoxList_2\">Item 3</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"checkBoxList_3\" type=\"checkbox\" name=\"checkBoxList$3\" checked=\"checked\" /><label for=\"checkBoxList_3\">Item 4</label></td>\r\n\t</tr>\r\n</table>";
#endif
            string html     = t.Run();
            string listHtml = HtmlDiff.GetControlFromPageHtml(html);

            HtmlDiff.AssertAreEqual(origHtmlFirst, listHtml, "#A1");

            FormRequest fr = new FormRequest(t.Response, "form1");
            fr.Controls.Add("cmdClick");
            fr.Controls ["cmdClick"].Value = "Ok";

            t.Request = fr;
            html      = t.Run();

            listHtml = HtmlDiff.GetControlFromPageHtml(html);
            HtmlDiff.AssertAreEqual(origHtmlSecond, listHtml, "#A2");

            fr = new FormRequest(t.Response, "form1");
            fr.Controls.Add("checkBoxList$0");
            fr.Controls ["checkBoxList$0"].Value = "on";
            fr.Controls.Add("checkBoxList$1");
            fr.Controls ["checkBoxList$1"].Value = "on";
            fr.Controls.Add("checkBoxList$2");
            fr.Controls ["checkBoxList$2"].Value = "on";
            fr.Controls.Add("checkBoxList$3");
            fr.Controls ["checkBoxList$3"].Value = "on";

            t.Request = fr;
            html      = t.Run();
            listHtml  = HtmlDiff.GetControlFromPageHtml(html);
            HtmlDiff.AssertAreEqual(origHtmlThird, listHtml, "#A3");
        }
Пример #9
0
        public void TransformArgumentList()
        {
            string origin = @"<div>
					      <h2>Order</h2>
						<hr>
						<table>
						  <tr>
						    <td>Customer</td>
						    <td><font color=""blue"">12345purchased by: Mainsoft developers</font></td>
						    <td>Todd</td>
						    <td>Rowe</td>
						  </tr>
						</table>
						<hr>
					</div>"                    ;
            string result = new WebTest("XMLDataSourceTest3.aspx").Run();

            HtmlDiff.AssertAreEqual(origin, HtmlDiff.GetControlFromPageHtml(result), "TransformArgumentListFail");
        }
Пример #10
0
        public void Render1()
        {
            ListBoxPoker l = new ListBoxPoker();

            for (int i = 0; i < 3; i++)
            {
                l.Items.Add(i.ToString());
            }

            l.SelectedIndex = l.Items.Count - 1;

            string exp = @"<select size=""4"">
	<option value=""0"">0</option>
	<option value=""1"">1</option>
	<option selected=""selected"" value=""2"">2</option>

</select>";

            HtmlDiff.AssertAreEqual(exp, l.Render(), "Render1");
        }
Пример #11
0
        public void RenderItem()
        {
#if NET_4_0
            string origHtml1 = "<input id=\"0\" type=\"checkbox\" name=\"0\" value=\"value1\" /><label for=\"0\">item1</label>";
            string origHtml2 = "<input id=\"1\" type=\"checkbox\" name=\"1\" value=\"value2\" /><label for=\"1\">item2</label>";
#else
            string origHtml1 = "<input id=\"0\" type=\"checkbox\" name=\"0\" /><label for=\"0\">item1</label>";
            string origHtml2 = "<input id=\"1\" type=\"checkbox\" name=\"1\" /><label for=\"1\">item2</label>";
#endif
            CheckBoxListPoker c  = new CheckBoxListPoker();
            ListItem          l1 = new ListItem("item1", "value1");
            ListItem          l2 = new ListItem("item2", "value2");

            c.Items.Add(l1);
            c.Items.Add(l2);
            string html = c.RenderItem(ListItemType.Item, 0, null);
            HtmlDiff.AssertAreEqual(origHtml1, html, "RenderItem#1");
            html = c.RenderItem(ListItemType.Item, 1, null);
            HtmlDiff.AssertAreEqual(origHtml2, html, "RenderItem#2");
        }
Пример #12
0
        public void TreeNode_Render()
        {
            WebTest t         = new WebTest(PageInvoker.CreateOnLoad(pageLoadRender));
            string  strTarget =
                @"<a href=""#treeview1_SkipLink""><img alt=""Skip Navigation Links."" src=""/NunitWeb/WebResource.axd?d=kffkK8wYLPknq-W8AKNdNQ2&amp;t=632883840303269703"" width=""0"" height=""0"" style=""border-width:0px;"" /></a><div id=""treeview1"">
	<table cellpadding=""0"" cellspacing=""0"" style=""border-width:0;"">
		<tr>
			<td><a id=""treeview1n0"" href=""javascript:TreeView_ToggleNode(treeview1_Data,0,treeview1n0,' ',treeview1n0Nodes)""><img src=""/NunitWeb/WebResource.axd?d=edXX1vkoy5lI0CekgaZ5zW7-1Af97Wq_r6fRK7PDqP81&amp;t=632883840303269703"" alt=""Collapse text"" style=""border-width:0;"" /></a></td><td><a href=""navigateUrl"" target=""target"" onclick=""javascript:TreeView_SelectNode(treeview1_Data, this,'treeview1t0');javascript:TreeView_ToggleNode(treeview1_Data,0,treeview1n0,' ',treeview1n0Nodes)"" title=""ToolTip"" id=""treeview1t0i""><img src=""imageUrl"" alt=""ImageToolTip"" style=""border-width:0;"" /></a></td><td style=""white-space:nowrap;""><input type=""checkbox"" name=""treeview1n0CheckBox"" id=""treeview1n0CheckBox"" checked=""checked"" title=""text"" /><a class=""treeview1_0"" href=""navigateUrl"" target=""target"" onclick=""javascript:TreeView_SelectNode(treeview1_Data, this,'treeview1t0');javascript:TreeView_ToggleNode(treeview1_Data,0,treeview1n0,' ',treeview1n0Nodes)"" title=""ToolTip"" id=""treeview1t0"">text</a></td>
		</tr>
	</table>
	<table cellpadding=""0"" cellspacing=""0"" style=""border-width:0;"">
		<tr>
			<td><div style=""width:20px;height:1px""></div></td><td><img src=""/NunitWeb/WebResource.axd?d=edXX1vkoy5lI0CekgaZ5zZhMbc1ZCZv4nlS9J-l53l41&amp;t=632883840303269703"" alt="""" /></td><td style=""white-space:nowrap;""><a class=""treeview1_0"" href=""javascript:__doPostBack('treeview1','svalue\\childenode')"" onclick=""TreeView_SelectNode(treeview1_Data, this,'treeview1t1');"" id=""treeview1t1"">childenode</a></td>
		</tr>
	</table>
</div><a id=""treeview1_SkipLink""></a>";
            string str = HtmlDiff.GetControlFromPageHtml(t.Run());

            HtmlDiff.AssertAreEqual(strTarget, str, "Render");
        }
Пример #13
0
        public ActionResult CompareRevision(int articleid, int order1, int order2)
        {
            var article   = _articleRepository.Find(articleid);
            var revisions = article.ArticleRevisions.OrderBy(ar => ar.ChangedDate).ToList();
            var revision1 = revisions[order1 - 1];
            var revision2 = revisions[order2 - 1];

            HtmlDiff diffHelper = new HtmlDiff(revision1.ArticleContent, revision2.ArticleContent);
            string   diffOutput = diffHelper.Build();

            var viewModel = new RevisionCompareView();

            viewModel.Revision1       = AutoMapper.Mapper.Map <RevisionView>(revision1);
            viewModel.Revision1.Order = revisions.IndexOf(revision1) + 1;

            viewModel.Revision2       = AutoMapper.Mapper.Map <RevisionView>(revision2);
            viewModel.Revision2.Order = revisions.Count();

            return(Json(new { source = new { content = revision1.ArticleContent, time = revision1.ChangedDate.ToString("dd/MM/yyyy hh:mm:ss") }, result = new { content = diffOutput, time = revision2.ChangedDate.ToString("dd/MM/yyyy hh:mm:ss") } }));
        }
Пример #14
0
        public void OverridenControlsPropertyAndPostBack_Bug594238()
        {
            WebTest t = new WebTest("OverridenControlsPropertyAndPostBack_Bug594238.aspx");

            t.Run();

            FormRequest fr = new FormRequest(t.Response, "form1");

            fr.Controls.Add("__EVENTTARGET");
            fr.Controls.Add("__EVENTARGUMENT");
            fr.Controls ["__EVENTTARGET"].Value   = "container$children$lb";
            fr.Controls ["__EVENTARGUMENT"].Value = String.Empty;
            t.Request = fr;

            string originalHtml = @"<span id=""container""><a href=""javascript:__doPostBack('container$children$lb','')"" id=""container_children_lb"">Woot! I got clicked!</a></span><hr/>";
            string pageHtml     = t.Run();
            string renderedHtml = HtmlDiff.GetControlFromPageHtml(pageHtml);

            HtmlDiff.AssertAreEqual(originalHtml, renderedHtml, "#A1");
        }
Пример #15
0
        public void Scroll_Bars()
        {
            Poker p = new Poker();

            p.ScrollBars = ScrollBars.Horizontal;
            string html      = p.Render();
            string origHtml1 = "<div style=\"overflow-x:scroll;\">\n\n</div>";

            HtmlDiff.AssertAreEqual(origHtml1, html, "ScrollBars.Horizontal");
            p.ScrollBars = ScrollBars.Vertical;
            html         = p.Render();
            string origHtml2 = "<div style=\"overflow-y:scroll;\">\n\n</div>";

            HtmlDiff.AssertAreEqual(origHtml2, html, "ScrollBars.Vertical");
            p.ScrollBars = ScrollBars.Both;
            html         = p.Render();
            string origHtml3 = "<div style=\"overflow:scroll;\">\n\n</div>";

            HtmlDiff.AssertAreEqual(origHtml3, html, "ScrollBars.Both");
        }
Пример #16
0
        public void CheckBoxList_Bug377703_2()
        {
            WebTest t = new WebTest("CheckBoxList_Bug377703_2.aspx");

            t.Invoker = PageInvoker.CreateOnInit(CheckBoxList_Bug377703_2_OnInit);
            string origHtmlFirst  = "<table id=\"cbxl2\">\r\n\t<tr>\r\n\t\t<td><input id=\"cbxl2_0\" type=\"checkbox\" name=\"cbxl2$0\" value=\"x\" /><label for=\"cbxl2_0\">x</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"cbxl2_1\" type=\"checkbox\" name=\"cbxl2$1\" value=\"y\" /><label for=\"cbxl2_1\">y</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"cbxl2_2\" type=\"checkbox\" name=\"cbxl2$2\" value=\"z\" /><label for=\"cbxl2_2\">z</label></td>\r\n\t</tr>\r\n</table>";
            string origHtmlSecond = "<table id=\"cbxl2\" class=\"aspNetDisabled\">\r\n\t<tr>\r\n\t\t<td><span class=\"aspNetDisabled\"><input id=\"cbxl2_0\" type=\"checkbox\" name=\"cbxl2$0\" checked=\"checked\" disabled=\"disabled\" value=\"x\" /><label for=\"cbxl2_0\">x</label></span></td>\r\n\t</tr><tr>\r\n\t\t<td><span class=\"aspNetDisabled\"><input id=\"cbxl2_1\" type=\"checkbox\" name=\"cbxl2$1\" disabled=\"disabled\" value=\"y\" /><label for=\"cbxl2_1\">y</label></span></td>\r\n\t</tr><tr>\r\n\t\t<td><span class=\"aspNetDisabled\"><input id=\"cbxl2_2\" type=\"checkbox\" name=\"cbxl2$2\" checked=\"checked\" disabled=\"disabled\" value=\"z\" /><label for=\"cbxl2_2\">z</label></span></td>\r\n\t</tr>\r\n</table>";
            string origHtmlThird  = "<table id=\"cbxl2\" class=\"aspNetDisabled\">\r\n\t<tr>\r\n\t\t<td><span class=\"aspNetDisabled\"><input id=\"cbxl2_0\" type=\"checkbox\" name=\"cbxl2$0\" checked=\"checked\" disabled=\"disabled\" value=\"x\" /><label for=\"cbxl2_0\">x</label></span></td>\r\n\t</tr><tr>\r\n\t\t<td><span class=\"aspNetDisabled\"><input id=\"cbxl2_1\" type=\"checkbox\" name=\"cbxl2$1\" disabled=\"disabled\" value=\"y\" /><label for=\"cbxl2_1\">y</label></span></td>\r\n\t</tr><tr>\r\n\t\t<td><span class=\"aspNetDisabled\"><input id=\"cbxl2_2\" type=\"checkbox\" name=\"cbxl2$2\" checked=\"checked\" disabled=\"disabled\" value=\"z\" /><label for=\"cbxl2_2\">z</label></span></td>\r\n\t</tr>\r\n</table>";
            string html           = t.Run();
            string listHtml       = HtmlDiff.GetControlFromPageHtml(html);

            HtmlDiff.AssertAreEqual(origHtmlFirst, listHtml, "#A1");

            FormRequest fr = new FormRequest(t.Response, "form1");

            fr.Controls.Add("cbxl2$0");
            fr.Controls ["cbxl2$0"].Value = "on";

            fr.Controls.Add("cbxl2$2");
            fr.Controls ["cbxl2$2"].Value = "on";

            fr.Controls.Add("ctl01");
            fr.Controls ["ctl01"].Value = "Click to toggle enable status above";

            t.Request = fr;
            html      = t.Run();

            listHtml = HtmlDiff.GetControlFromPageHtml(html);

            HtmlDiff.AssertAreEqual(origHtmlSecond, listHtml, "#A2");

            fr = new FormRequest(t.Response, "form1");
            fr.Controls.Add("ctl02");
            fr.Controls ["ctl02"].Value = "Click to refresh page";

            t.Request = fr;
            html      = t.Run();

            listHtml = HtmlDiff.GetControlFromPageHtml(html);
            HtmlDiff.AssertAreEqual(origHtmlThird, listHtml, "#A3");
        }
Пример #17
0
        public void ImageMap_PostBack_RenderAfter()
        {
            WebTest t = new WebTest(PageInvoker.CreateOnLoad(myPageLoad));

            t.Run();
            FormRequest fr = new FormRequest(t.Response, "form1");

            fr.Controls.Add("__EVENTTARGET");
            fr.Controls.Add("__EVENTARGUMENT");
            fr.Controls["__EVENTTARGET"].Value   = "imgmap";
            fr.Controls["__EVENTARGUMENT"].Value = "0";
            t.Request = fr;
            #region orig
            string strTarget = @"<img id=""imgmap"" src="""" usemap=""#ImageMapimgmap"" style=""border-width:0px;"" /><map name=""ImageMapimgmap"">
	                                <area shape=""rect"" coords=""0,0,0,0"" href=""javascript:__doPostBack('imgmap','0')"" title="""" alt="""" /><area shape=""poly"" coords="""" href=""javascript:__doPostBack('imgmap','1')"" title="""" alt="""" /><area shape=""circle"" coords=""0,0,0"" href=""javascript:__doPostBack('imgmap','2')"" title="""" alt="""" />
                                 </map>";
            #endregion
            string RenderedPageHtml    = t.Run();
            string RenderedControlHtml = HtmlDiff.GetControlFromPageHtml(RenderedPageHtml);
            HtmlDiff.AssertAreEqual(strTarget, RenderedControlHtml, "AfterPostBack");
        }
Пример #18
0
        public void CheckBoxField_Bug595568_0()
        {
            string  originalHtml = @"<div> 
	<table id=""gridView"" cellspacing=""0"" rules=""all"" border=""1"" style=""border-collapse:collapse;""> 
			<tr> 
				<th scope=""col"">&nbsp;</th> 
			</tr><tr> 
				<td><span title=""Dummy""><input id=""gridView_ctl02_ctl00"" type=""checkbox"" name=""gridView$ctl02$ctl00"" checked=""checked"" /></span></td> 
			</tr><tr> 
				<td><span title=""Dummy""><input id=""gridView_ctl03_ctl00"" type=""checkbox"" name=""gridView$ctl03$ctl00"" /></span></td> 
			</tr><tr> 
				<td><span title=""Dummy""><input id=""gridView_ctl04_ctl00"" type=""checkbox"" name=""gridView$ctl04$ctl00"" /></span></td> 
			</tr> 
		</table>
	</div>"    ;
            WebTest t            = new WebTest("CheckBoxField_Bug595568_0.aspx");
            string  pageHtml     = t.Run();
            string  renderedHtml = HtmlDiff.GetControlFromPageHtml(pageHtml);

            HtmlDiff.AssertAreEqual(originalHtml, renderedHtml, "#A1");
        }
Пример #19
0
        public void Multiple()
        {
            PokerL p = new PokerL();

            Assert.AreEqual(true, p.Items[0].Selected, "MultipleSelect#1");
            Assert.AreEqual(true, p.Items[2].Selected, "MultipleSelect#2");
            string html = p.Render();

            #region origin
            string orig = @"<select size=""4"" multiple=""multiple"">
					<option selected=""selected"" value=""A"">A</option>
					<option value=""C"">C</option>
					<option selected=""selected"" value=""E"">E</option>
					<option value=""F"">F</option>
					<option value=""G"">G</option>
					<option value=""D"">D</option>
					<option value=""B"">B</option>
					</select>"                    ;
            #endregion
            HtmlDiff.AssertAreEqual(orig, html, "MultipleSelect#3");
        }
Пример #20
0
        public void BoundField_Bug646505()
        {
#if NET_4_0
            string originalHtml = "<div>\n\t<table cellspacing=\"0\" rules=\"all\" border=\"1\" id=\"gridView\" style=\"border-collapse:collapse;\">\n\t\t<tr>\n\t\t\t<th scope=\"col\">&nbsp;</th><th scope=\"col\">&nbsp;</th>\n\t\t</tr><tr>\n\t\t\t<td><a href=\"javascript:__doPostBack(&#39;gridView$ctl02$ctl00&#39;,&#39;&#39;)\">Update</a>&nbsp;<a href=\"javascript:__doPostBack(&#39;gridView&#39;,&#39;Cancel$0&#39;)\">Cancel</a></td><td><input name=\"gridView$ctl02$ctl02\" type=\"text\" value=\"False\" /></td>\n\t\t</tr><tr>\n\t\t\t<td><a href=\"javascript:__doPostBack(&#39;gridView&#39;,&#39;Edit$1&#39;)\">Edit</a></td><td>False</td>\n\t\t</tr>\n\t</table>\n</div>\n";
#else
            string originalHtml = "<div>\n\t<table cellspacing=\"0\" rules=\"all\" border=\"1\" id=\"gridView\" style=\"border-collapse:collapse;\">\n\t\t<tr>\n\t\t\t<th scope=\"col\">&nbsp;</th><th scope=\"col\">&nbsp;</th>\n\t\t</tr><tr>\n\t\t\t<td><a href=\"javascript:__doPostBack('gridView$ctl02$ctl00','')\">Update</a>&nbsp;<a href=\"javascript:__doPostBack('gridView','Cancel$0')\">Cancel</a></td><td><input name=\"gridView$ctl02$ctl02\" type=\"text\" value=\"False\" /></td>\n\t\t</tr><tr>\n\t\t\t<td><a href=\"javascript:__doPostBack('gridView','Edit$1')\">Edit</a></td><td>False</td>\n\t\t</tr>\n\t</table>\n</div>\n";
#endif
            WebTest t = new WebTest("BoundField_Bug646505.aspx");
            t.Run();

            FormRequest fr = new FormRequest(t.Response, "form1");
            fr.Controls.Add("__EVENTTARGET");
            fr.Controls.Add("__EVENTARGUMENT");
            fr.Controls ["__EVENTTARGET"].Value   = "gridView";
            fr.Controls ["__EVENTARGUMENT"].Value = "Edit$0";
            t.Request = fr;
            string pageHtml     = t.Run();
            string renderedHtml = HtmlDiff.GetControlFromPageHtml(pageHtml);

            HtmlDiff.AssertAreEqual(originalHtml, renderedHtml, "#A1");
        }
Пример #21
0
        public void ImageMap_AssignedValues_RenderDisabled()
        {
            // Enabled = false
            //----------------
            PokerImageMap imageMap = new PokerImageMap();

            imageMap.Enabled     = false;
            imageMap.HotSpotMode = HotSpotMode.Navigate;
            imageMap.Target      = "Target";
            CircleHotSpot circle = new CircleHotSpot();

            circle.NavigateUrl = "NavigateURL";
            imageMap.HotSpots.Add(circle);
#if NET_4_0
            string originalHtml = "<img class=\"aspNetDisabled\" src=\"\" usemap=\"#ImageMap\" /><map name=\"ImageMap\" id=\"ImageMap\">\r\n\t<area shape=\"circle\" coords=\"0,0,0\" target=\"Target\" title=\"\" alt=\"\" />\r\n</map>";
#else
            string originalHtml = "<img disabled=\"disabled\" src=\"\" usemap=\"#ImageMap\" style=\"border-width:0px;\" /><map name=\"ImageMap\" id=\"ImageMap\">\r\n\t<area shape=\"circle\" coords=\"0,0,0\" href=\"NavigateURL\" target=\"Target\" title=\"\" alt=\"\" />\r\n</map>";
#endif
            string renderedHtml = imageMap.Render();
            HtmlDiff.AssertAreEqual(originalHtml, renderedHtml, "RenderDisabledTextAssigne");
        }
Пример #22
0
        public void RenderAttributes_Password()
        {
            TestHtmlInputText it = new TestHtmlInputText("password");

            it.MaxLength = 2;
            it.Size      = 4;
            it.ID        = "mono";
            it.Value     = "s3kr3t";
#if NET_2_0
            // value is there, maybe because a new HtmlInputPassword class exists ?
            HtmlDiff.AssertAreEqual(" name=\"mono\" id=\"mono\" type=\"password\" maxlength=\"2\" size=\"4\" value=\"s3kr3t\" /", it.RenderAttributes(), "Render failed");
            Assert.IsFalse(it.ViewStateValueChanged, "ViewStateValueChanged");
            Assert.IsFalse(it.AttributeValueChanged, "AttributeValueChanged");
#else
            HtmlDiff.AssertAreEqual(" name=\"mono\" id=\"mono\" type=\"password\" maxlength=\"2\" size=\"4\" /", it.RenderAttributes(), "Render failed");
            Assert.IsTrue(it.ViewStateValueChanged, "ViewStateValueChanged");
            Assert.IsTrue(it.AttributeValueChanged, "AttributeValueChanged");
#endif
            Assert.IsNull(it.ViewStateNewValue, "ViewStateNewValue");
            Assert.IsNull(it.AttributeNewValue, "AttributeNewValue");
        }
Пример #23
0
        public void CheckBoxList_Bug377703_1()
        {
            WebTest t = new WebTest("CheckBoxList_Bug377703_1.aspx");

            t.Invoker = PageInvoker.CreateOnInit(CheckBoxList_Bug377703_1_OnInit);
#if NET_4_0
            string origHtmlFirst  = "<table id=\"cbxl1\">\r\n\t<tr>\r\n\t\t<td><input id=\"cbxl1_0\" type=\"checkbox\" name=\"cbxl1$0\" value=\"x\" /><label for=\"cbxl1_0\">x</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"cbxl1_1\" type=\"checkbox\" name=\"cbxl1$1\" value=\"y\" /><label for=\"cbxl1_1\">y</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"cbxl1_2\" type=\"checkbox\" name=\"cbxl1$2\" value=\"z\" /><label for=\"cbxl1_2\">z</label></td>\r\n\t</tr>\r\n</table>";
            string origHtmlSecond = "<table id=\"cbxl1\">\r\n\t<tr>\r\n\t\t<td><input id=\"cbxl1_0\" type=\"checkbox\" name=\"cbxl1$0\" checked=\"checked\" value=\"x\" /><label for=\"cbxl1_0\">x</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"cbxl1_1\" type=\"checkbox\" name=\"cbxl1$1\" value=\"y\" /><label for=\"cbxl1_1\">y</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"cbxl1_2\" type=\"checkbox\" name=\"cbxl1$2\" value=\"z\" /><label for=\"cbxl1_2\">z</label></td>\r\n\t</tr>\r\n</table>";
#else
            string origHtmlFirst  = "<table id=\"cbxl1\" border=\"0\">\r\n\t<tr>\r\n\t\t<td><input id=\"cbxl1_0\" type=\"checkbox\" name=\"cbxl1$0\" /><label for=\"cbxl1_0\">x</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"cbxl1_1\" type=\"checkbox\" name=\"cbxl1$1\" /><label for=\"cbxl1_1\">y</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"cbxl1_2\" type=\"checkbox\" name=\"cbxl1$2\" /><label for=\"cbxl1_2\">z</label></td>\r\n\t</tr>\r\n</table>";
            string origHtmlSecond = "<table id=\"cbxl1\" border=\"0\">\r\n\t<tr>\r\n\t\t<td><input id=\"cbxl1_0\" type=\"checkbox\" name=\"cbxl1$0\" checked=\"checked\" /><label for=\"cbxl1_0\">x</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"cbxl1_1\" type=\"checkbox\" name=\"cbxl1$1\" /><label for=\"cbxl1_1\">y</label></td>\r\n\t</tr><tr>\r\n\t\t<td><input id=\"cbxl1_2\" type=\"checkbox\" name=\"cbxl1$2\" /><label for=\"cbxl1_2\">z</label></td>\r\n\t</tr>\r\n</table>";
#endif
            string html     = t.Run();
            string listHtml = HtmlDiff.GetControlFromPageHtml(html);

            HtmlDiff.AssertAreEqual(origHtmlFirst, listHtml, "#A1");

            FormRequest fr = new FormRequest(t.Response, "form1");
            fr.Controls.Add("cbxl1$0");
            fr.Controls ["cbxl1$0"].Value = "on";

            fr.Controls.Add("ctl01");
            fr.Controls ["ctl01"].Value = "Click me twice to have the first Item become empty";

            t.Request = fr;
            html      = t.Run();

            fr = new FormRequest(t.Response, "form1");
            fr.Controls.Add("cbxl1$0");
            fr.Controls ["cbxl1$0"].Value = "on";

            fr.Controls.Add("ctl01");
            fr.Controls ["ctl01"].Value = "Click me twice to have the first Item become empty";

            t.Request = fr;
            html      = t.Run();

            listHtml = HtmlDiff.GetControlFromPageHtml(html);
            HtmlDiff.AssertAreEqual(origHtmlSecond, listHtml, "#A2");
        }
Пример #24
0
        public void ImageMap_AssignedValues_RenderNavigateCircle()
        {
            // Circle.HotSpotMode = Navigate
            //------------------------------
            PokerImageMap imageMap = new PokerImageMap();

            imageMap.Enabled = true;
            CircleHotSpot circle = new CircleHotSpot();

            circle.AccessKey     = "A";
            circle.AlternateText = "Circle";
            circle.HotSpotMode   = HotSpotMode.Navigate;
            circle.NavigateUrl   = "NavigateURL";
            circle.TabIndex      = 1;
            circle.Radius        = 10;
            circle.X             = 30;
            circle.Y             = 40;
            imageMap.HotSpots.Add(circle);
            string originalHtml = "<img src=\"\" usemap=\"#ImageMap\" style=\"border-width:0px;\" /><map name=\"ImageMap\">\r\n\t<area shape=\"circle\" coords=\"30,40,10\" href=\"NavigateURL\" title=\"Circle\" alt=\"Circle\" accesskey=\"A\" tabindex=\"1\" />\r\n</map>";

            HtmlDiff.AssertAreEqual(imageMap.Render(), originalHtml, "RenderNavigateCircleTextAssigned");
        }
Пример #25
0
        public void BoundField_NullValueRender()
        {
            string html     = new WebTest(PageInvoker.CreateOnLoad(new PageDelegate(BasicRenderTestInit))).Run();
            string orightml = @"<div>
				<table cellspacing=""0"" rules=""all"" border=""1"" id=""GridView1"" style=""border-collapse:collapse;"">
					<tr>
						<th scope=""col"">&nbsp;</th><th scope=""col"">&nbsp;</th>
					</tr><tr>
						<td>Norway</td><td>Norway</td>
					</tr><tr>
						<td>Sweden</td><td>Sweden</td>
					</tr><tr>
						<td>EMPTY</td><td>&nbsp;</td>
					</tr><tr>
						<td>Italy</td><td>Italy</td>
					</tr>
				</table>
				</div>"                ;

            html = HtmlDiff.GetControlFromPageHtml(html);
            HtmlDiff.AssertAreEqual(orightml, html, "NullValueRender");
        }
Пример #26
0
        private void ShowVsDraft()
        {
            HtmlContent html = repository.Fetch(moduleId);

            if (html == null)
            {
                return;
            }

            ContentWorkflow draftContent = ContentWorkflow.GetWorkInProgress(html.ModuleGuid);

            if (draftContent.Guid != workflowGuid)
            {
                return;
            }

            if ((HtmlConfiguration.UseHtmlDiff) && (highlightDiff))
            {
                HtmlDiff diffHelper = new HtmlDiff(html.Body, draftContent.ContentText);
                litCurrentVersion.Text = diffHelper.Build();
            }
            else
            {
                litCurrentVersion.Text = draftContent.ContentText;
            }

            litCurrentHeading.Text = string.Format(Resource.CurrentDraftHeadingFormat,
                                                   DateTimeHelper.Format(draftContent.RecentActionOn, timeZone, "g", timeOffset));

            litHistoryHead.Text = string.Format(Resource.CurrentVersionHeadingFormat,
                                                DateTimeHelper.Format(html.LastModUtc, timeZone, "g", timeOffset));

            litHistoryVersion.Text = html.Body;

            //string onClick = "top.window.LoadHistoryInEditor('" + historyGuid.ToString() + "');  return false;";
            //btnRestore.Attributes.Add("onclick", onClick);
            btnRestore.Visible = false;
        }
Пример #27
0
        /// <summary>
        /// Gets a particular version of a page.
        /// </summary>
        /// <param name="id">The Guid ID for the version.</param>
        /// <returns>A <see cref="PageViewModel"/> as the model, which contains the HTML diff
        /// output inside the <see cref="PageViewModel.Content"/> property.</returns>
        public ActionResult Version(Guid id)
        {
            MarkupConverter       converter    = _pageService.GetMarkupConverter();
            IList <PageViewModel> bothVersions = _historyService.CompareVersions(id).ToList();
            string diffHtml = "";

            if (bothVersions[1] != null)
            {
                string   oldVersion = converter.ToHtml(bothVersions[1].Content).Html;
                string   newVersion = converter.ToHtml(bothVersions[0].Content).Html;
                HtmlDiff diff       = new HtmlDiff(oldVersion, newVersion);
                diffHtml = diff.Build();
            }
            else
            {
                diffHtml = converter.ToHtml(bothVersions[0].Content).Html;
            }

            PageViewModel model = bothVersions[0];

            model.Content = diffHtml;
            return(View(model));
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string oldText = @"<p><i>This is</i> some sample text to <strong>demonstrate</strong> the capability of the <strong>HTML diff tool</strong>.</p>
                                <p>It is based on the <b>Ruby</b> implementation found <a href='http://github.com/myobie/htmldiff'>here</a>. Note how the link has no tooltip</p>
                                <table cellpadding='0' cellspacing='0'>
                                <tr><td>Some sample text</td><td>Some sample value</td></tr>
                                <tr><td>Data 1 (this row will be removed)</td><td>Data 2</td></tr>
                                </table>
                                Here is a number 2 32";

            string newText = @"<p>This is some sample <strong>text to</strong> demonstrate the awesome capabilities of the <strong>HTML <u>diff</u> tool</strong>.</p><br/><br/>Extra spacing here that was not here before.
                                <p>It is <i>based</i> on the Ruby implementation found <a title='Cool tooltip' href='http://github.com/myobie/htmldiff'>here</a>. Note how the link has a tooltip now and the HTML diff algorithm has preserved formatting.</p>
                                <table cellpadding='0' cellspacing='0'>
                                <tr><td>Some sample <strong>bold text</strong></td><td>Some sample value</td></tr>
                                </table>
                                Here is a number 2 <sup>32</sup>";

            HtmlDiff diffHelper = new HtmlDiff(oldText, newText);

            litOldText.Text  = oldText;
            litNewText.Text  = newText;
            litDiffText.Text = diffHelper.Build();
        }
Пример #29
0
 public static void RenderPostBackEvent_OnSaveStateComplete(Page p)
 {
     TestPageWithAdapter pageWithAdapter = (TestPageWithAdapter)p;
     TestAdapter         testAdapter     = (TestAdapter)pageWithAdapter.PageAdapter;
     {
         StringWriter   sw  = new StringWriter();
         HtmlTextWriter htw = new HtmlTextWriter(sw);
         testAdapter.RenderPostBackEvent(htw, "target", "argument", "softKeyLabel", "text", "postUrl", "X", true);
         string origHtml     = "<a href=\"postUrl?__VIEWSTATE=DAAAAA%3d%3d&amp;__EVENTTARGET=target&amp;__EVENTARGUMENT=argument&amp;__PREVIOUSPAGE=/NunitWeb/PageWithAdapter.aspx\" accesskey=\"X\">text</a>";
         string renderedHtml = sw.ToString();
         HtmlDiff.AssertAreEqual(origHtml, renderedHtml, "RenderPostBackEvent #1");
     }
     {
         StringWriter   sw  = new StringWriter();
         HtmlTextWriter htw = new HtmlTextWriter(sw);
         testAdapter.RenderPostBackEvent(htw, "target", "argument", "softKeyLabel", "text", "postUrl", "X", false);
         string origHtml     = "<a href=\"postUrl?__VIEWSTATE=DAAAAA%3d%3d&__EVENTTARGET=target&__EVENTARGUMENT=argument&__PREVIOUSPAGE=/NunitWeb/PageWithAdapter.aspx\" accesskey=\"X\">text</a>";
         string renderedHtml = sw.ToString();
         HtmlDiff.AssertAreEqual(origHtml, renderedHtml, "RenderPostBackEvent #2");
     }
     {
         StringWriter   sw       = new StringWriter();
         HtmlTextWriter htw      = new HtmlTextWriter(sw);
         string         origHtml = "<a href=\"postUrl?__VIEWSTATE=DAAAAA%3d%3d&amp;__EVENTTARGET=target&amp;__EVENTARGUMENT=argument&amp;__PREVIOUSPAGE=/NunitWeb/PageWithAdapter.aspx\" accesskey=\"X\">text</a>";
         testAdapter.RenderPostBackEvent(htw, "target", "argument", "softKeyLabel", "text", "postUrl", "X");
         string renderedHtml = sw.ToString();
         HtmlDiff.AssertAreEqual(origHtml, renderedHtml, "RenderPostBackEvent #3");
     }
     {
         StringWriter   sw       = new StringWriter();
         HtmlTextWriter htw      = new HtmlTextWriter(sw);
         string         origHtml = "<a href=\"/NunitWeb/PageWithAdapter.aspx?__VIEWSTATE=DAAAAA%3d%3d&amp;__EVENTTARGET=target&amp;__EVENTARGUMENT=argument&amp;__PREVIOUSPAGE=/NunitWeb/PageWithAdapter.aspx\">text</a>";
         testAdapter.RenderPostBackEvent(htw, "target", "argument", "softKeyLabel", "text");
         string renderedHtml = sw.ToString();
         HtmlDiff.AssertAreEqual(origHtml, renderedHtml, "RenderPostBackEvent #4");
     }
 }
Пример #30
0
        public void ImageMap_AssignedValues_RenderNavigateShapes()
        {
            // Rectangle/Polygon.HotSpotMode = Navigate
            //-----------------------------------------
            PokerImageMap imageMap = new PokerImageMap();

            imageMap.Enabled     = true;
            imageMap.HotSpotMode = HotSpotMode.NotSet;
            RectangleHotSpot rect = new RectangleHotSpot();

            rect.AccessKey     = "R";
            rect.AlternateText = "Rectangle";
            rect.HotSpotMode   = HotSpotMode.Navigate;
            rect.NavigateUrl   = "NavigateUrlRect";
            rect.TabIndex      = 1;
            rect.Bottom        = 10;
            rect.Top           = 20;
            rect.Left          = 30;
            rect.Right         = 40;
            imageMap.HotSpots.Add(rect);
            imageMap.HotSpotMode = HotSpotMode.Navigate;
            PolygonHotSpot poly = new PolygonHotSpot();

            poly.AccessKey     = "P";
            poly.AlternateText = "Polygon";
            poly.NavigateUrl   = "NavigateUrlPoly";
            poly.TabIndex      = 2;
            poly.Coordinates   = "10,20,30,40,50,60,100,200";
            imageMap.HotSpots.Add(poly);
#if NET_4_0
            string originalHtml = "<img src=\"\" usemap=\"#ImageMap\" /><map name=\"ImageMap\" id=\"ImageMap\">\r\n\t<area shape=\"rect\" coords=\"30,20,40,10\" href=\"NavigateUrlRect\" title=\"Rectangle\" alt=\"Rectangle\" accesskey=\"R\" tabindex=\"1\" /><area shape=\"poly\" coords=\"10,20,30,40,50,60,100,200\" href=\"NavigateUrlPoly\" title=\"Polygon\" alt=\"Polygon\" accesskey=\"P\" tabindex=\"2\" />\r\n</map>";
#else
            string originalHtml = "<img src=\"\" usemap=\"#ImageMap\" style=\"border-width:0px;\" /><map name=\"ImageMap\" id=\"ImageMap\">\r\n\t<area shape=\"rect\" coords=\"30,20,40,10\" href=\"NavigateUrlRect\" title=\"Rectangle\" alt=\"Rectangle\" accesskey=\"R\" tabindex=\"1\" /><area shape=\"poly\" coords=\"10,20,30,40,50,60,100,200\" href=\"NavigateUrlPoly\" title=\"Polygon\" alt=\"Polygon\" accesskey=\"P\" tabindex=\"2\" />\r\n</map>";
#endif
            string renderedHtml = imageMap.Render();
            HtmlDiff.AssertAreEqual(originalHtml, renderedHtml, "RenderNavigateShapesTextAssigned");
        }