@@ -273,44 +273,9 @@ defmodule CSSInlineTest do
273273
274274 test "preserves !important when inlining styles" do
275275 assert { :ok , result } = CSSInline . inline ( @ email_html )
276- assert result =~ ~r/ style="[^"]*!important/
277- end
278-
279- @ production_opts [
280- load_remote_stylesheets: false ,
281- keep_link_tags: true ,
282- keep_style_tags: true
283- ]
284-
285- test "production settings: inlined selectors remain in <style> without remove_inlined_selectors" do
286- assert { :ok , result } = CSSInline . inline ( @ email_html , @ production_opts )
287-
288- assert result =~ ~r/ style="[^"]*!important/ ,
289- "Inlined styles should preserve !important"
290-
291- [ _ , style_content ] = Regex . run ( ~r/ <style[^>]*>(.*?)<\/ style>/ s , result )
292-
293- assert style_content =~ "u + #body a" ,
294- "Non-inlinable selectors should remain in <style> tag"
295-
296- assert style_content =~ ".button a" ,
297- "Without remove_inlined_selectors, inlined selectors remain in <style>"
298- end
299-
300- test "production settings + remove_inlined_selectors strips inlined rules from <style>" do
301- { :ok , result } =
302- CSSInline . inline ( @ email_html , [ remove_inlined_selectors: true ] ++ @ production_opts )
303-
304- assert result =~ ~r/ style="[^"]*color:[^"]*!important/ ,
305- "Inlined styles should preserve !important"
306-
307- [ _ , style_content ] = Regex . run ( ~r/ <style[^>]*>(.*?)<\/ style>/ s , result )
308-
309- assert style_content =~ "u + #body a" ,
310- "Non-inlinable selectors (complex email client overrides) must remain"
311276
312- refute style_content =~ ".button a" ,
313- "Inlined selectors should be removed from < style> to prevent conflicts "
277+ assert result =~
278+ "<a href= \" https://example.com \" style= \" color:#ffffff !important;font-size:16px !important;font-weight:bold !important \" > "
314279 end
315280 end
316281
0 commit comments