Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(536)

Unified Diff: test/codegen/expect/lib/html/instance_of_test.js

Issue 2128353002: Check in codegen test expectations. (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: test/codegen/expect/lib/html/instance_of_test.js
diff --git a/test/codegen/expect/lib/html/instance_of_test.js b/test/codegen/expect/lib/html/instance_of_test.js
new file mode 100644
index 0000000000000000000000000000000000000000..be824a82e6ec1081497349609abfd26de45e620d
--- /dev/null
+++ b/test/codegen/expect/lib/html/instance_of_test.js
@@ -0,0 +1,64 @@
+dart_library.library('lib/html/instance_of_test', null, /* Imports */[
+ 'dart_sdk',
+ 'unittest'
+], function load__instance_of_test(exports, dart_sdk, unittest) {
+ 'use strict';
+ const core = dart_sdk.core;
+ const html = dart_sdk.html;
+ const dart = dart_sdk.dart;
+ const dartx = dart_sdk.dartx;
+ const src__matcher__core_matchers = unittest.src__matcher__core_matchers;
+ const html_config = unittest.html_config;
+ const unittest$ = unittest.unittest;
+ const src__matcher__expect = unittest.src__matcher__expect;
+ const src__matcher__operator_matchers = unittest.src__matcher__operator_matchers;
+ const instance_of_test = Object.create(null);
+ let ListOfint = () => (ListOfint = dart.constFn(core.List$(core.int)))();
+ let dynamicTobool = () => (dynamicTobool = dart.constFn(dart.definiteFunctionType(core.bool, [dart.dynamic])))();
+ let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [])))();
+ instance_of_test.main = function() {
+ let canvas = null;
+ canvas = html.CanvasElement._check(html.Element.tag('canvas'));
+ canvas[dartx.attributes][dartx.set]('width', '100');
+ canvas[dartx.attributes][dartx.set]('height', '100');
+ html.document[dartx.body][dartx.append](canvas);
+ let isCanvasRenderingContext = src__matcher__core_matchers.predicate(dart.fn(x => html.CanvasRenderingContext.is(x), dynamicTobool()), 'is a CanvasRenderingContext');
+ let isCanvasRenderingContext2D = src__matcher__core_matchers.predicate(dart.fn(x => html.CanvasRenderingContext2D.is(x), dynamicTobool()), 'is a CanvasRenderingContext2D');
+ let isElement = src__matcher__core_matchers.predicate(dart.fn(x => html.Element.is(x), dynamicTobool()), 'is an Element');
+ let isCanvasElement = src__matcher__core_matchers.predicate(dart.fn(x => html.CanvasElement.is(x), dynamicTobool()), 'is a CanvasElement');
+ let isImageData = src__matcher__core_matchers.predicate(dart.fn(x => html.ImageData.is(x), dynamicTobool()), 'is an ImageData');
+ let isIntList = src__matcher__core_matchers.predicate(dart.fn(x => ListOfint().is(x), dynamicTobool()), 'is a List<int>');
+ html_config.useHtmlConfiguration();
+ unittest$.test('Instanceof', dart.fn(() => {
+ src__matcher__expect.expect(canvas, src__matcher__operator_matchers.isNot(isCanvasRenderingContext));
+ src__matcher__expect.expect(canvas, src__matcher__operator_matchers.isNot(isCanvasRenderingContext2D));
+ src__matcher__expect.expect(canvas, isElement);
+ src__matcher__expect.expect(canvas, isCanvasElement);
+ src__matcher__expect.expect(canvas, src__matcher__operator_matchers.isNot(isImageData));
+ let context = html.CanvasRenderingContext2D._check(canvas[dartx.getContext]('2d'));
+ src__matcher__expect.expect(context, isCanvasRenderingContext);
+ src__matcher__expect.expect(context, isCanvasRenderingContext2D);
+ src__matcher__expect.expect(context, src__matcher__operator_matchers.isNot(isElement));
+ src__matcher__expect.expect(context, src__matcher__operator_matchers.isNot(isCanvasElement));
+ src__matcher__expect.expect(context, src__matcher__operator_matchers.isNot(isImageData));
+ let image = context[dartx.createImageData](canvas[dartx.width], core.num._check(canvas[dartx.height]));
+ src__matcher__expect.expect(image, src__matcher__operator_matchers.isNot(isCanvasRenderingContext));
+ src__matcher__expect.expect(image, src__matcher__operator_matchers.isNot(isCanvasRenderingContext2D));
+ src__matcher__expect.expect(image, src__matcher__operator_matchers.isNot(isElement));
+ src__matcher__expect.expect(image, src__matcher__operator_matchers.isNot(isCanvasElement));
+ src__matcher__expect.expect(image, isImageData);
+ let bytes = image[dartx.data];
+ src__matcher__expect.expect(bytes, src__matcher__operator_matchers.isNot(isCanvasRenderingContext));
+ src__matcher__expect.expect(bytes, src__matcher__operator_matchers.isNot(isCanvasRenderingContext2D));
+ src__matcher__expect.expect(bytes, src__matcher__operator_matchers.isNot(isElement));
+ src__matcher__expect.expect(bytes, src__matcher__operator_matchers.isNot(isCanvasElement));
+ src__matcher__expect.expect(bytes, src__matcher__operator_matchers.isNot(isImageData));
+ src__matcher__expect.expect(bytes, isIntList);
+ let span = html.Element.tag('span');
+ src__matcher__expect.expect(span, isElement);
+ }, VoidTodynamic()));
+ };
+ dart.fn(instance_of_test.main, VoidTodynamic());
+ // Exports:
+ exports.instance_of_test = instance_of_test;
+});
« no previous file with comments | « test/codegen/expect/lib/html/input_element_test.js ('k') | test/codegen/expect/lib/html/interactive_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698