-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
50d8e9d
commit 15cb522
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
namespace AngleSharp.Css.Tests.Library | ||
{ | ||
using AngleSharp.Css.Dom; | ||
using AngleSharp.Css.Values; | ||
using AngleSharp.Dom; | ||
using AngleSharp.Html.Dom; | ||
using NUnit.Framework; | ||
|
||
[TestFixture] | ||
public class ExtractInfosTests | ||
{ | ||
[Test] | ||
public void GetFontUrl_Issue126() | ||
{ | ||
var css = @"@font-face { | ||
font-family: 'Inter'; | ||
font-style: normal; | ||
font-weight: 400; | ||
src: url(https://example.org/some-font.ttf) format('truetype'); | ||
}"; | ||
var html = $"<style>{css}</style>"; | ||
var document = html.ToHtmlDocument(Configuration.Default.WithCss()); | ||
var style = document.QuerySelector<IHtmlStyleElement>("style"); | ||
var sheet = style.Sheet as ICssStyleSheet; | ||
var fontFace = sheet.Rules[0] as ICssFontFaceRule; | ||
var src = fontFace.GetProperty("src").RawValue; | ||
var url = ((src as ICssMultipleValue)[0] as ICssMultipleValue)[0] as CssUrlValue; | ||
Assert.AreEqual("https://example.org/some-font.ttf", url.Path); | ||
} | ||
} | ||
} |