siesta-lite
Version:
Stress-free JavaScript unit testing and functional testing tool, works in NodeJS and browsers
29 lines (21 loc) • 806 B
JavaScript
// A mixin with some common functionality, which can be consumed by several test classes / combined with other mixins
Role('Your.Test.Role', {
has : {
roleAttribute1 : null,
roleAttribute2 : 'foo',
roleAttribute3 : 11
},
methods: {
// this method will be available in the class, that has consumed the role
// if class already has the "doSomething" method the definition from role will not be used
doSomething : function () {
}
},
override : {
// an "override method modifier" which will be applied to the "initialize" method in the consuming class
// the original method can be called with "this.SUPER(arg1, arg2, ...)"
initialize : function () {
this.SUPER()
}
}
});