]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Added test for focus on close. 9977/head
authorMarius Olbertz <marius.olbertz@gmail.com>
Tue, 25 Apr 2017 05:42:14 +0000 (07:42 +0200)
committerMarius Olbertz <marius.olbertz@gmail.com>
Tue, 25 Apr 2017 05:42:14 +0000 (07:42 +0200)
test/javascript/components/reveal.js

index b0c6749858ed31dab6f5ffcd8f84dd82678a159a..58d2b74fbf75e749d7cd6ecd04958ea372f5ab21 100644 (file)
@@ -278,6 +278,24 @@ describe('Reveal', function() {
         done();
       });
 
+      plugin.close();
+    });
+    it('sets focus to anchor', function(done) {
+      $html = $(template).appendTo('body');
+      var $anchor = $('<button data-open="exampleModal1">Open</button>').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();
     });
   });