Skip to content

Commit

Permalink
Add test for #80
Browse files Browse the repository at this point in the history
  • Loading branch information
mganss committed Aug 15, 2016
1 parent 97d7532 commit 70066eb
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/HtmlSanitizer.Tests/Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using AngleSharp.Dom.Css;

// Tests based on tests from http://roadkill.codeplex.com/

Expand Down Expand Up @@ -2717,6 +2718,33 @@ public void OpenTagFragmentTest()

Assert.Equal("<p>abc</p>", actual);
}

[Fact]
public void FontFaceTest()
{
// https://github.com/mganss/HtmlSanitizer/issues/80

var s = new HtmlSanitizer();

s.AllowDataAttributes = true;
s.AllowedAtRules.Add(CssRuleType.FontFace);

s.AllowedTags.Add("style");

s.AllowedCssProperties.Add("src");
s.AllowedCssProperties.Add("font-family");

var html = @"<html><head><style>
@font-face {
font-family: FrutigerLTStd;
src: url(""https://example.com/FrutigerLTStd-Light.otf"") format(""opentype"");
}
</style></head></html>";
var actual = s.SanitizeDocument(html);

Assert.Equal(html, actual);

}
}
}

Expand Down

0 comments on commit 70066eb

Please sign in to comment.