Can initialize member object with existing objects for each level of visibility
parent
96cee9660b
commit
2205af8c07
|
@ -31,12 +31,12 @@
|
||||||
*
|
*
|
||||||
* @return {{public: Object, protected: Object, private: Object}}
|
* @return {{public: Object, protected: Object, private: Object}}
|
||||||
*/
|
*/
|
||||||
exports.initMembers = function()
|
exports.initMembers = function( mpublic, mprotected, mprivate )
|
||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
'public': {},
|
'public': mpublic || {},
|
||||||
'protected': {},
|
'protected': mprotected || {},
|
||||||
'private': {},
|
'private': mprivate || {},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -37,3 +37,32 @@ var common = require( './common' ),
|
||||||
);
|
);
|
||||||
} )();
|
} )();
|
||||||
|
|
||||||
|
|
||||||
|
( function testCanInitMembersWithExistingObjects()
|
||||||
|
{
|
||||||
|
var pub = { foo: 'bar' },
|
||||||
|
pro = { bar: 'baz' },
|
||||||
|
priv = { baz: 'foo' },
|
||||||
|
|
||||||
|
members = builder.initMembers( pub, pro, priv )
|
||||||
|
;
|
||||||
|
|
||||||
|
assert.deepEqual(
|
||||||
|
members[ 'public' ],
|
||||||
|
pub,
|
||||||
|
"Can specify object to use for public members"
|
||||||
|
);
|
||||||
|
|
||||||
|
assert.deepEqual(
|
||||||
|
members[ 'protected' ],
|
||||||
|
pro,
|
||||||
|
"Can specify object to use for protected members"
|
||||||
|
);
|
||||||
|
|
||||||
|
assert.deepEqual(
|
||||||
|
members[ 'private' ],
|
||||||
|
priv,
|
||||||
|
"Can specify object to use for private members"
|
||||||
|
);
|
||||||
|
} )();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue