File tree 1 file changed +27
-0
lines changed
src/AngleSharp.Css.Tests/Library
1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -2,9 +2,14 @@ namespace AngleSharp.Css.Tests.Library
2
2
{
3
3
using AngleSharp . Css . Dom ;
4
4
using AngleSharp . Css . Parser ;
5
+ using AngleSharp . Css . Tests . Mocks ;
5
6
using AngleSharp . Css . Values ;
7
+ using AngleSharp . Dom ;
8
+ using AngleSharp . Html . Dom ;
9
+ using AngleSharp . Io ;
6
10
using NUnit . Framework ;
7
11
using System . IO ;
12
+ using System . Threading . Tasks ;
8
13
using static CssConstructionFunctions ;
9
14
10
15
[ TestFixture ]
@@ -151,5 +156,27 @@ public void BorderWithEmptyPx_Issue129()
151
156
152
157
Assert . AreEqual ( "border-width: 1px" , css ) ;
153
158
}
159
+
160
+ [ Test ]
161
+ public async Task MediaListForLinkedStyleSheet_Issue133 ( )
162
+ {
163
+ var html = "<link href=\" style.css\" rel=\" stylesheet\" >" ;
164
+ var mockRequester = new MockRequester ( ) ;
165
+ mockRequester . BuildResponse ( request =>
166
+ {
167
+ if ( request . Address . Path . EndsWith ( "style.css" ) )
168
+ {
169
+ return "div#A { color: blue; }" ;
170
+ }
171
+
172
+ return null ;
173
+ } ) ;
174
+ var config = Configuration . Default . WithCss ( ) . WithMockRequester ( mockRequester ) ;
175
+ var context = BrowsingContext . New ( config ) ;
176
+ var document = await context . OpenAsync ( ( res ) => res . Content ( html ) ) ;
177
+ var link = document . QuerySelector < IHtmlLinkElement > ( "link" ) ;
178
+ Assert . AreEqual ( "" , link . Sheet . Media . MediaText ) ;
179
+ Assert . IsTrue ( link . Sheet . Media . Validate ( new DefaultRenderDevice ( ) ) ) ;
180
+ }
154
181
}
155
182
}
You can’t perform that action at this time.
0 commit comments