From 9e8535ab2d5f62eb51fe4b9435031d37941757f4 Mon Sep 17 00:00:00 2001 From: Marius Olbertz Date: Sat, 7 Oct 2017 21:14:50 +0200 Subject: [PATCH] Added tests for #10604. --- test/javascript/components/reveal.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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(); }); }); -- 2.47.3