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

Unified Diff: tests/html/js_typed_interop_bind_this_test.dart

Issue 2168493002: Regression tests for 25658 and 24817. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Regression tests for 25658 and 24817. 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
« no previous file with comments | « tests/html/html.status ('k') | tests/html/js_typed_interop_window_property_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/html/js_typed_interop_bind_this_test.dart
diff --git a/tests/html/js_typed_interop_bind_this_test.dart b/tests/html/js_typed_interop_bind_this_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..d241cb9ee4a2dfc7958dfcb8cadca66efdb6360e
--- /dev/null
+++ b/tests/html/js_typed_interop_bind_this_test.dart
@@ -0,0 +1,53 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+@JS()
+library js_typed_interop_bind_this_test;
+
+import 'dart:html';
+
+import 'package:js/js.dart';
+import 'package:unittest/unittest.dart';
+import 'package:unittest/html_config.dart';
+import 'package:unittest/html_individual_config.dart';
+
+// This is a regression test for https://github.com/dart-lang/sdk/issues/25658
+
+_injectJs() {
+ document.body.append(new ScriptElement()
+ ..type = 'text/javascript'
+ ..innerHtml = r"""
+ "use strict";
+
+ function JsTest() {
+ }
+
+ JsTest.returnThis = function(name, value) {
+ return this;
+ };
+""");
+}
+
+@JS('JsTest.returnThis')
+external returnThis([name, value]);
+
+@JS('JsTest')
+external get jsTestObject;
+
+@JS('window')
+external get jsWindow;
+
+main() {
+ _injectJs();
+
+ useHtmlIndividualConfiguration();
+
+ group('bind this', () {
+ test('simple', () {
+ expect(identical(returnThis(), jsWindow), isFalse);
+ expect(identical(returnThis(), null), isFalse);
+ expect(identical(returnThis(), jsTestObject), isTrue);
+ });
+ });
+}
« no previous file with comments | « tests/html/html.status ('k') | tests/html/js_typed_interop_window_property_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698