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

Function test_resources_with_attributes

tests/unit/test_resources.py:127–157  ·  view source on GitHub ↗

Test that attributes are passed through in external_url resources

()

Source from the content-addressed store, hash-verified

125
126
127def test_resources_with_attributes():
128 """Test that attributes are passed through in external_url resources"""
129 app = dash.Dash(__name__)
130
131 # Test external scripts with attributes
132 resources = app._collect_and_register_resources(
133 [
134 {
135 "external_url": "https://example.com/module.js",
136 "attributes": {"type": "module"},
137 "external_only": True,
138 },
139 {
140 "external_url": "https://example.com/script.js",
141 "attributes": {
142 "crossorigin": "anonymous",
143 "integrity": "sha256-abc123",
144 },
145 "external_only": True,
146 },
147 ]
148 )
149
150 assert resources == [
151 {"src": "https://example.com/module.js", "type": "module"},
152 {
153 "src": "https://example.com/script.js",
154 "crossorigin": "anonymous",
155 "integrity": "sha256-abc123",
156 },
157 ]
158
159
160def test_css_resources_with_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…