private IEnumerable <Completion> GetForAttributeValue()
        {
            var attributeValues = new List <Completion>();

            var chunk = SparkSyntax.ParseContextChunk(CurrentContent, _triggerPoint);

            if (chunk == typeof(ContentChunk))
            {
                attributeValues.AddRange(GetContentNames());
            }
            else if (chunk == typeof(ConditionalChunk))
            {
                attributeValues.AddRange(GetVariables());
            }
            else if (chunk == typeof(ForEachChunk))
            {
                attributeValues.AddRange(GetVariables());
            }
            // TODO: Rob G first?{bool} last?{bool} ?{bool}
            // TODO: Rob G for "Index", "Count", "IsFirst", and "IsLast"
            else if (chunk == typeof(UseMasterChunk))
            {
                attributeValues.AddRange(GetPossibleMasterNames());
            }

            return(attributeValues);
        }
Example #2
0
        public void ShouldReturnElementNodeGivenPositionAfterColonInElementName()
        {
            var nodeType  = SparkSyntax.ParseContext("<div><use: </div>", position: 10);
            var chunkType = SparkSyntax.ParseContextChunk("<div><use: </div>", position: 10);

            Assert.That(nodeType, Is.EqualTo(typeof(ElementNode)));
            Assert.That(chunkType, Is.EqualTo(typeof(UseContentChunk)));
        }
        public void ShouldReturnUseChunkGivenPositionInsideSingleQuotes()
        {
            Type nodeType = SparkSyntax.ParseContextChunk("<div><use content='' </div>", position: 19);

            Assert.That(nodeType, Is.EqualTo(typeof(UseContentChunk)));
        }
        public void ShouldReturnUseChunkGivenPositionAfterUseElementColon()
        {
            Type nodeType = SparkSyntax.ParseContextChunk("<div><use:header /></div>", position: 10);

            Assert.That(nodeType, Is.EqualTo(typeof(UseContentChunk)));
        }
        public void ShouldReturnRenderChunkGivenPositionInsideSingleQuotes()
        {
            Type nodeType = SparkSyntax.ParseContextChunk("<div><render partial='' </div>", position: 22);

            Assert.That(nodeType, Is.EqualTo(typeof(RenderPartialChunk)));
        }
        public void ShouldReturnRenderChunkGivenPositionAfterRenderElementColon()
        {
            Type nodeType = SparkSyntax.ParseContextChunk("<div><render: </div>", position: 13);

            Assert.That(nodeType, Is.EqualTo(typeof(RenderSectionChunk)));
        }
        public void ShouldReturnMacroChunkGivenPositionInsideSingleQuotes()
        {
            Type nodeType = SparkSyntax.ParseContextChunk("<div><macro name='' </div>", position: 18);

            Assert.That(nodeType, Is.EqualTo(typeof(MacroChunk)));
        }
        public void ShouldReturnMacroChunkGivenPositionAfterMacroElementColon()
        {
            Type nodeType = SparkSyntax.ParseContextChunk("<div><macro:SomeMacro </div>", position: 12);

            Assert.That(nodeType, Is.EqualTo(typeof(MacroChunk)));
        }
        public void ShouldReturnContentChunkGivenPositionInsideDoubleQuotes()
        {
            Type nodeType = SparkSyntax.ParseContextChunk("<div><content name=\"\" </div>", position: 20);

            Assert.That(nodeType, Is.EqualTo(typeof(ContentChunk)));
        }
        public void ShouldReturnContentChunkGivenPositionAfterContentElementColon()
        {
            Type nodeType = SparkSyntax.ParseContextChunk("<div><content:</div>", position: 14);

            Assert.That(nodeType, Is.EqualTo(typeof(ContentChunk)));
        }