예제 #1
0
        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)));
        }
예제 #2
0
        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)));
        }
예제 #3
0
        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());
        }