Skip to content

Commit c8ddbef

Browse files
authored
#3180. Update existing interop tests (#3276)
1 parent f3ed888 commit c8ddbef

File tree

5 files changed

+26
-13
lines changed

5 files changed

+26
-13
lines changed

LibTest/js_interop/JS/js_A01_t10.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,13 @@
1515
import 'dart:js_interop';
1616

1717
class C {
18-
external int f1();
1918
}
2019

2120
mixin M {
22-
external int f1();
2321
}
2422

2523
enum E {
2624
e0;
27-
external int f1();
2825
}
2926

3027
@JS()

LibTest/js_interop/JSExport/jsExport_A03_t02.dart

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,40 @@
88
/// member.
99
///
1010
/// @description Checks that if a class is annotated with a `@JSExport`
11-
/// annotation with non empty `name`.
11+
/// annotation with non empty `name` then the value of `name` is ignored.
1212
/// @author [email protected]
13-
/// @issue 61084
13+
/// @issue 61084, 61289, 61291
1414
1515
import 'dart:js_interop';
16+
import 'dart:js_interop_unsafe';
17+
import '../../../Utils/expect.dart';
18+
import '../js_utils.dart';
19+
20+
String log = "";
1621

1722
@JSExport("D")
1823
class C {
19-
// ^
20-
// [analyzer] unspecified
21-
// [web] unspecified
2224
int variable = 42;
2325
String method(String v) => "method($v);";
2426
String get getter => "Some getter";
25-
void set setter(bool value) {}
27+
void set setter(bool value) {
28+
log = "setter($value);";
29+
}
2630
}
2731

2832
void main() {
29-
print(C);
33+
var c = C();
34+
var jsC = createJSInteropWrapper<C>(c);
35+
globalContext["jsC"] = jsC;
36+
eval(r'''
37+
globalThis.v1 = globalThis.jsC.variable;
38+
globalThis.v2 = globalThis.jsC.method('x');
39+
globalThis.v3 = globalThis.jsC.getter;
40+
globalThis.jsC.setter = false;
41+
42+
''');
43+
Expect.equals(42, (globalContext["v1"] as JSNumber).toDartInt);
44+
Expect.equals("method(x);", (globalContext["v2"] as JSString).toDart);
45+
Expect.equals("Some getter", (globalContext["v3"] as JSString).toDart);
46+
Expect.equals("setter(false);", log);
3047
}

LibTest/js_interop/interop_A01_t12.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
/// @description Check that default values of an external constructor of a JS
1212
/// interop type are ignored.
1313
/// @author [email protected]
14+
/// @issue 61289
1415
1516
import 'dart:js_interop';
1617
import '../../Utils/expect.dart';

LibTest/js_interop/interop_A07_t02.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
/// @description Check that default values of optional positional parameters
1414
/// are omitted.
1515
/// @author [email protected]
16+
/// @issue 61289
1617
1718
import 'dart:js_interop';
1819
import '../../Utils/expect.dart';

LibTest/js_interop/staticInterop_A01_t03.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ extension Ext on C {
4141
// ^^^
4242
// [analyzer] unspecified
4343
// [web] unspecified
44-
external String getString();
45-
external int getNumber();
46-
external bool getBool();
4744
}
4845

4946
main() {

0 commit comments

Comments
 (0)