diff --git a/src/slot-machine.js b/src/slot-machine.js index 2325ffa..b7dc65b 100644 --- a/src/slot-machine.js +++ b/src/slot-machine.js @@ -275,6 +275,14 @@ function SlotMachine(config) { this.startButton.addEventListener('click', start); }; + /** + * @function disable + * disable the instance of a SlotMachine + */ + this.disable = function() { + this.startButton.removeEventListener('click', start); + }; + } module.exports = SlotMachine; diff --git a/test/slot-machine.js b/test/slot-machine.js index 28e89b8..1d4c201 100644 --- a/test/slot-machine.js +++ b/test/slot-machine.js @@ -248,6 +248,12 @@ describe('SlotMachine', function() { }, 5000); }); + it('should disable the slotMachine', function() { + var spy = sinon.spy(slotMachine, 'disable'); + slotMachine.disable(); + assert.isTrue(spy.called); + }); + // it('should result in Jackpot, for tea', function(done) { // this.timeout(10000); // slotMachine.reels.forEach(function(reel) {