@@ -11,21 +11,21 @@ def to_js(string)
11
11
it "should extend modules" do
12
12
to_js ( 'module M; def f(); end; end;' +
13
13
'module M; def g(); end; end' ) .
14
- must_equal ( 'const M = {f: function () {}}; ' +
14
+ must_equal ( 'const M = {f() {}}; ' +
15
15
'M.g = function() {}' ) ;
16
16
end
17
17
18
18
it "should extend nested modules" do
19
19
to_js ( 'module M; module N; def f(); end; end; end;' +
20
20
'module M::N; def g(); end; end' ) .
21
- must_equal ( 'const M = {N: {f: function () {}}}; ' +
21
+ must_equal ( 'const M = {N: {f() {}}}; ' +
22
22
'M.N.g = function() {}' ) ;
23
23
end
24
24
25
25
it "should extend nested modules with getter" do
26
26
to_js ( 'module M; module N; def f(); end; end; end;' +
27
27
'module M::N; def g; end; end' ) .
28
- must_equal ( 'const M = {N: {f: function () {}}}; ' +
28
+ must_equal ( 'const M = {N: {f() {}}}; ' +
29
29
'Object.defineProperties(M.N, ' +
30
30
'Object.getOwnPropertyDescriptors({get g() {}}))' ) ;
31
31
end
@@ -46,5 +46,11 @@ def to_js(string)
46
46
'Object.defineProperty(M.N.prototype, "g", ' +
47
47
'{enumerable: true, configurable: true, get() {}})' ) ;
48
48
end
49
+
50
+ it "should bind references to methods defined in original class" do
51
+ to_js ( 'class C; def f(); end; end' +
52
+ 'class C; def g; f; end; end' ) .
53
+ must_include 'return this.f.bind(this)'
54
+ end
49
55
end
50
56
end
0 commit comments