mirror of
https://github.com/sorenisanerd/gotty.git
synced 2024-11-09 23:34:26 +00:00
c66ae7b2e4
Launch an Xspice and run: echo -ne "\033]844;127.0.0.1;9876\007" This will launch a SPiCE client connecting to 127.0.0.1:9876. Still need to add all the security stuff and generally be more defensive in the implementation.
70 lines
1.8 KiB
JavaScript
70 lines
1.8 KiB
JavaScript
suite('EventObject', function() {
|
|
setup(function() {
|
|
wdi.Debug.debug = false; //disable debugging, it slows tests
|
|
});
|
|
|
|
suite('#addListener()', function() {
|
|
setup(function () {
|
|
this.eo = new wdi.EventObject();
|
|
});
|
|
|
|
test('Should add event to list', function() {
|
|
this.eo.addListener('test', function(){});
|
|
assert.strictEqual(this.eo.getListenersLength("test"), 1);
|
|
});
|
|
|
|
test('Should add two event to list', function() {
|
|
this.eo.addListener('test', function(){});
|
|
this.eo.addListener('test', function(){});
|
|
assert.strictEqual(this.eo.getListenersLength("test"), 2);
|
|
});
|
|
});
|
|
|
|
suite('#removeEvent()', function() {
|
|
setup(function() {
|
|
this.eo = new wdi.EventObject();
|
|
this.eo.addListener('test', function() {});
|
|
this.eo.addListener('test', function() {});
|
|
this.eo.addListener('test2', function() {});
|
|
});
|
|
|
|
test('Should remove correct event', function() {
|
|
this.eo.removeEvent('test');
|
|
assert.notProperty(this.eo.eyeEvents, 'test');
|
|
});
|
|
});
|
|
|
|
suite('#clearEvents()', function() {
|
|
setup(function() {
|
|
this.eo = new wdi.EventObject();
|
|
this.eo.addListener('test', function(){});
|
|
this.eo.addListener('test', function(){});
|
|
this.eo.addListener('test', function(){});
|
|
});
|
|
|
|
test('Should remove all events and listeners', function() {
|
|
this.eo.clearEvents();
|
|
assert.strictEqual(this.eo.getListenersLength('test'), 0);
|
|
});
|
|
});
|
|
|
|
suite('#fire()', function() {
|
|
setup(function() {
|
|
this.eo = new wdi.EventObject();
|
|
this.callback = sinon.spy();
|
|
this.eo.addListener('test', this.callback, this);
|
|
this.eo.addListener('test', this.callback, this);
|
|
});
|
|
|
|
test('Should trigger selected event', function() {
|
|
this.eo.fire('test');
|
|
assert(this.callback.calledTwice);
|
|
});
|
|
|
|
test('Should keep scope', function() {
|
|
this.eo.fire('test');
|
|
assert(this.callback.calledOn(this));
|
|
});
|
|
});
|
|
});
|