This commit is contained in:
Florian Rappl 2023-06-15 18:38:48 +02:00
Родитель 6d52e79409
Коммит 10845f296f
1 изменённых файлов: 27 добавлений и 0 удалений

Просмотреть файл

@ -2,9 +2,14 @@ namespace AngleSharp.Css.Tests.Library
{ {
using AngleSharp.Css.Dom; using AngleSharp.Css.Dom;
using AngleSharp.Css.Parser; using AngleSharp.Css.Parser;
using AngleSharp.Css.Tests.Mocks;
using AngleSharp.Css.Values; using AngleSharp.Css.Values;
using AngleSharp.Dom;
using AngleSharp.Html.Dom;
using AngleSharp.Io;
using NUnit.Framework; using NUnit.Framework;
using System.IO; using System.IO;
using System.Threading.Tasks;
using static CssConstructionFunctions; using static CssConstructionFunctions;
[TestFixture] [TestFixture]
@ -151,5 +156,27 @@ namespace AngleSharp.Css.Tests.Library
Assert.AreEqual("border-width: 1px", css); Assert.AreEqual("border-width: 1px", css);
} }
[Test]
public async Task MediaListForLinkedStyleSheet_Issue133()
{
var html = "<link href=\"style.css\" rel=\"stylesheet\">";
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<IHtmlLinkElement>("link");
Assert.AreEqual("", link.Sheet.Media.MediaText);
Assert.IsTrue(link.Sheet.Media.Validate(new DefaultRenderDevice()));
}
} }
} }