From 27f518f7cfe7832d86fd6f36ae5e4a2859afcd4c Mon Sep 17 00:00:00 2001 From: aristov Date: Tue, 7 Apr 2015 00:01:14 +0300 Subject: [PATCH] add tests for proper destruct of popup --- common.blocks/dropdown/dropdown.spec.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/common.blocks/dropdown/dropdown.spec.js b/common.blocks/dropdown/dropdown.spec.js index 3a0a41b6b..1bbc193d6 100644 --- a/common.blocks/dropdown/dropdown.spec.js +++ b/common.blocks/dropdown/dropdown.spec.js @@ -1,7 +1,7 @@ modules.define( 'spec', - ['dropdown', 'i-bem__dom', 'jquery', 'BEMHTML'], - function(provide, Dropdown, BEMDOM, $, BEMHTML) { + ['dropdown', 'i-bem__dom', 'jquery', 'BEMHTML', 'sinon'], + function(provide, Dropdown, BEMDOM, $, BEMHTML, sinon) { describe('dropdown', function() { var body = $('body'), @@ -69,6 +69,17 @@ describe('dropdown', function() { .hasMod('opened').should.be.false; }); }); + + describe('destruct', function() { + it('should destruct properly', function() { + var spy = sinon.spy(); + + dropdown.getPopup().on({ modName : 'js', modVal : '' }, spy); + BEMDOM.destruct(dropdown.domElem); + + spy.should.have.been.calledOnce; + }); + }); }); provide();