public void ConstructHtml_WHEN_Token_Does_Not_Have_StyleClass_Property_Name_THEN_Returns_Empty_String()
        {
            dynamic t = new Token(TokenType.Delimiter, "#b", 1, 1);
            t.IsStartingDelimeter = true;

            var styleClassParseRule = new StyleClassParseRule();
            string htmlFragment = styleClassParseRule.ConstructHtml(t);

            htmlFragment.ShouldEqual(String.Empty);
        }
        public void ConstructHtml_WHEN_Token_Has_StyleClass_Property_Name_THEN_Return_HTML_For_class()
        {
            const string CssClass = "ABC";

            dynamic t = new Token(TokenType.Delimiter, "#b", 1, 1);
            t.StyleClass = CssClass;
            t.IsStartingDelimeter = true;

            var styleClassParseRule = new StyleClassParseRule();
            string htmlFragment = styleClassParseRule.ConstructHtml(t);

            htmlFragment.ShouldEqual(String.Format("class='{0}'", CssClass));
        }
Пример #3
0
        public void Transform_GIVEN_globalParseRule_For_StyleClass_Which_Outputs_id_And_localParseRule_For_StyleClass_Which_Outputs_class_WHEN_Token_Is_For_Bold_THEN_Returns_Result_Of_LocalPropertyParseRule_Which_Is_Bold_With_Class_Attribute()
        {
            const string CssClass = "ABC";

            dynamic t = new Token(TokenType.Delimiter, "#b", 1, 1);
            t.StyleClass = CssClass;
            t.IsStartingDelimeter = true;

            var styleClassRule = new StyleClassParseRule();

            var parseRule = new DelimeterParseRule("Bold", DefaultDelimeterValues.Bold, "b");
            parseRule.AddPropertyParseRule(styleClassRule);

            string html = parseRule.TransformToHtml(t, new PropertyParseRule[] { new PropertyParseRule(styleClassRule.PropertyName, "id") });

            html.ShouldEqual(String.Format("<b class='{0}'>", CssClass));
        }