Skip to content

Commit

Permalink
Add a few more test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
askonomm committed Oct 28, 2024
1 parent 3c06b79 commit 41467c0
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions HtmtTests/ExpressionModifierTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,4 +169,26 @@ public void TestReverseModifier()

Assert.AreEqual("<html><body><p>!dlrow ,olleh</p></body></html>", html);
}

[TestMethod]
public void TestModifierChaining()
{
const string template = "<html><body><p x:inner-text=\"{text | uppercase | reverse}\"></p></body></html>";
var data = new Dictionary<string, object?> { { "text", "hello, world!" } };
var parser = new Parser { Template = template, Data = data };
var html = parser.ToHtml();

Assert.AreEqual("<html><body><p>!DLROW ,OLLEH</p></body></html>", html);
}

[TestMethod]
public void TestModifiersNoWhitespace()
{
const string template = "<html><body><p x:inner-text=\"{text | uppercase|reverse}\"></p></body></html>";
var data = new Dictionary<string, object?> { { "text", "hello, world!" } };
var parser = new Parser { Template = template, Data = data };
var html = parser.ToHtml();

Assert.AreEqual("<html><body><p>!DLROW ,OLLEH</p></body></html>", html);
}
}

0 comments on commit 41467c0

Please sign in to comment.