Exemple #1
0
		internal static void ForceRender(Tabs tabs)
		{
			using (tabs.RenderHeader()) {
				for (var tbNdx=0; tbNdx < tabs.Panes.ToDictionary().Count(); tbNdx++)
					using (tabs.Panes.RenderNextPane()) {}
			}
		}
Exemple #2
0
		public void Pretty_Dynamic_Tabs_Script_Renders_Correctly()
		{
			// Arrange
			var resp = new MockWriter();
			Tabs tabs = new Tabs(resp, "myTabs");

			// define the test tabs
			tabs
				.AsDynamic()
				.Panes
				.Add("http://someurl.com/tab1", "Tab 1")
				.Add("http://someurl.com/tab2", "Tab 2")
				.Add("http://someurl.com/tab3", "Tab 3")
			;

			// only testing raw output
			tabs
				.Rendering
					.SetAutoScript(false)
					.SetPrettyRender(true)
			;

			using (tabs.RenderHeader()) {
			}

			// Act - Force output we'd see on the web page
			string html = resp.Output.ToString();

			// Assert
			string expected = 
				"<div id=\"myTabs\">" + Environment.NewLine +
				"	<ul>" + Environment.NewLine + 
				"		<li>" + Environment.NewLine +
				"			<a href=\"http://someurl.com/tab1\"><span>Tab 1</span></a>" + Environment.NewLine +
				"		</li>" + Environment.NewLine +
				"		<li>" + Environment.NewLine +
				"			<a href=\"http://someurl.com/tab2\"><span>Tab 2</span></a>" + Environment.NewLine +
				"		</li>" + Environment.NewLine +
				"		<li>" + Environment.NewLine +
				"			<a href=\"http://someurl.com/tab3\"><span>Tab 3</span></a>" + Environment.NewLine +
				"		</li>" + Environment.NewLine +
				"	</ul>" + Environment.NewLine +
				"</div>" + Environment.NewLine;

			Assert.AreEqual(expected, html);
		}