public void Constructor_ValidAttributeStrings_AttributeCollectionContainsCorrectAttributeCount( string attributeString, int expectedAttributeCount) { var tag = new HamlNodeHtmlAttributeCollection(attributeString); Assert.That(tag.Children.Count(), Is.EqualTo(expectedAttributeCount)); }
public void Constructor_ValidAttributeStrings_AttributeCollectionContainsCorrectAttributes( string attributeString, string expectedFirstAttribute) { var tag = new HamlNodeHtmlAttributeCollection(attributeString); Assert.That(tag.Children[0].Content, Is.EqualTo(expectedFirstAttribute)); }
public void Walk_EmptyAttributeCollection_WritesCorrectAttributes(string hamlLine, string expectedTag) { var node = new HamlNodeHtmlAttributeCollection(hamlLine); var builder = new ClassBuilderMock(); new HamlNodeHtmlAttributeCollectionWalker(builder, new HamlOptions()) .Walk(node); Assert.That(builder.Build(""), Is.EqualTo(expectedTag)); }
private void ParseAttributes(string content, ref int pos) { if (pos < content.Length) { if (content[pos] == '(') { string attributes = HtmlStringHelper.ExtractTokenFromTagString(content, ref pos, new[] { ')' }); if (attributes[attributes.Length - 1] != ')') throw new HamlMalformedTagException("Malformed HTML Attributes collection \"" + attributes + "\"."); pos++; var attributesNode = new HamlNodeHtmlAttributeCollection(attributes); Add(attributesNode); } } }