@@ -2,6 +2,7 @@ namespace AngleSharp.Css.Tests.Library
2
2
{
3
3
using AngleSharp . Css . Dom ;
4
4
using AngleSharp . Css . Parser ;
5
+ using AngleSharp . Css . RenderTree ;
5
6
using AngleSharp . Css . Tests . Mocks ;
6
7
using AngleSharp . Css . Values ;
7
8
using AngleSharp . Dom ;
@@ -178,5 +179,43 @@ public async Task MediaListForLinkedStyleSheet_Issue133()
178
179
Assert . AreEqual ( "" , link . Sheet . Media . MediaText ) ;
179
180
Assert . IsTrue ( link . Sheet . Media . Validate ( new DefaultRenderDevice ( ) ) ) ;
180
181
}
182
+
183
+ [ Test ]
184
+ public async Task ExternalCssNotConsidered_Issue140 ( )
185
+ {
186
+ var html = @"<html>
187
+ <head><link href=""https://some/tested/url.css"" rel=""stylesheet""></head>
188
+ <body><label>HI</label></body>
189
+ </html>" ;
190
+ var mockRequester = new MockRequester ( ) ;
191
+ mockRequester . BuildResponse ( request =>
192
+ {
193
+ if ( request . Address . Path . EndsWith ( "url.css" ) )
194
+ {
195
+ return @"label, .test {
196
+ min-width: 50px;
197
+ border: 1px solid green;
198
+ }" ;
199
+ }
200
+
201
+ return null ;
202
+ } ) ;
203
+ var config = Configuration . Default
204
+ . WithRenderDevice ( new DefaultRenderDevice
205
+ {
206
+ DeviceWidth = 1920 ,
207
+ DeviceHeight = 1080 ,
208
+ } )
209
+ . WithCss ( )
210
+ . WithMockRequester ( mockRequester ) ;
211
+ var context = BrowsingContext . New ( config ) ;
212
+ var document = await context . OpenAsync ( ( res ) => res . Content ( html ) ) ;
213
+ var window = document . DefaultView ;
214
+ var tree = window . Render ( ) ;
215
+ var label = tree . Find ( document . QuerySelector ( "label" ) ) ;
216
+ var minWidth = window . GetComputedStyle ( label . Ref as IHtmlElement ) . GetMinWidth ( ) ;
217
+
218
+ Assert . AreEqual ( "50px" , minWidth ) ;
219
+ }
181
220
}
182
221
}
0 commit comments