Ejemplo n.º 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));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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));
        }