OLD | NEW |
(Empty) | |
| 1 dart_library.library('lib/html/instance_of_test', null, /* Imports */[ |
| 2 'dart_sdk', |
| 3 'unittest' |
| 4 ], function load__instance_of_test(exports, dart_sdk, unittest) { |
| 5 'use strict'; |
| 6 const core = dart_sdk.core; |
| 7 const html = dart_sdk.html; |
| 8 const dart = dart_sdk.dart; |
| 9 const dartx = dart_sdk.dartx; |
| 10 const src__matcher__core_matchers = unittest.src__matcher__core_matchers; |
| 11 const html_config = unittest.html_config; |
| 12 const unittest$ = unittest.unittest; |
| 13 const src__matcher__expect = unittest.src__matcher__expect; |
| 14 const src__matcher__operator_matchers = unittest.src__matcher__operator_matche
rs; |
| 15 const instance_of_test = Object.create(null); |
| 16 let ListOfint = () => (ListOfint = dart.constFn(core.List$(core.int)))(); |
| 17 let dynamicTobool = () => (dynamicTobool = dart.constFn(dart.definiteFunctionT
ype(core.bool, [dart.dynamic])))(); |
| 18 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); |
| 19 instance_of_test.main = function() { |
| 20 let canvas = null; |
| 21 canvas = html.CanvasElement._check(html.Element.tag('canvas')); |
| 22 canvas[dartx.attributes][dartx.set]('width', '100'); |
| 23 canvas[dartx.attributes][dartx.set]('height', '100'); |
| 24 html.document[dartx.body][dartx.append](canvas); |
| 25 let isCanvasRenderingContext = src__matcher__core_matchers.predicate(dart.fn
(x => html.CanvasRenderingContext.is(x), dynamicTobool()), 'is a CanvasRendering
Context'); |
| 26 let isCanvasRenderingContext2D = src__matcher__core_matchers.predicate(dart.
fn(x => html.CanvasRenderingContext2D.is(x), dynamicTobool()), 'is a CanvasRende
ringContext2D'); |
| 27 let isElement = src__matcher__core_matchers.predicate(dart.fn(x => html.Elem
ent.is(x), dynamicTobool()), 'is an Element'); |
| 28 let isCanvasElement = src__matcher__core_matchers.predicate(dart.fn(x => htm
l.CanvasElement.is(x), dynamicTobool()), 'is a CanvasElement'); |
| 29 let isImageData = src__matcher__core_matchers.predicate(dart.fn(x => html.Im
ageData.is(x), dynamicTobool()), 'is an ImageData'); |
| 30 let isIntList = src__matcher__core_matchers.predicate(dart.fn(x => ListOfint
().is(x), dynamicTobool()), 'is a List<int>'); |
| 31 html_config.useHtmlConfiguration(); |
| 32 unittest$.test('Instanceof', dart.fn(() => { |
| 33 src__matcher__expect.expect(canvas, src__matcher__operator_matchers.isNot(
isCanvasRenderingContext)); |
| 34 src__matcher__expect.expect(canvas, src__matcher__operator_matchers.isNot(
isCanvasRenderingContext2D)); |
| 35 src__matcher__expect.expect(canvas, isElement); |
| 36 src__matcher__expect.expect(canvas, isCanvasElement); |
| 37 src__matcher__expect.expect(canvas, src__matcher__operator_matchers.isNot(
isImageData)); |
| 38 let context = html.CanvasRenderingContext2D._check(canvas[dartx.getContext
]('2d')); |
| 39 src__matcher__expect.expect(context, isCanvasRenderingContext); |
| 40 src__matcher__expect.expect(context, isCanvasRenderingContext2D); |
| 41 src__matcher__expect.expect(context, src__matcher__operator_matchers.isNot
(isElement)); |
| 42 src__matcher__expect.expect(context, src__matcher__operator_matchers.isNot
(isCanvasElement)); |
| 43 src__matcher__expect.expect(context, src__matcher__operator_matchers.isNot
(isImageData)); |
| 44 let image = context[dartx.createImageData](canvas[dartx.width], core.num._
check(canvas[dartx.height])); |
| 45 src__matcher__expect.expect(image, src__matcher__operator_matchers.isNot(i
sCanvasRenderingContext)); |
| 46 src__matcher__expect.expect(image, src__matcher__operator_matchers.isNot(i
sCanvasRenderingContext2D)); |
| 47 src__matcher__expect.expect(image, src__matcher__operator_matchers.isNot(i
sElement)); |
| 48 src__matcher__expect.expect(image, src__matcher__operator_matchers.isNot(i
sCanvasElement)); |
| 49 src__matcher__expect.expect(image, isImageData); |
| 50 let bytes = image[dartx.data]; |
| 51 src__matcher__expect.expect(bytes, src__matcher__operator_matchers.isNot(i
sCanvasRenderingContext)); |
| 52 src__matcher__expect.expect(bytes, src__matcher__operator_matchers.isNot(i
sCanvasRenderingContext2D)); |
| 53 src__matcher__expect.expect(bytes, src__matcher__operator_matchers.isNot(i
sElement)); |
| 54 src__matcher__expect.expect(bytes, src__matcher__operator_matchers.isNot(i
sCanvasElement)); |
| 55 src__matcher__expect.expect(bytes, src__matcher__operator_matchers.isNot(i
sImageData)); |
| 56 src__matcher__expect.expect(bytes, isIntList); |
| 57 let span = html.Element.tag('span'); |
| 58 src__matcher__expect.expect(span, isElement); |
| 59 }, VoidTodynamic())); |
| 60 }; |
| 61 dart.fn(instance_of_test.main, VoidTodynamic()); |
| 62 // Exports: |
| 63 exports.instance_of_test = instance_of_test; |
| 64 }); |
OLD | NEW |