From eb92735c9ea3e5ddc747b66d8e895b6187a5f9e0 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Thu, 16 Feb 2012 14:32:52 -0800 Subject: fix(injector) .instantiate([Type]) produced wrong result --- test/InjectorSpec.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test/InjectorSpec.js') diff --git a/test/InjectorSpec.js b/test/InjectorSpec.js index dea76a6b..df326580 100644 --- a/test/InjectorSpec.js +++ b/test/InjectorSpec.js @@ -605,6 +605,15 @@ describe('injector', function() { }); + it('should instantiate object and preserve constructor property and be instanceof', function() { + var t = $injector.instantiate(['book', 'author', Type]); + expect(t.book).toEqual('moby'); + expect(t.author).toEqual('melville'); + expect(t.title()).toEqual('melville: moby'); + expect(t instanceof Type).toBe(true); + }); + + it('should allow constructor to return different object', function() { var obj = {}; var Class = function() { -- cgit v1.2.3