Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
kevmoo committed Feb 16, 2024
1 parent a3f05ec commit 8af65d1
Show file tree
Hide file tree
Showing 12 changed files with 1,327 additions and 3,185 deletions.
3 changes: 2 additions & 1 deletion pkgs/test/lib/src/runner/browser/compilers/dart2js.dart
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,14 @@ class Dart2JsSupport extends CompilerSupport with JsHtmlWrapper {
var jsPath = p.join(dir, '${p.basename(dartPath)}.browser_test.dart.js');
var bootstrapContent = '''
${suiteConfig.metadata.languageVersionComment ?? await rootPackageLanguageVersionComment}
import 'dart:js_interop';
import 'package:test/src/bootstrap/browser.dart';
import 'package:test/src/runner/browser/dom.dart' as dom;
import '${await absoluteUri(dartPath)}' as test;
void main() {
dom.window.console.log(r'Startup for test path $dartPath');
dom.window.console.log(r'Startup for test path $dartPath'.toJS);
internalBootstrapBrowserTest(() => test.main);
}
''';
Expand Down
9 changes: 4 additions & 5 deletions pkgs/test/lib/src/runner/browser/dom.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
// 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.

import 'dart:js_interop';
import 'dart:js_util' as js_util;

import 'package:js/js.dart';

@JS()
@staticInterop
class Window extends EventTarget {}
Expand Down Expand Up @@ -38,8 +37,8 @@ external Window get window;
class Console {}

extension ConsoleExtension on Console {
external void log(Object? object);
external void warn(Object? object);
external void log(JSString object);
external void warn(JSString object);
}

@JS()
Expand Down Expand Up @@ -238,7 +237,7 @@ HTMLIFrameElement createHTMLIFrameElement() =>
class WebSocket extends EventTarget {}

extension WebSocketExtension on WebSocket {
external void send(Object? data);
external void send(JSAny? data);
}

WebSocket createWebSocket(String url) =>
Expand Down
3 changes: 2 additions & 1 deletion pkgs/test/lib/src/runner/browser/post_message_channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// 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.

import 'dart:js_interop';
import 'dart:js_util';

import 'package:stream_channel/stream_channel.dart';
Expand All @@ -13,7 +14,7 @@ import 'dom.dart' as dom;
///
/// Sends a [MessagePort] to the host page for the channel.
StreamChannel<Object?> postMessageChannel() {
dom.window.console.log('Suite starting, sending channel to host');
dom.window.console.log('Suite starting, sending channel to host'.toJS);
var controller = StreamChannelController<Object?>(sync: true);
var channel = dom.createMessageChannel();
dom.window.parent
Expand Down
Loading

0 comments on commit 8af65d1

Please sign in to comment.