Ejemplo n.º 1
0
 public void SetExpressionBodyShouldSetConditionalCorrectly()
 {
     GivenAnExpressionNode(SparkTestNodes.ConditionNode());
     WhenSetExpressionBodyIsCalledWith("someCondition", "someCode");
     TheExpressionBodyShouldBeConditionalWithCondition("someCondition");
     TheExpressionbodyShouldContainExpression("someCode");
 }
        public void AddCodeConditionalExpressionShouldReturnTheWrappedNode()
        {
            ElementNode node = SparkTestNodes.ElementNode("foo");

            GivenAnOriginalElement(node);
            WhenConditionalExpressionAreAdded();
            ThenAddCodeConditionalExpressionAttributeShouldWrapBodyNode();
        }
        public void ClearInnerTextShouldRemoveAllTextNodesFromBody()
        {
            ElementNode node = SparkTestNodes.ElementNode("bar");

            GivenAnOriginalElement(node, new TextNode("A text"), new TextNode("abc"));
            WhenInnerTextCleared();
            ThenNodeHasNoBody();
        }
        public void AddCodeExpressionShouldAddCodeToTheUnderlyingNode()
        {
            string expression = "BLAH";

            GivenACodeExpressionNodeWrapping(SparkTestNodes.ExpressionNode());
            WhenCodeExpressionIsAdded(new CodeExpression(expression));
            ThenTheUnderlyingNodeShouldHaveExpression(expression);
        }
Ejemplo n.º 5
0
        public void AddCodeNodeShouldReturnConditionNodeWrapped()
        {
            AttributeNode attributeNode = SparkTestNodes.BasicAttributeNode("attribute");

            GivenAnAttribute(attributeNode);
            WhenACodeExpressionNodeIsAdded();
            CodeExpressionResultShouldWrap(attributeNode.Nodes.Last());
        }
        public void RemoveAttributeShouldRemoveFromTheWrappedNode()
        {
            AttributeNode attributeNode = SparkTestNodes.BasicAttributeNode("fred");

            GivenAnOriginalElement(SparkTestNodes.ElementNode("foo").WithAttribute(attributeNode));
            WhenAttributeIsRemoved(new SparkAttributeWrapper(attributeNode));
            ThenTheElementShouldNotContainAttribute(attributeNode);
        }
        public void ShouldReturnWrappedAttributeNodeIfItExists()
        {
            AttributeNode attributeNode = SparkTestNodes.BasicAttributeNode("thisAttribute");
            ElementNode   node          = SparkTestNodes.BasicElementNode().WithAttribute(attributeNode);

            GivenAnOriginalElement(node);
            WhenAttributeIsRetreived("thisAttribute");
            ThenRetrievedAttributeShouldWrap(attributeNode);
        }
        public void GetChildElementsShouldReturnThoseWithMatchingName()
        {
            ElementNode node      = SparkTestNodes.ElementNode("bar");
            ElementNode matching1 = SparkTestNodes.ElementNode("foo");
            ElementNode matching2 = SparkTestNodes.ElementNode("foo");

            GivenAnOriginalElement(node, matching1, matching2, SparkTestNodes.ElementNode("bar2"));
            WhenGetChildElements("foo");
            ThenGetChildElementsResultShouldBe(matching1, matching2);
        }
        public void GetChildElementsShouldBeCaseSensitive()
        {
            ElementNode node      = SparkTestNodes.ElementNode("bar");
            ElementNode matching1 = SparkTestNodes.ElementNode("FOO");
            ElementNode matching2 = SparkTestNodes.ElementNode("foo");

            GivenAnOriginalElement(node, matching1, matching2);
            WhenGetChildElements("foo");
            ThenGetChildElementsResultShouldBe(matching1, matching2);
        }
 public void NameShouldReturnTheNameOfTheWrappedNode()
 {
     GivenAnOriginalElement(SparkTestNodes.ElementNode("foo"));
     ThenNodeNameShouldBe("foo");
 }
Ejemplo n.º 11
0
 public void NameShouldReturnTheNameOfTheWrappedNode()
 {
     GivenAnAttribute(SparkTestNodes.BasicAttributeNode("foo"));
     ThenNodeNameShouldBe("foo");
 }
Ejemplo n.º 12
0
 public void ExistsShouldBeTrueIfWrapperInitialisedWithNonNullAttribute()
 {
     GivenAnAttribute(SparkTestNodes.BasicAttributeNode("attrib"));
     WhenAskedIfItExists();
     ExistsShouldBe(true);
 }
Ejemplo n.º 13
0
 public void GetTextValueShouldReturnTextvalueOfWrappedAttribute()
 {
     GivenAnAttribute(SparkTestNodes.BasicAttributeNode("attribute").WithText("foo"));
     WhenGetTextCalled();
     ThenGetTextResultShouldEqual("foo");
 }
 public void ShouldAddAnAttributeToOriginalNodeOnAddAttribute()
 {
     GivenAnOriginalElement(SparkTestNodes.BasicElementNode());
     WhenAnAttributeIsAdded("theAttribute");
     ThenTheWrappedElementShouldHaveABlankAttributeNamed("theAttribute");
 }
Ejemplo n.º 15
0
 public void AddCodeNodeAddsANewConditionNodeToTheAttributeBody()
 {
     GivenAnAttribute(SparkTestNodes.BasicAttributeNode("attribute"));
     WhenACodeExpressionNodeIsAdded();
     ThenTheAttributeShouldContainACodeExpressionNode();
 }
 public void ShouldReturnWrappedAttributeNodeWhenAttributeIsAdded()
 {
     GivenAnOriginalElement(SparkTestNodes.BasicElementNode());
     WhenAnAttributeIsAdded("theAttribute");
     ThenTheReturnedAttributeShouldBeWrappedSparkAttributeNamed("theAttribute");
 }
 public void AddCodeExpressionShouldAddNewCodeExpressionNodeToElement()
 {
     GivenAnOriginalElement(SparkTestNodes.ElementNode("foo"));
     WhenCodeExpressionIsAdded();
     ThenTheElementShouldHaveOneCodeElementInItsChildren();
 }
 public void ShouldReturnFalseForHasAttributeIfUnderlyingNodeDoesntHaveAttribute()
 {
     GivenAnOriginalElement(SparkTestNodes.BasicElementNode());
     ThenHasAttributeShouldBeFalseFor("theAttribute");
 }
 public void ShouldReturnTrueForHasAttributeIfUnderlyingNodeHasAttributeWithDifferentCase()
 {
     GivenAnOriginalElement(SparkTestNodes.BasicElementNode());
     WhenAnAttributeIsAdded("theATTriBUTE");
     ThenHasAttributeShouldBeTrueFor("theAttribute");
 }
 public void GetAttributeShouldReturnEmptyAttributreNodeIfTheAttributeDoesntExist()
 {
     GivenAnOriginalElement(SparkTestNodes.BasicElementNode());
     WhenAttributeIsRetreived("thisAttribute");
     ThenGetAttributeResultShouldBeEmpty();
 }