public void Format_NoEncoding_WithHotkey() { var formatter = new NoneHotkeyFormatter(); var textWithHotkey = new TextWithHotkey("foo bar", 4); Assert.That(formatter.FormatText(textWithHotkey, false), Is.EqualTo("foo bar")); }
private void AssertItem(XmlNode item, IMenuTab webTab, bool isLastItem, bool isDesignMode) { if (isDesignMode) { item.AssertStyleAttribute("float", "left"); item.AssertStyleAttribute("display", "block"); item.AssertStyleAttribute("white-space", "nowrap"); } item.AssertChildElementCount(isLastItem ? 2 : 1); var wrapper = item.GetAssertedChildElement("span", 0); wrapper.AssertAttributeValueEquals("class", _renderer.CssClassTabWrapper); var separator = wrapper.GetAssertedChildElement("span", 0); separator.AssertAttributeValueEquals("class", _renderer.CssClassSeparator); separator.AssertChildElementCount(1); var empty = separator.GetAssertedChildElement("span", 0); empty.AssertChildElementCount(0); var tab = wrapper.GetAssertedChildElement("span", 1); tab.AssertAttributeValueEquals("id", _webTabStrip.ClientID + "_" + webTab.ItemID); tab.AssertAttributeValueContains("class", webTab.IsSelected ? _renderer.CssClassTabSelected : _renderer.CssClassTab); if (!webTab.EvaluateEnabled()) { tab.AssertAttributeValueContains("class", _renderer.CssClassDisabled); } var link = tab.GetAssertedChildElement("a", 0); link.AssertAttributeValueEquals("id", _webTabStrip.ClientID + "_" + webTab.ItemID + "_Command"); bool isDisabledBySelection = webTab.IsSelected && !_webTabStrip.EnableSelectedTab; if (webTab.EvaluateEnabled()) { link.AssertAttributeValueEquals("href", "#"); } if (webTab.EvaluateEnabled() && !isDisabledBySelection) { string clickScript = _pageStub.ClientScript.GetPostBackClientHyperlink(_webTabStrip, webTab.ItemID); link.AssertAttributeValueEquals("onclick", clickScript); } var textWithHotkey = HotkeyParser.Parse(webTab.Text); if (webTab.EvaluateEnabled() && textWithHotkey.Hotkey.HasValue) { var accessKey = new NoneHotkeyFormatter().FormatHotkey(textWithHotkey); link.AssertAttributeValueEquals("accesskey", accessKey); } AssertAnchor(link, webTab); }