Test that attributes are passed through in CSS resources with href
()
| 158 | |
| 159 | |
| 160 | def test_css_resources_with_attributes(): |
| 161 | """Test that attributes are passed through in CSS resources with href""" |
| 162 | app = dash.Dash(__name__) |
| 163 | |
| 164 | # Test external CSS with attributes |
| 165 | resources = app._collect_and_register_resources( |
| 166 | [ |
| 167 | { |
| 168 | "external_url": "https://example.com/styles.css", |
| 169 | "attributes": {"media": "print"}, |
| 170 | "external_only": True, |
| 171 | }, |
| 172 | { |
| 173 | "external_url": "https://example.com/theme.css", |
| 174 | "attributes": {"crossorigin": "anonymous"}, |
| 175 | "external_only": True, |
| 176 | }, |
| 177 | ], |
| 178 | url_attr="href", |
| 179 | ) |
| 180 | |
| 181 | assert resources == [ |
| 182 | {"href": "https://example.com/styles.css", "media": "print"}, |
| 183 | {"href": "https://example.com/theme.css", "crossorigin": "anonymous"}, |
| 184 | ] |
| 185 | |
| 186 | |
| 187 | def test_resources_without_attributes(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…