]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
chore: clean focus after tests involving focus
authorNicolas Coden <nicolas@ncoden.fr>
Sat, 28 Apr 2018 15:54:55 +0000 (17:54 +0200)
committerNicolas Coden <nicolas@ncoden.fr>
Sat, 28 Apr 2018 15:54:55 +0000 (17:54 +0200)
See https://github.com/zurb/foundation-sites/issues/11074

test/javascript/components/accordion.js
test/javascript/components/drilldown.js
test/javascript/components/dropdown.js
test/javascript/components/dropdownMenu.js
test/javascript/components/offcanvas.js
test/javascript/components/reveal.js
test/javascript/util/keyboard.js

index 5ee78e112f04fe644fc2386866343fabb719ff4d..362a8fef197f902a78177e0ff1e2ce4288a2877d 100644 (file)
@@ -27,6 +27,7 @@ describe('Accordion', function() {
 
   afterEach(function() {
     plugin.destroy();
+    document.activeElement.blur();
     $html.remove();
   });
 
@@ -139,7 +140,7 @@ describe('Accordion', function() {
       $html.find('.accordion-content').eq(0).should.have.attr('aria-hidden', 'false');
     });
   });
-  
+
   describe('keyboard events', function() {
     it('opens next panel on ARROW_DOWN', function() {
       $html = $(template).appendTo('body');
@@ -186,4 +187,4 @@ describe('Accordion', function() {
       $html.find('.accordion-content').eq(1).should.have.attr('aria-hidden', 'false');
     });
   });
-});
\ No newline at end of file
+});
index 7c13921a1aa8309d913c2642488f81f546284246..d3e83187ec448a8152c11e758b9ee2b9ed6c1345 100644 (file)
@@ -28,6 +28,7 @@ describe('Drilldown Menu', function() {
 
   afterEach(function() {
     plugin.destroy();
+    document.activeElement.blur();
     $html.remove();
   });
 
@@ -177,7 +178,7 @@ describe('Drilldown Menu', function() {
 
       // Open one first
       plugin._show($html.find('li.is-drilldown-submenu-parent').eq(2));
-      
+
       $html.one('closed.zf.drilldown', function() {
         $html.find('ul[data-submenu].is-active').each(function() {
           // Checking with .be.hidden is not possible because they don't have display: block but z-index: -1
@@ -310,7 +311,7 @@ describe('Drilldown Menu', function() {
 
       $html.find('> li:nth-child(1) > a').focus()
         .trigger(window.mockKeyboardEvent('ARROW_RIGHT'));
-      
+
       setTimeout(function() { // Timeout to make sure transition has ended
         $html.find('> li:nth-child(1) > ul > li[data-is-parent-link] a')[0].should.be.equal(document.activeElement);
         done();
@@ -329,4 +330,4 @@ describe('Drilldown Menu', function() {
       $html.find('> li:nth-child(1) > ul').should.have.class('is-closing');
     });
   });
-});
\ No newline at end of file
+});
index 9f7696a2410a9496be9cf5e59b58cee1350f4f25..e0331b06039c1a2aca3720b62fafd383521107f0 100644 (file)
@@ -17,6 +17,7 @@ describe('Dropdown', function() {
 
   afterEach(function() {
     plugin.destroy();
+    document.activeElement.blur();
     $dropdownController.remove();
     $dropdownContainer.remove();
   });
index bd91d8dd54767dcc24b44268f26cce5c1c25fd99..e988855200e5d6ee9f56fc1cbfa5674686283593 100644 (file)
@@ -42,6 +42,7 @@ describe('Dropdown Menu', function () {
 
   afterEach(function () {
     plugin.destroy();
+    document.activeElement.blur();
     $html.remove();
   });
 
index c6fb3e4e171a74c15aef291511ebe670d04c4617..12526d8bac2080396b096184b28623c7c8b34b97 100644 (file)
@@ -34,6 +34,7 @@ describe('Off Canvas', function() {
 
   afterEach(function() {
     plugin.destroy();
+    document.activeElement.blur();
     $html.remove();
   });
 
@@ -252,7 +253,7 @@ describe('Off Canvas', function() {
       plugin.toggle();
     });
   });
-  
+
   describe('keyboard events', function() {
     it('closes Off Canvas on ESCAPE', function(done) {
       $html = $(template).appendTo('body');
index 5e38b431b9de8ed7aa6a54c3074fe78ba67a5137..1c20797a8ec1dacd08bb0e9436398c75bfa551fc 100644 (file)
@@ -10,6 +10,7 @@ describe('Reveal', function() {
 
   afterEach(function() {
     plugin.destroy();
+    document.activeElement.blur();
     $html.remove();
   });
 
index ecec0f5206d59c4c23dbf0f570f746cc4cbb3321..836c69a0c8d6134e7b4fa1e6b3841dd29cd4f3d3 100644 (file)
@@ -19,6 +19,10 @@ describe('Keyboard util', function() {
     'ARROW_DOWN': 40
   };
 
+  afterEach(function() {
+    document.activeElement.blur();
+  });
+
   it('exists on the Foundation API', function() {
     (window.Foundation.Keyboard).should.be.an('object');
   });