Skip to content

Commit c166690

Browse files
committed
fixup: this intactness
1 parent c7a4555 commit c166690

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
@@ -276,7 +276,7 @@ describe('AsyncWriter', function () {
276276
).to.equal(1);
277277
});
278278

279-
it('does supports labeled break/switch', function () {
279+
it('supports labeled break/switch', function () {
280280
expect(
281281
runTranspiledCode(`
282282
let i,j;
@@ -288,6 +288,15 @@ describe('AsyncWriter', function () {
288288
}; i`)
289289
).to.equal(23);
290290
});
291+
292+
it.only('keeps `this` intact for function calls', function () {
293+
expect('({ foo: 42, method() { return this } }).method().foo').to.equal(
294+
42
295+
);
296+
expect(
297+
'({ foo: 42, method() { return this } })["method"]().foo'
298+
).to.equal(42);
299+
});
291300
});
292301

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

0 commit comments

Comments
 (0)