$html = $(template).appendTo('body');
plugin = new Foundation.OffCanvas($html.find('[data-off-canvas]'), {});
- $html.one('opened.zf.offCanvas', function() {
+ $html.one('openedEnd.zf.offCanvas', function() {
+ $html.one('closed.zf.offCanvas', function () {
+ plugin.$element.should.not.have.class('is-open');
+ done();
+ });
plugin.toggle();
-
- plugin.$element.should.not.have.class('is-open');
- done();
});
// Open it first
.trigger(window.mockKeyboardEvent('ESCAPE'));
plugin.$element.should.not.have.class('is-open');
- done();
+ $html.one('closed.zf.offCanvas', function () {
+ done();
+ });
});
// Open it first