From 7c601876b90e0285566addee15aeb3835db7b8fa Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 18 Dec 2016 22:36:50 -0600 Subject: [PATCH] Add `Benchmark#reset` test for default event handlers. --- test/test.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/test.js b/test/test.js index 1be8c355..1092fc8f 100644 --- a/test/test.js +++ b/test/test.js @@ -478,6 +478,25 @@ /*--------------------------------------------------------------------------*/ + QUnit.module('Benchmark#reset'); + + (function() { + QUnit.test('should not reset default event handlers', function(assert) { + var handler = function() {}; + Benchmark.options.onStart = handler; + + var bench = Benchmark(), + clone = bench.clone({ 'events': { 'cycle': [function() {}] } }); + + clone.reset(); + + assert.deepEqual(clone.events, { 'start': [handler] }); + delete Benchmark.options.onStart; + }); + }()); + + /*--------------------------------------------------------------------------*/ + QUnit.module('Benchmark#run'); (function() {