Skip to content

Commit ef209d1

Browse files
committed
fixup: this intactness
1 parent eceefe1 commit ef209d1

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

packages/async-rewriter2/src/async-writer-babel.spec.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ describe('AsyncWriter', function () {
263263
).to.equal(1);
264264
});
265265

266-
it('does supports labeled break/switch', function () {
266+
it('supports labeled break/switch', function () {
267267
expect(
268268
runTranspiledCode(`
269269
let i,j;
@@ -275,6 +275,15 @@ describe('AsyncWriter', function () {
275275
}; i`)
276276
).to.equal(23);
277277
});
278+
279+
it.only('keeps `this` intact for function calls', function () {
280+
expect('({ foo: 42, method() { return this } }).method().foo').to.equal(
281+
42
282+
);
283+
expect(
284+
'({ foo: 42, method() { return this } })["method"]().foo'
285+
).to.equal(42);
286+
});
278287
});
279288

280289
context('implicit awaiting', function () {

0 commit comments

Comments
 (0)