From: Marius Olbertz Date: Sat, 7 Oct 2017 19:14:50 +0000 (+0200) Subject: Added tests for #10604. X-Git-Tag: v6.6.0~3^2~335^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9e8535ab2;p=thirdparty%2Ffoundation%2Ffoundation-sites.git Added tests for #10604. --- diff --git a/test/javascript/components/reveal.js b/test/javascript/components/reveal.js index 23908548b..5e38b431b 100644 --- a/test/javascript/components/reveal.js +++ b/test/javascript/components/reveal.js @@ -296,6 +296,27 @@ describe('Reveal', function() { }, 0); }); + plugin.close(); + }); + it('sets focus to anchor that opened it', function(done) { + $html = $(template).appendTo('body'); + var $anchor = $('').appendTo('body'); + var $anchor2 = $('').appendTo('body'); + plugin = new Foundation.Reveal($html, {}); + $anchor.focus(); + + // Open it first + plugin.open(); + + $html.on('closed.zf.reveal', function() { + setTimeout(function() { + $anchor[0].should.be.equal(document.activeElement); + $anchor.remove(); + $anchor2.remove(); + done(); + }, 0); + }); + plugin.close(); }); });