Skip to content

Commit

Permalink
Removed old implementation of property injection (inversify#337)
Browse files Browse the repository at this point in the history
  • Loading branch information
remojansen authored Aug 10, 2016
1 parent 03b3451 commit 9f19a82
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 616 deletions.
90 changes: 0 additions & 90 deletions src/annotation/property_injectors.ts

This file was deleted.

10 changes: 0 additions & 10 deletions src/inversify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ import targetName from "./annotation/target_name";
import { decorate } from "./annotation/decorator_utils";
import { traverseAncerstors, taggedConstraint, namedConstraint, typeConstraint } from "./syntax/constraint_helpers";
import guid from "./utils/guid";
import {
makePropertyInjectDecorator,
makePropertyMultiInjectDecorator,
makePropertyInjectTaggedDecorator,
makePropertyInjectNamedDecorator
} from "./annotation/property_injectors";

export { Kernel };
export { KernelModule };
Expand All @@ -30,10 +24,6 @@ export { tagged };
export { named };
export { inject };
export { unmanaged };
export { makePropertyInjectDecorator };
export { makePropertyMultiInjectDecorator };
export { makePropertyInjectTaggedDecorator };
export { makePropertyInjectNamedDecorator };
export { multiInject };
export { targetName };
export { traverseAncerstors };
Expand Down
124 changes: 0 additions & 124 deletions test/annotation/property_injectors.test.ts

This file was deleted.

39 changes: 1 addition & 38 deletions test/bugs/bugs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import {
Kernel,
injectable,
named,
inject,
makePropertyInjectNamedDecorator
inject
} from "../../src/inversify";

describe("Bugs", () => {
Expand Down Expand Up @@ -65,42 +64,6 @@ describe("Bugs", () => {

});

it("Should not throw when args length of base and derived class match (property injection)", () => {

let kernel = new Kernel();
let injectNamed = makePropertyInjectNamedDecorator(kernel);

@injectable()
class Warrior {
protected rank: string;
public constructor() { // length = 0
}
}

let TYPES = { Rank: "Rank" };

@injectable()
class SamuraiMaster extends Warrior {

@injectNamed(TYPES.Rank, "master")
@named("master")
protected rank: string;

public constructor() { // length = 0
super();
}
}

kernel.bind<SamuraiMaster>(SamuraiMaster).to(SamuraiMaster);
kernel.bind<string>(TYPES.Rank)
.toConstantValue("master")
.whenTargetNamed("master");

let master: any = kernel.get<SamuraiMaster>(SamuraiMaster);
expect(master.rank).eql("master");

});

it("Should not throw when args length of base and derived class match (inject into the derived class)", () => {

@injectable()
Expand Down
Loading

0 comments on commit 9f19a82

Please sign in to comment.