EventEmitter extension testing

This is a test for EventEmitter v3.1.5.

by Oliver Caldwell

HTML

<script src="https://raw.github.com/Wolfy87/EventEmitter/master/src/EventEmitter.js"></script>

JavaScript

// Just a test function
function test(name, a, b) {
    console.log('"' + name + '" should equal "' + b + '". It is "' + a + '".');
}

// Class that extends EventEmitter
var ExtraEE = function() {
    // Call the parent constructor on this class
    EventEmitter.apply(this);
};

// Clone the original prototype
ExtraEE.prototype = EventEmitter.extend();

// Add a new method
ExtraEE.prototype.foo = function() {
    return 'bar';
};

// Test it with some instances
var normal = new EventEmitter(),
    extended = new ExtraEE();

test('typeof normal.foo', typeof normal.foo, 'undefined');
test('typeof extended.foo', typeof extended.foo, 'function');
test('extended.foo()', extended.foo(), 'bar');