示例#1
0
        public void Constructor_ValidAttributeStrings_AttributeCollectionContainsCorrectAttributes(
            string attributeString, string expectedFirstAttribute)
        {
            var tag = new HamlNodeHtmlAttributeCollection(0, attributeString);

            Assert.That(tag.Children.First().Content, Is.EqualTo(expectedFirstAttribute));
        }
示例#2
0
        public void Constructor_ValidAttributeStrings_AttributeCollectionContainsCorrectAttributeCount(
            string attributeString, int expectedAttributeCount)
        {
            var tag = new HamlNodeHtmlAttributeCollection(0, attributeString);

            Assert.That(tag.Children.Count(), Is.EqualTo(expectedAttributeCount));
        }
示例#3
0
        public void Constructor_CommaSeparatedAttributes_ParsesCorrectly(
            string attributeString, string expectedName, string expectedValue)
        {
            var tag = new HamlNodeHtmlAttributeCollection(0, attributeString);

            var firstChild = (HamlNodeHtmlAttribute)tag.Children.First();

            Assert.That(firstChild.Name, Is.EqualTo(expectedName));
            Assert.That(firstChild.Children.First().Content, Is.EqualTo(expectedValue));
        }
示例#4
0
        public void Walk_VaryingAttributeCollections_WritesCorrectAttributes(string hamlLine, string expectedTag)
        {
            var node = new HamlNodeHtmlAttributeCollection(0, hamlLine);

            var builder = new ClassBuilderMock();

            new HamlNodeHtmlAttributeCollectionWalker(builder, new HamlHtmlOptions())
            .Walk(node);

            Assert.That(builder.Build(""), Is.EqualTo(expectedTag));
        }