OLD | NEW |
(Empty) | |
| 1 #library('WrapperTest'); |
| 2 #import('../../../testing/unittest/unittest.dart'); |
| 3 #import('dart:dom'); |
| 4 |
| 5 main() { |
| 6 HTMLCanvasElement canvas; |
| 7 CanvasRenderingContext2D context; |
| 8 |
| 9 // FIXME: once main is run on content loaded, this hack won't be necessary. |
| 10 window.setTimeout(() { |
| 11 canvas = document.createElement('canvas'); |
| 12 canvas.id = 'canvas'; |
| 13 canvas.setAttribute('width', '100'); |
| 14 canvas.setAttribute('height', '100'); |
| 15 document.body.appendChild(canvas); |
| 16 context = canvas.getContext('2d'); |
| 17 }, 0); |
| 18 |
| 19 forLayoutTests(); |
| 20 test('DomType', () { |
| 21 Expect.isTrue(canvas is DOMType); |
| 22 Expect.isTrue(context is DOMType); |
| 23 }); |
| 24 test('ObjectLocalStorage', () { |
| 25 final element = document.getElementById('canvas'); |
| 26 element.dartObjectLocalStorage = 42; |
| 27 |
| 28 Expect.equals(42, canvas.dynamic.dartObjectLocalStorage); |
| 29 }); |
| 30 test('TypeName', () { |
| 31 final element = document.getElementById('canvas'); |
| 32 Expect.stringEquals('HTMLCanvasElement', element.typeName); |
| 33 Expect.stringEquals('HTMLCanvasElement', canvas.dynamic.typeName); |
| 34 Expect.stringEquals('CanvasRenderingContext2D', context.dynamic.typeName); |
| 35 }); |
| 36 } |
OLD | NEW |