Chromium Code Reviews| 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 { | |
|
Siggi Cherem (dart-lang)
2014/10/21 17:06:03
nit: move this char to the prev line? (consistency
jakemac
2014/10/21 18:14:01
Done.
| |
| 176 'a|web/test.html': | |
| 177 '<!DOCTYPE html><html><head>' | |
| 178 '<link rel="import" href="x_a.html">' | |
| 179 '<link rel="import" href="x_b.html">' | |
| 180 '</head></html>', | |
| 181 'a|web/x_a.html': | |
| 182 '<!DOCTYPE html>' | |
| 183 '<script type="application/dart" src="foo.dart"></script>', | |
|
Siggi Cherem (dart-lang)
2014/10/21 17:06:03
minor silly thing - because the example you have i
jakemac
2014/10/21 18:14:01
Done.
| |
| 184 'a|web/x_b.html': | |
| 185 '<!DOCTYPE html>' | |
| 186 '<script type="application/dart" src="foo.dart"></script>', | |
| 187 'a|web/foo.dart': 'var i = 0;' | |
| 188 }, { | |
| 189 'a|web/test.html': | |
| 190 '<!DOCTYPE html><html><head></head><body></body></html>', | |
| 191 'a|web/test.html._data': expectedData(['web/foo.dart']), | |
| 192 }, [ | |
| 193 'warning: ${SCRIPT_INCLUDED_MORE_THAN_ONCE.create({'url': 'foo.dart'}) | |
| 194 .snippet} (web/x_b.html 0 15)' | |
| 195 ]); | |
| 196 | |
| 172 final cspPhases = [[new ImportInliner( | 197 final cspPhases = [[new ImportInliner( |
| 173 new TransformOptions(contentSecurityPolicy: true))]]; | 198 new TransformOptions(contentSecurityPolicy: true))]]; |
| 174 testPhases('extract Js scripts in CSP mode', cspPhases, | 199 testPhases('extract Js scripts in CSP mode', cspPhases, |
| 175 { | 200 { |
| 176 'a|web/test.html': | 201 'a|web/test.html': |
| 177 '<!DOCTYPE html><html><head>' | 202 '<!DOCTYPE html><html><head>' |
| 178 '<script type="text/javascript">/*first*/</script>' | 203 '<script type="text/javascript">/*first*/</script>' |
| 179 '<script src="second.js"></script>' | 204 '<script src="second.js"></script>' |
| 180 '<link rel="import" href="test2.html">' | 205 '<link rel="import" href="test2.html">' |
| 181 '<script type="application/dart">/*fifth*/</script>' | 206 '<script type="application/dart">/*fifth*/</script>' |
| (...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1268 'console.log("here");', | 1293 'console.log("here");', |
| 1269 }, { | 1294 }, { |
| 1270 'a|web/test/well/test.html': | 1295 'a|web/test/well/test.html': |
| 1271 '<!DOCTYPE html><html><head></head><body>' | 1296 '<!DOCTYPE html><html><head></head><body>' |
| 1272 '<div hidden="">' | 1297 '<div hidden="">' |
| 1273 '<script rel="import" href="../../packages/b/bar/bar.js"></script>' | 1298 '<script rel="import" href="../../packages/b/bar/bar.js"></script>' |
| 1274 '</div>' | 1299 '</div>' |
| 1275 '</body></html>', | 1300 '</body></html>', |
| 1276 }); | 1301 }); |
| 1277 } | 1302 } |
| OLD | NEW |