Test that attributes are passed through in external_url resources
()
| 125 | |
| 126 | |
| 127 | def 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 | |
| 160 | def test_css_resources_with_attributes(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…