MCPcopy Index your code
hub / github.com/plotly/dash / test_css_resources_with_attributes

Function test_css_resources_with_attributes

tests/unit/test_resources.py:160–184  ·  view source on GitHub ↗

Test that attributes are passed through in CSS resources with href

()

Source from the content-addressed store, hash-verified

158
159
160def 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
187def test_resources_without_attributes():

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…