public void BitAnchorButtonTest(Visual visual, bool isEnabled, BitButtonStyle style, string href, string title, string target) { var com = RenderComponent <BitButtonTest>(parameters => { parameters.Add(p => p.Visual, visual); parameters.Add(p => p.IsEnabled, isEnabled); parameters.Add(p => p.ButtonStyle, style); parameters.Add(p => p.Href, href); parameters.Add(p => p.Title, title); parameters.Add(p => p.Target, target); }); var bitButton = com.Find(".bit-btn"); var isEnabledClass = isEnabled ? "enabled" : "disabled"; var visualClass = visual == Visual.Cupertino ? "cupertino" : visual == Visual.Material ? "material" : "fluent"; if (isEnabled) { Assert.IsTrue(bitButton.ClassList.Contains($"bit-btn-{visualClass}")); Assert.AreEqual(bitButton.GetAttribute("target"), target); Assert.IsTrue(bitButton.HasAttribute("href")); } else { Assert.IsTrue(bitButton.ClassList.Contains($"bit-btn-{isEnabledClass}-{visualClass}")); } Assert.AreEqual(bitButton.GetAttribute("title"), title); }
public void BitCompoundButtonDisabledFocusTest(bool isEnabled, BitButtonStyle style, bool allowDisabledFocus, bool expectedResult) { var com = RenderComponent <BitCompoundButtonTest>(parameters => { parameters.Add(p => p.IsEnabled, isEnabled); parameters.Add(p => p.ButtonStyle, style); parameters.Add(p => p.AllowDisabledFocus, allowDisabledFocus); }); var bitButton = com.Find(".bit-cmp-btn"); var hasTabindexAttr = bitButton.HasAttribute("tabindex"); Assert.AreEqual(hasTabindexAttr, expectedResult); if (hasTabindexAttr) { Assert.IsTrue(bitButton.GetAttribute("tabindex").Equals("-1")); } }
public void BitCompoundButtonTest(Visual visual, bool isEnabled, BitButtonStyle style) { var com = RenderComponent <BitCompoundButtonTest>(parameters => { parameters.Add(p => p.Visual, visual); parameters.Add(p => p.IsEnabled, isEnabled); parameters.Add(p => p.ButtonStyle, style); }); var bitButton = com.Find(".bit-cmp-btn"); var isEnabledClass = isEnabled ? "enabled" : "disabled"; var visualClass = visual == Visual.Cupertino ? "cupertino" : visual == Visual.Material ? "material" : "fluent"; Assert.IsTrue(bitButton.ClassList.Contains($"bit-cmp-btn-{isEnabledClass}-{visualClass}")); bitButton.Click(); Assert.AreEqual(isEnabled ? 1 : 0, com.Instance.CurrentCount); }
public void BitCompoundButtonShouldHaveCorrectDisabledClassBasedOnButtonStyle(Visual visual, BitButtonStyle buttonStyle, bool isEnabled) { var component = RenderComponent <BitCompoundButtonTest>(parameters => { parameters.Add(p => p.Visual, visual); parameters.Add(p => p.ButtonStyle, buttonStyle); parameters.Add(p => p.IsEnabled, isEnabled); }); var bitCompoundButton = component.Find(".bit-cmp-btn"); var visualClass = visual == Visual.Cupertino ? "cupertino" : visual == Visual.Material ? "material" : "fluent"; var buttonStyleStr = buttonStyle == BitButtonStyle.Primary ? "primary" : "standard"; Assert.IsTrue(bitCompoundButton.ClassList.Contains($"bit-cmp-btn-{buttonStyleStr}-disabled-{visualClass}")); }