OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 3 Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
4 for details. All rights reserved. Use of this source code is governed by a | 4 for details. All rights reserved. Use of this source code is governed by a |
5 BSD-style license that can be found in the LICENSE file. | 5 BSD-style license that can be found in the LICENSE file. |
6 --> | 6 --> |
7 <html lang="en"> | 7 <html lang="en"> |
8 <head> | 8 <head> |
9 <meta charset="utf-8"> | 9 <meta charset="utf-8"> |
10 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | 10 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
11 <script type="application/javascript" src="testing.js"></script> | 11 <script type="application/javascript" src="testing.js"></script> |
12 </head> | 12 </head> |
13 <body> | 13 <body> |
14 <!-- Tests it is valid to switch text bindings by SafeHtml bindings and | 14 <!-- Tests it is valid to switch text bindings by SafeHtml bindings and |
15 viceversa. --> | 15 viceversa. --> |
16 <div>text to text (expect <span>text1</span>): {{w}}</div> | 16 <div>text to text (expect <span>text1</span>): {{w}}</div> |
17 <div>text to html (expect html1 in a real span): {{x}}</div> | 17 <div>text to html (expect html1 in a real span): {{x}}</div> |
18 <div>html to text (expect <span>text2</span>): {{y}}</div> | 18 <div>html to text (expect <span>text2</span>): {{y}}</div> |
19 <div>html to html (expect html2 in a real span): {{z}}</div> | 19 <div>html to html (expect html2 in a real span): {{z}}</div> |
20 <script type="application/dart"> | 20 <script type="application/dart"> |
21 import 'dart:html'; | 21 import 'dart:html'; |
22 import 'package:unittest/unittest.dart'; | 22 import 'package:unittest/unittest.dart'; |
23 import 'package:web_components/watcher.dart'; | 23 import 'package:web_ui/watcher.dart'; |
24 import 'package:web_components/safe_html.dart'; | 24 import 'package:web_ui/safe_html.dart'; |
25 | 25 |
26 var w = '<span>text0</span>'; | 26 var w = '<span>text0</span>'; |
27 var x = '<span>text0</span>'; | 27 var x = '<span>text0</span>'; |
28 var y = new SafeHtml.unsafe('<span>html0</span>'); | 28 var y = new SafeHtml.unsafe('<span>html0</span>'); |
29 var z = new SafeHtml.unsafe('<span>html0</span>'); | 29 var z = new SafeHtml.unsafe('<span>html0</span>'); |
30 main() { | 30 main() { |
31 window.setTimeout(() { | 31 window.setTimeout(() { |
32 w = '<span>text1</span>'; | 32 w = '<span>text1</span>'; |
33 x = new SafeHtml.unsafe('<div>html1</div>'); | 33 x = new SafeHtml.unsafe('<div>html1</div>'); |
34 y = '<span>text2</span>'; | 34 y = '<span>text2</span>'; |
35 z = new SafeHtml.unsafe('<div>html2</div>'); | 35 z = new SafeHtml.unsafe('<div>html2</div>'); |
36 dispatch(); | 36 dispatch(); |
37 window.setTimeout(() => window.postMessage('done', '*'), 0); | 37 window.setTimeout(() => window.postMessage('done', '*'), 0); |
38 }, 0); | 38 }, 0); |
39 } | 39 } |
40 </script> | 40 </script> |
41 </body> | 41 </body> |
42 </html> | 42 </html> |
OLD | NEW |