getTextNode() public method

public getTextNode ( ) : Node
return Node
        public void test()
        {
            loadInParser("large_body_text_without_pipes.jade");
            tagNode = (TagNode) root.pollNode();
            Assert.AreEqual(tagNode.getName(), ("p"));

            textNode = (TextNode) tagNode.getTextNode();
            Assert.IsNotNull(textNode.getValue());
            Assert.AreEqual(textNode.getValue(), ("Hello World!\nHere comes the Message!"));
            Assert.AreEqual(textNode.hasNodes(), (false));

            tagNode = (TagNode) root.pollNode();
            Assert.AreEqual(tagNode.getName(), ("div"));
            block = tagNode.getBlock();
            Assert.IsNotNull(block);

            tagNode = (TagNode) block.pollNode();
            Assert.AreEqual(tagNode.getName(), ("h1"));

            textNode = (TextNode) tagNode.getTextNode();
            Assert.IsNotNull(textNode.getValue());
            Assert.AreEqual(textNode.getValue(), ("Hello World!\nHere comes the second Message!"));
            Assert.AreEqual(textNode.hasNodes(), (false));

            tagNode = (TagNode) block.pollNode();
            Assert.AreEqual(tagNode.getName(), ("h2"));

            textNode = (TextNode) tagNode.getTextNode();
            Assert.IsNotNull(textNode.getValue());
            Assert.AreEqual(textNode.getValue(), ("Hello World!\nHere comes the third Message!"));
            Assert.AreEqual(textNode.hasNodes(), (false));

            Assert.AreEqual(block.hasNodes(), (false));
            Assert.AreEqual(root.hasNodes(), (false));
        }
Esempio n. 2
0
        public void test()
        {
            loadInParser("include_1.jade");

            tagNode = (TagNode) root.pollNode();
            Assert.AreEqual(tagNode.getName(), ("p"));
            textNode = (TextNode) tagNode.getTextNode();
            Assert.AreEqual(textNode.getValue(), ("Before Include"));

            includeNode = (BlockNode) root.pollNode();
            tagNode = (TagNode) includeNode.pollNode();
            Assert.AreEqual(tagNode.getName(), ("span"));
            textNode = (TextNode) tagNode.getTextNode();
            Assert.AreEqual(textNode.getValue(), ("Hello Include"));

            yieldNode = (BlockNode) includeNode.pollNode();
            Assert.IsNotNull(yieldNode);

            /*var blockNode = (BlockNode) yieldNode.pollNode();
            tagNode = (TagNode)blockNode.pollNode();
            Assert.AreEqual(blockNode.getName(), ("p"));
            textNode = (TextNode) tagNode.getTextNode();
            Assert.AreEqual(textNode.getValue(), ("After Include"));

            Assert.AreEqual(yieldNode.hasNodes(), (false));
            Assert.AreEqual(includeNode.hasNodes(), (false));
            Assert.AreEqual(root.hasNodes(), (false));
            */
        }