From: Marius Olbertz Date: Tue, 25 Apr 2017 05:42:14 +0000 (+0200) Subject: Added test for focus on close. X-Git-Tag: v6.4.0-rc1~56^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F9977%2Fhead;p=thirdparty%2Ffoundation%2Ffoundation-sites.git Added test for focus on close. --- 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(); }); });