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); }
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"); }
public void NameShouldReturnTheNameOfTheWrappedNode() { GivenAnAttribute(SparkTestNodes.BasicAttributeNode("foo")); ThenNodeNameShouldBe("foo"); }
public void ExistsShouldBeTrueIfWrapperInitialisedWithNonNullAttribute() { GivenAnAttribute(SparkTestNodes.BasicAttributeNode("attrib")); WhenAskedIfItExists(); ExistsShouldBe(true); }
public void GetTextValueShouldReturnTextvalueOfWrappedAttribute() { GivenAnAttribute(SparkTestNodes.BasicAttributeNode("attribute").WithText("foo")); WhenGetTextCalled(); ThenGetTextResultShouldEqual("foo"); }
public void ShouldAddAnAttributeToOriginalNodeOnAddAttribute() { GivenAnOriginalElement(SparkTestNodes.BasicElementNode()); WhenAnAttributeIsAdded("theAttribute"); ThenTheWrappedElementShouldHaveABlankAttributeNamed("theAttribute"); }
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(); }