()
| 1876 | |
| 1877 | #[test] |
| 1878 | fn 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] |
| 1910 | fn apply_auto_width() { |
nothing calls this directly
no test coverage detected