From 1645ae4ae09efb5f7f2ebbebba9243474497dadb Mon Sep 17 00:00:00 2001 From: Marius Olbertz Date: Tue, 25 Apr 2017 07:42:14 +0200 Subject: [PATCH] Added test for focus on close. --- test/javascript/components/reveal.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/javascript/components/reveal.js b/test/javascript/components/reveal.js index b0c674985..58d2b74fb 100644 --- a/test/javascript/components/reveal.js +++ b/test/javascript/components/reveal.js @@ -278,6 +278,24 @@ describe('Reveal', function() { done(); }); + plugin.close(); + }); + it('sets focus to anchor', function(done) { + $html = $(template).appendTo('body'); + var $anchor = $('').appendTo('body'); + plugin = new Foundation.Reveal($html, {}); + + // Open it first + plugin.open(); + + $html.on('closed.zf.reveal', function() { + setTimeout(function() { + $anchor[0].should.be.equal(document.activeElement); + $anchor.remove(); + done(); + }, 0); + }); + plugin.close(); }); }); -- 2.47.2