File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
src/AngleSharp.Css.Tests/Library Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ namespace AngleSharp . Css . Tests . Library
2
+ {
3
+ using AngleSharp . Css . Dom ;
4
+ using AngleSharp . Css . Values ;
5
+ using AngleSharp . Dom ;
6
+ using AngleSharp . Html . Dom ;
7
+ using NUnit . Framework ;
8
+
9
+ [ TestFixture ]
10
+ public class ExtractInfosTests
11
+ {
12
+ [ Test ]
13
+ public void GetFontUrl_Issue126 ( )
14
+ {
15
+ var css = @"@font-face {
16
+ font-family: 'Inter';
17
+ font-style: normal;
18
+ font-weight: 400;
19
+ src: url(https://example.org/some-font.ttf) format('truetype');
20
+ }" ;
21
+ var html = $ "<style>{ css } </style>";
22
+ var document = html . ToHtmlDocument ( Configuration . Default . WithCss ( ) ) ;
23
+ var style = document . QuerySelector < IHtmlStyleElement > ( "style" ) ;
24
+ var sheet = style . Sheet as ICssStyleSheet ;
25
+ var fontFace = sheet . Rules [ 0 ] as ICssFontFaceRule ;
26
+ var src = fontFace . GetProperty ( "src" ) . RawValue ;
27
+ var url = ( ( src as ICssMultipleValue ) [ 0 ] as ICssMultipleValue ) [ 0 ] as CssUrlValue ;
28
+ Assert . AreEqual ( "https://example.org/some-font.ttf" , url . Path ) ;
29
+ }
30
+ }
31
+ }
You can’t perform that action at this time.
0 commit comments