Skip to content

Commit

Permalink
test: even more param / ctx
Browse files Browse the repository at this point in the history
  • Loading branch information
buschtoens committed Aug 6, 2019
1 parent 2ce5abb commit 66830d7
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions tests/unit/decorators-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ module('Unit | decorators', function() {
assert.expect(5);

class TestSubject extends EmberObject {
readonly someProperty = 123;

@task
doStuff = task(function*() {
doStuff = task(function*(this: TestSubject) {
yield;
return 123;
return this.someProperty;
});

@task
Expand Down Expand Up @@ -117,22 +119,22 @@ module('Unit | decorators', function() {
@task
encapsulated = task({
privateState: 56,
*perform() {
*perform(_foo: string) {
yield;
return this.privateState;
return this.privateState; // @TODO: broken
}
});
}

let subject!: TestSubject;
run(() => {
subject = TestSubject.create();
subject.get('encapsulated').perform();
subject.get('encapsulated').perform('abc');
});
assert.equal(
subject
.get('encapsulated')
.get('last')
.get('last')!
.get('value'),
56
);
Expand Down

0 comments on commit 66830d7

Please sign in to comment.