Fixed the NRE for IRenderDevice in @media #20

This commit is contained in:
Florian Rappl 2019-05-05 20:05:08 +02:00
Родитель a136533add
Коммит 9cc365f6a2
2 изменённых файлов: 12 добавлений и 1 удалений

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

@ -5,6 +5,7 @@ Released on Thursday, May 5 2019.
- Reference latest AngleSharp
- Returns `null` in `GetStyle` if CSS not configured (#15)
- Added `pointer-events` and fixed border recombination (#16)
- Fixed exception when not providing an `IRenderDevice` (#20)
- Fixed missing `CssStylingService.Default` in cascade (#21)
- Added extension helper `SetStyle` to modify all styles of many elements (#22)
- Introduced special converter for the `src` declaration (#25)

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

@ -432,7 +432,7 @@ namespace AngleSharp.Css.Tests.Styling
}
[Test]
public static void DefaultStyleSheetTest_Issue21()
public void DefaultStyleSheetTest_Issue21()
{
var browsingContext = BrowsingContext.New(Configuration.Default.WithCss());
var htmlParser = browsingContext.GetService<IHtmlParser>();
@ -440,5 +440,15 @@ namespace AngleSharp.Css.Tests.Styling
var boldStyle = document.Body.FirstElementChild.ComputeCurrentStyle();
Assert.AreEqual("bolder", boldStyle.GetFontWeight());
}
[Test]
public void MediaRuleCssCausesException_Issue20()
{
var browsingContext = BrowsingContext.New(Configuration.Default.WithCss());
var htmlParser = browsingContext.GetService<IHtmlParser>();
var document = htmlParser.ParseDocument("<html><head><style>@media screen { }</style></head><body></body></html>");
var style = document.Body.ComputeCurrentStyle();
Assert.IsNotNull(style);
}
}
}