diff --git a/src/AngleSharp.Css.Tests/Library/StringRepresentation.cs b/src/AngleSharp.Css.Tests/Library/StringRepresentation.cs index 0e15685..53b8e28 100644 --- a/src/AngleSharp.Css.Tests/Library/StringRepresentation.cs +++ b/src/AngleSharp.Css.Tests/Library/StringRepresentation.cs @@ -2,9 +2,14 @@ namespace AngleSharp.Css.Tests.Library { using AngleSharp.Css.Dom; using AngleSharp.Css.Parser; + using AngleSharp.Css.Tests.Mocks; using AngleSharp.Css.Values; + using AngleSharp.Dom; + using AngleSharp.Html.Dom; + using AngleSharp.Io; using NUnit.Framework; using System.IO; + using System.Threading.Tasks; using static CssConstructionFunctions; [TestFixture] @@ -151,5 +156,27 @@ namespace AngleSharp.Css.Tests.Library Assert.AreEqual("border-width: 1px", css); } + + [Test] + public async Task MediaListForLinkedStyleSheet_Issue133() + { + var html = ""; + var mockRequester = new MockRequester(); + mockRequester.BuildResponse(request => + { + if (request.Address.Path.EndsWith("style.css")) + { + return "div#A { color: blue; }"; + } + + return null; + }); + var config = Configuration.Default.WithCss().WithMockRequester(mockRequester); + var context = BrowsingContext.New(config); + var document = await context.OpenAsync((res) => res.Content(html)); + var link = document.QuerySelector("link"); + Assert.AreEqual("", link.Sheet.Media.MediaText); + Assert.IsTrue(link.Sheet.Media.Validate(new DefaultRenderDevice())); + } } }