public void ParseNamespace() { ProcessedType processedType = TypeProcessor.GetProcessedType(typeof(XMLTemplateParsing_Namespace)); TemplateCache cache = new TemplateCache(Setup("App")); TemplateRootNode templateRoot = cache.GetParsedTemplate(processedType); Assert.AreEqual(typeof(UIDivElement), templateRoot.children[0].processedType.rawType); }
public CompilationContext(TemplateRootNode templateRootNode) { this.outputComments = true; this.variables = new LightList <ParameterExpression>(); this.statementStacks = new LightStack <LightList <Expression> >(); this.hierarchyStack = new LightStack <ParameterExpression>(); this.templateRootNode = templateRootNode; }
public void DefineSlot() { TemplateCache cache = new TemplateCache(Setup("App")); TemplateRootNode templateRootRoot = cache.GetParsedTemplate(TypeProcessor.GetProcessedType(typeof(XMLTemplateParsing_DefineSlot))); Assert.AreEqual(1, templateRootRoot.ChildCount); ContainerNode child = AssertAndReturn <ContainerNode>("Div", templateRootRoot[0]); SlotNode node = AssertAndReturn <SlotNode>(child[0]); Assert.AreEqual("my-slot", node.slotName); }
public void CollapseTextNode_Simple() { TemplateCache cache = new TemplateCache(Setup("App")); TemplateRootNode templateRootRoot = cache.GetParsedTemplate(TypeProcessor.GetProcessedType(typeof(XMLTemplateParsing_CollapseTextNode_Simple))); Assert.AreEqual(1, templateRootRoot.ChildCount); ContainerNode child = AssertAndReturn <ContainerNode>(templateRootRoot[0]); TextNode text = AssertAndReturn <TextNode>(child[0]); Assert.AreEqual("Hello Templates", text.textExpressionList[0].text); }
public CompiledBinding AddBinding(TemplateNode templateNode, CompiledBindingType bindingType) { CompiledBinding binding = new CompiledBinding(); TemplateRootNode root = templateNode as TemplateRootNode ?? templateNode.root; binding.filePath = root.templateShell.filePath; binding.bindingType = bindingType; binding.elementTag = templateNode.originalString; binding.bindingId = compiledBindings.size; binding.guid = Guid.NewGuid().ToString().Replace('-', '_'); binding.templateName = root.templateName; compiledBindings.Add(binding); return(binding); }
public void ExpandedTemplate() { ProcessedType processedType = TypeProcessor.GetProcessedType(typeof(XMLTemplateParsing_ExpandTemplate)); TemplateCache cache = new TemplateCache(Setup("App")); TemplateRootNode templateRootRoot = cache.GetParsedTemplate(processedType); Assert.AreEqual(3, templateRootRoot.ChildCount); AssertAndReturn <TextNode>(templateRootRoot[0]); ExpandedTemplateNode expandedTemplate = AssertAndReturn <ExpandedTemplateNode>(templateRootRoot[1]); Assert.AreEqual(typeof(XMLTemplateParsing_ExpandedTemplateChild), expandedTemplate.processedType.rawType); AssertAndReturn <TextNode>(templateRootRoot[2]); }
public void OverrideSlot() { ProcessedType processedType = TypeProcessor.GetProcessedType(typeof(XMLTemplateParsing_OverrideSlot)); TemplateCache cache = new TemplateCache(Setup("App")); TemplateRootNode templateRootRoot = cache.GetParsedTemplate(processedType); Assert.AreEqual(3, templateRootRoot.ChildCount); AssertTrimmedText("Hello Before", templateRootRoot[0]); AssertTrimmedText("Hello After", templateRootRoot[2]); ExpandedTemplateNode expandedTemplateNode = AssertAndReturn <ExpandedTemplateNode>(templateRootRoot[1]); SlotNode overrideNode = AssertAndReturn <SlotNode>(expandedTemplateNode.slotOverrideNodes[0]); Assert.AreEqual("my-slot", overrideNode.slotName); Assert.AreEqual(SlotType.Override, overrideNode.slotType); AssertTrimmedText("Hello Between", overrideNode[0]); }