public void IsSparkNodeShouldReturnElementNodeIfNotSparkSyntax() { var node = SparkSyntax.ParseNode("<div id='products'/>", position: 1); Node elementNode; var isSparkNode = SparkSyntax.IsSpecialNode(node, out elementNode); Assert.That(!isSparkNode); Assert.IsNotNull(elementNode); Assert.That(elementNode, Is.InstanceOf(typeof(ElementNode))); }
public void IsSparkNodeShouldReturnSpecialNodeForFullElementAtPositionInsideASpecialNode() { var node = SparkSyntax.ParseNode("<use content='main'/>", position: 1); Node sparkNode; var isSparkNode = SparkSyntax.IsSpecialNode(node, out sparkNode); Assert.That(isSparkNode); Assert.IsNotNull(sparkNode); Assert.That(sparkNode, Is.InstanceOf(typeof(SpecialNode))); }
public void IsSparkNodeShouldReturnSpecialNodeForUnclosedElement() { var node = SparkSyntax.ParseNode("<use >", position: 1); Node sparkNode; var isSparkNode = SparkSyntax.IsSpecialNode(node, out sparkNode); Assert.That(isSparkNode); Assert.IsNotNull(sparkNode); Assert.That(sparkNode, Is.InstanceOf(typeof(SpecialNode))); }
private IEnumerable <Completion> GetForElementTypeAndName() { var attributesForNode = new List <Completion>(); Node specialNode; if (SparkSyntax.IsSpecialNode(CurrentNode, out specialNode)) { attributesForNode.AddRange(GetForSpecialNode(specialNode)); } else { attributesForNode.AddRange(GetHtmlNodeExtensions()); attributesForNode.AddRange(GetPossiblePartialDefaults()); } RemoveAttributesAlreadyUsed(attributesForNode); return(attributesForNode.Distinct()); }