Ejemplo n.º 1
0
        public void RemoveCssClassRemovesCssAttributeAsExpected()
        {
            // --- Arrange
            const string TAG   = "mytag";
            const string ATTR1 = "attr1";
            const string ATTR2 = "attr2";
            var          elem  = new MyHtmlElement(TAG);

            elem.CssClass(ATTR1);
            elem.CssClass(ATTR2);

            // --- Act
            elem.RemoveCssClass(ATTR1);
            elem.RemoveCssClass(ATTR2);

            // --- Assert
            elem.CssClasses.ShouldHaveCountOf(0);
            elem.HtmlAttributes.ShouldHaveCountOf(0);
        }
Ejemplo n.º 2
0
        public void RemoveCssClassWorksAsExpected()
        {
            // --- Arrange
            const string TAG   = "mytag";
            const string CLASS = "class";
            const string ATTR1 = "attr1";
            const string ATTR2 = "attr2";
            var          elem  = new MyHtmlElement(TAG);

            elem.CssClass(ATTR1);
            elem.CssClass(ATTR2);

            // --- Act
            elem.RemoveCssClass(ATTR1);

            // --- Assert
            elem.HtmlAttributes.ShouldHaveCountOf(1);
            elem.HtmlAttributes.Keys.ShouldContain(CLASS);
            elem.HtmlAttributes[CLASS].ShouldEqual(ATTR2);
            elem.CssClasses.ShouldHaveCountOf(1);
            elem.CssClasses.ShouldContain(ATTR2);
        }