MCPcopy Create free account
hub / github.com/Stranger6667/css-inline / ignore_complex_css_values

Function ignore_complex_css_values

css-inline/tests/test_inlining.rs:1878–1907  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1876
1877#[test]
1878fn ignore_complex_css_values() {
1879 // calc(), em, rem, etc. are not converted
1880 let inliner = CSSInliner::options().apply_width_attributes(true).build();
1881
1882 // calc() - not supported
1883 let html = r#"<html><head><style>img { width: calc(100% - 20px); }</style></head><body><img></body></html>"#;
1884 let result = inliner.inline(html).unwrap();
1885 assert!(!result.contains(r#" width=""#));
1886
1887 // em - not supported
1888 let html = r#"<html><head><style>img { width: 10em; }</style></head><body><img></body></html>"#;
1889 let result = inliner.inline(html).unwrap();
1890 assert!(!result.contains(r#" width=""#));
1891
1892 // rem - not supported
1893 let html =
1894 r#"<html><head><style>img { width: 10rem; }</style></head><body><img></body></html>"#;
1895 let result = inliner.inline(html).unwrap();
1896 assert!(!result.contains(r#" width=""#));
1897
1898 // vh - not supported
1899 let html = r#"<html><head><style>img { width: 50vh; }</style></head><body><img></body></html>"#;
1900 let result = inliner.inline(html).unwrap();
1901 assert!(!result.contains(r#" width=""#));
1902
1903 // vw - not supported
1904 let html = r#"<html><head><style>img { width: 50vw; }</style></head><body><img></body></html>"#;
1905 let result = inliner.inline(html).unwrap();
1906 assert!(!result.contains(r#" width=""#));
1907}
1908
1909#[test]
1910fn apply_auto_width() {

Callers

nothing calls this directly

Calls 3

buildMethod · 0.45
inlineMethod · 0.45

Tested by

no test coverage detected