File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
PreMailer.Net/PreMailer.Net.Tests Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -137,6 +137,26 @@ public void MoveCssInline_KeepStyleElementsIgnoreElementsMatchesStyleElement_Doe
137
137
Assert . Contains ( "<style id=\" ignore\" type=\" text/css\" >" , premailedOutput . Html ) ;
138
138
}
139
139
140
+ [ Fact ]
141
+ public void MoveCssInline_PreserveMediaQueries_RemovesStyleElementsWithoutMediaQueries ( )
142
+ {
143
+ string input = "<html><head><style>div { width: 42px; }</style></head><body><div>test</div></body></html>" ;
144
+
145
+ var premailedOutput = PreMailer . MoveCssInline ( input , removeStyleElements : true , preserveMediaQueries : true ) ;
146
+
147
+ Assert . DoesNotContain ( "<style>" , premailedOutput . Html ) ;
148
+ }
149
+
150
+ [ Fact ]
151
+ public void MoveCssInline_PreserveMediaQueries_PreservesStyleElementsWithMediaQueries ( )
152
+ {
153
+ string input = "<html><head><style>div { width: 42px; } @media (max-width: 250px) { div { width: 20px; } }</style></head><body><div>test</div></body></html>" ;
154
+
155
+ var premailedOutput = PreMailer . MoveCssInline ( input , removeStyleElements : true , preserveMediaQueries : true ) ;
156
+
157
+ Assert . Contains ( "<style>@media (max-width: 250px) { div { width: 20px; } }</style>" , premailedOutput . Html ) ;
158
+ }
159
+
140
160
[ Fact ]
141
161
public void MoveCssInline_MultipleSelectors_HonorsIndividualSpecificity ( )
142
162
{
You can’t perform that action at this time.
0 commit comments