| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library polymer.test.build.import_inliner_test; | 5 library polymer.test.build.import_inliner_test; |
| 6 | 6 |
| 7 import 'dart:convert'; | 7 import 'dart:convert'; |
| 8 import 'package:polymer/src/build/common.dart'; | 8 import 'package:polymer/src/build/common.dart'; |
| 9 import 'package:polymer/src/build/import_inliner.dart'; | 9 import 'package:polymer/src/build/import_inliner.dart'; |
| 10 import 'package:polymer/src/build/messages.dart'; | 10 import 'package:polymer/src/build/messages.dart'; |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 '<!DOCTYPE html><html><head>' | 162 '<!DOCTYPE html><html><head>' |
| 163 '<script>/*third*/</script>' | 163 '<script>/*third*/</script>' |
| 164 '</head><body>' | 164 '</head><body>' |
| 165 '<polymer-element>2</polymer-element>' | 165 '<polymer-element>2</polymer-element>' |
| 166 '</body></html>', | 166 '</body></html>', |
| 167 'a|web/test2.html._data': expectedData(['web/test2.html.0.dart']), | 167 'a|web/test2.html._data': expectedData(['web/test2.html.0.dart']), |
| 168 'a|web/test2.html.0.dart': 'library a.web.test2_html_0;\n/*forth*/', | 168 'a|web/test2.html.0.dart': 'library a.web.test2_html_0;\n/*forth*/', |
| 169 'a|web/second.js': '/*second*/' | 169 'a|web/second.js': '/*second*/' |
| 170 }); | 170 }); |
| 171 | 171 |
| 172 testLogOutput( |
| 173 (options) => new ImportInliner(options), |
| 174 'removes duplicate scripts', { |
| 175 'a|web/test.html': |
| 176 '<!DOCTYPE html><html><head>' |
| 177 '<link rel="import" href="packages/a/x_a.html">' |
| 178 '<link rel="import" href="packages/a/x_b.html">' |
| 179 '</head></html>', |
| 180 'a|lib/x_a.html': |
| 181 '<script type="application/dart" src="bar.dart"></script>', |
| 182 'a|lib/x_b.html': |
| 183 '<script type="application/dart" src="bar.dart"></script>', |
| 184 'a|lib/bar.dart': 'var i = 0;' |
| 185 }, { |
| 186 'a|web/test.html': |
| 187 '<!DOCTYPE html><html><head></head><body></body></html>', |
| 188 'a|web/test.html._data': expectedData(['lib/bar.dart']), |
| 189 }, [ |
| 190 'warning: ${SCRIPT_INCLUDED_MORE_THAN_ONCE.create( |
| 191 {'url': 'packages/a/bar.dart'}).snippet} (lib/x_b.html 0 0)' |
| 192 ]); |
| 193 |
| 172 final cspPhases = [[new ImportInliner( | 194 final cspPhases = [[new ImportInliner( |
| 173 new TransformOptions(contentSecurityPolicy: true))]]; | 195 new TransformOptions(contentSecurityPolicy: true))]]; |
| 174 testPhases('extract Js scripts in CSP mode', cspPhases, | 196 testPhases('extract Js scripts in CSP mode', cspPhases, |
| 175 { | 197 { |
| 176 'a|web/test.html': | 198 'a|web/test.html': |
| 177 '<!DOCTYPE html><html><head>' | 199 '<!DOCTYPE html><html><head>' |
| 178 '<script type="text/javascript">/*first*/</script>' | 200 '<script type="text/javascript">/*first*/</script>' |
| 179 '<script src="second.js"></script>' | 201 '<script src="second.js"></script>' |
| 180 '<link rel="import" href="test2.html">' | 202 '<link rel="import" href="test2.html">' |
| 181 '<script type="application/dart">/*fifth*/</script>' | 203 '<script type="application/dart">/*fifth*/</script>' |
| (...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1268 'console.log("here");', | 1290 'console.log("here");', |
| 1269 }, { | 1291 }, { |
| 1270 'a|web/test/well/test.html': | 1292 'a|web/test/well/test.html': |
| 1271 '<!DOCTYPE html><html><head></head><body>' | 1293 '<!DOCTYPE html><html><head></head><body>' |
| 1272 '<div hidden="">' | 1294 '<div hidden="">' |
| 1273 '<script rel="import" href="../../packages/b/bar/bar.js"></script>' | 1295 '<script rel="import" href="../../packages/b/bar/bar.js"></script>' |
| 1274 '</div>' | 1296 '</div>' |
| 1275 '</body></html>', | 1297 '</body></html>', |
| 1276 }); | 1298 }); |
| 1277 } | 1299 } |
| OLD | NEW |