Extended existing visibility tests to include methods
parent
38c16048cb
commit
02d0c07f98
|
@ -30,11 +30,19 @@ var common = require( './common' ),
|
||||||
prot = 'bar',
|
prot = 'bar',
|
||||||
priv = 'baz',
|
priv = 'baz',
|
||||||
|
|
||||||
|
pubf = function() {},
|
||||||
|
protf = function() {},
|
||||||
|
privf = function() {},
|
||||||
|
|
||||||
// new anonymous class instance
|
// new anonymous class instance
|
||||||
foo = Class.extend( {
|
foo = Class.extend( {
|
||||||
'public pub': pub,
|
'public pub': pub,
|
||||||
'protected peeps': prot,
|
'protected peeps': prot,
|
||||||
'private parts': priv,
|
'private parts': priv,
|
||||||
|
|
||||||
|
'public pubf': pubf,
|
||||||
|
'protected protf': protf,
|
||||||
|
'private privf': privf,
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,6 +53,12 @@ var common = require( './common' ),
|
||||||
pub,
|
pub,
|
||||||
"Public properties are accessible via public interface"
|
"Public properties are accessible via public interface"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
assert.equal(
|
||||||
|
foo.pubf,
|
||||||
|
pubf,
|
||||||
|
"Public methods are accessible via public interface"
|
||||||
|
);
|
||||||
} )();
|
} )();
|
||||||
|
|
||||||
|
|
||||||
|
@ -61,5 +75,17 @@ var common = require( './common' ),
|
||||||
undefined,
|
undefined,
|
||||||
"Private properties are inaccessible via public interface"
|
"Private properties are inaccessible via public interface"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
assert.equal(
|
||||||
|
foo.protf,
|
||||||
|
undefined,
|
||||||
|
"Protected methods are inaccessible via public interface"
|
||||||
|
);
|
||||||
|
|
||||||
|
assert.equal(
|
||||||
|
foo.privf,
|
||||||
|
undefined,
|
||||||
|
"Private methods are inaccessible via public interface"
|
||||||
|
);
|
||||||
} )();
|
} )();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue