Chromium Code Reviews| Index: tests/html/js_interop_1_test.dart |
| diff --git a/tests/html/js_interop_1_test.dart b/tests/html/js_interop_1_test.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..88f54bf32e31b90d16e96905e076c53bf47519d4 |
| --- /dev/null |
| +++ b/tests/html/js_interop_1_test.dart |
| @@ -0,0 +1,26 @@ |
| +#library('JsInterop1Test'); |
|
kasperl
2012/07/04 05:13:00
Add copyright notice.
vsm
2012/07/04 07:43:09
Done.
|
| +#import('../../lib/unittest/unittest.dart'); |
| +#import('../../lib/unittest/html_config.dart'); |
| +#import('dart:html'); |
| +#import('dart:json'); |
| + |
| +injectSource(code) { |
| + final script = new ScriptElement(); |
| + script.type = 'text/javascript'; |
| + script.innerHTML = code; |
| + document.body.nodes.add(script); |
| +} |
| + |
| +main() { |
| + useHtmlConfiguration(); |
| + var callback; |
| + |
| + test('jsPostMessage', () { |
| + callback = expectAsync1((e) { |
|
kasperl
2012/07/04 05:13:00
Too much indentation: Use 2 spaces here.
vsm
2012/07/04 07:43:09
Done.
|
| + Expect.equals('hello', e.data); |
|
kasperl
2012/07/04 05:13:00
Too much indentation. Use 2 spaces here.
vsm
2012/07/04 07:43:09
Done.
|
| + window.on.message.remove(callback); |
| + }); |
|
kasperl
2012/07/04 05:13:00
Don't indent this.
vsm
2012/07/04 07:43:09
Done.
|
| + window.on.message.add(callback); |
| + injectSource("window.postMessage('hello', '*');"); |
| + }); |
| +} |