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

Side by Side Diff: tests/html/js_interop_constructor_name_test.dart

Issue 2383273002: Revert "Add native_testing library to mock @Native classes" (Closed)
Patch Set: Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « tests/html/html.status ('k') | tests/html/js_interop_constructor_name_test.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 library jsTest;
6
7 import 'dart:async';
8 import 'dart:html' as html;
9 import 'dart:js';
10 import 'package:js/js.dart';
11
12 import 'package:unittest/unittest.dart';
13 import 'package:unittest/html_individual_config.dart';
14 import 'package:expect/expect.dart' show NoInline, AssumeDynamic;
15
16 @JS()
17 external makeDiv(String text);
18
19 @JS()
20 class HTMLDivElement {
21 external String bar();
22 }
23
24 @NoInline() @AssumeDynamic()
25 confuse(x) => x;
26
27 main() {
28 useHtmlIndividualConfiguration();
29
30 group('HTMLDivElement-types', () {
31 test('dom-is-dom', () {
32 var e = confuse(new html.DivElement());
33 expect(e is html.DivElement, isTrue);
34 });
35
36 test('js-is-dom', () {
37 var e = confuse(makeDiv('hello'));
38 expect(e is html.DivElement, isFalse);
39 });
40
41 test('js-is-js', () {
42 var e = confuse(makeDiv('hello'));
43 expect(e is HTMLDivElement, isTrue);
44 });
45
46 });
47
48 group('HTMLDivElement-types-erroneous1', () {
49 test('dom-is-js', () {
50 var e = confuse(new html.DivElement());
51 // TODO(26838): When Issue 26838 is fixed and this test passes, move this
52 // test into group `HTMLDivElement-types`.
53
54 // Currently, HTML types are not [JavaScriptObject]s. We could change that
55 // by having HTML types extend JavaScriptObject, in which case we would
56 // change this expectation.
57 expect(e is HTMLDivElement, isFalse);
58 });
59 });
60
61 group('HTMLDivElement-types-erroneous2', () {
62 test('String-is-not-js', () {
63 var e = confuse('kombucha');
64 // TODO(26838): When Issue 26838 is fixed and this test passes, move this
65 // test into group `HTMLDivElement-types`.
66
67 // A String should not be a JS interop type. The type test flags are added
68 // to Interceptor, but should be added to the class that implements all
69 // the JS-interop methods.
70 expect(e is HTMLDivElement, isFalse);
71 });
72 });
73
74
75 group('HTMLDivElement-methods', () {
76
77 test('js-call-js-method', () {
78 var e = confuse(makeDiv('hello'));
79 expect(e.bar(), equals('hello'));
80 });
81
82 test('dom-call-js-method', () {
83 var e = confuse(new html.DivElement());
84 expect(() => e.bar(), throws);
85 });
86
87 test('js-call-dom-method', () {
88 var e = confuse(makeDiv('hello'));
89 expect(() => e.clone(false), throws);
90 });
91
92 test('dom-call-dom-method', () {
93 var e = confuse(new html.DivElement());
94 expect(e.clone(false), new isInstanceOf<html.DivElement>());
95 });
96
97 });
98 }
OLDNEW
« no previous file with comments | « tests/html/html.status ('k') | tests/html/js_interop_constructor_name_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698