]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
chore: clean component after DropdownMenu tests #11074
authorNicolas Coden <nicolas@ncoden.fr>
Fri, 27 Apr 2018 21:59:38 +0000 (23:59 +0200)
committerNicolas Coden <nicolas@ncoden.fr>
Fri, 27 Apr 2018 21:59:38 +0000 (23:59 +0200)
Closes https://github.com/zurb/foundation-sites/issues/11074

test/javascript/components/dropdownMenu.js

index 248fff807a05be362dd69466d6ad01c1df8b043d..bd91d8dd54767dcc24b44268f26cce5c1c25fd99 100644 (file)
@@ -93,7 +93,7 @@ describe('Dropdown Menu', function () {
 
         $html.find('> li:nth-child(1)').should.have.class('is-active');
         $html.find('> li:nth-child(1) > ul').should.have.class('js-dropdown-active');
-        document.activeElement.should.be.equal($html.find('> li:nth-child(1) > ul > li:nth-child(1) > a')[0]); 
+        document.activeElement.should.be.equal($html.find('> li:nth-child(1) > ul > li:nth-child(1) > a')[0]);
       });
       it('moves focus to previous sub element on ARROW_UP', function () {
         // Open it first
@@ -113,7 +113,7 @@ describe('Dropdown Menu', function () {
 
         $html.find('> li:nth-child(1) > ul > li:nth-child(2)').should.have.class('is-active');
         $html.find('> li:nth-child(1) > ul > li:nth-child(2) > ul').should.have.class('js-dropdown-active');
-        document.activeElement.should.be.equal($html.find('> li:nth-child(1) > ul > li:nth-child(2) > ul > li:nth-child(1) > a')[0]);  
+        document.activeElement.should.be.equal($html.find('> li:nth-child(1) > ul > li:nth-child(2) > ul > li:nth-child(1) > a')[0]);
       });
     });
     describe('vertical', function() {
@@ -139,13 +139,9 @@ describe('Dropdown Menu', function () {
 
         $html.find('> li:nth-child(1)').should.have.class('is-active');
         $html.find('> li:nth-child(1) > ul').should.have.class('js-dropdown-active');
-        document.activeElement.should.be.equal($html.find('> li:nth-child(1) > ul > li:nth-child(1) > a')[0]); 
+        document.activeElement.should.be.equal($html.find('> li:nth-child(1) > ul > li:nth-child(1) > a')[0]);
       });
       it('moves focus to previous sub element on ARROW_UP', function () {
-        $html = $(template).appendTo('body');
-        plugin = new Foundation.DropdownMenu($html, {});
-
-        // Open it first
         plugin._show($html.find('> li:nth-child(1) > ul'));
 
         $html.find('> li:nth-child(1) > ul > li:nth-child(2) > a').focus()
@@ -154,10 +150,6 @@ describe('Dropdown Menu', function () {
         document.activeElement.should.be.equal($html.find('> li:nth-child(1) > ul > li:nth-child(1) > a')[0]);
       });
       it('opens child element of sub menu on ARROW_RIGHT', function() {
-        $html = $(template).appendTo('body');
-        plugin = new Foundation.DropdownMenu($html, {});
-
-        // Open it first
         plugin._show($html.find('> li:nth-child(1) > ul'));
 
         $html.find('> li:nth-child(1) > ul > li:nth-child(2) > a').focus()
@@ -165,8 +157,8 @@ describe('Dropdown Menu', function () {
 
         $html.find('> li:nth-child(1) > ul > li:nth-child(2)').should.have.class('is-active');
         $html.find('> li:nth-child(1) > ul > li:nth-child(2) > ul').should.have.class('js-dropdown-active');
-        document.activeElement.should.be.equal($html.find('> li:nth-child(1) > ul > li:nth-child(2) > ul > li:nth-child(1) > a')[0]);  
+        document.activeElement.should.be.equal($html.find('> li:nth-child(1) > ul > li:nth-child(2) > ul > li:nth-child(1) > a')[0]);
       });
     });
   });
-});
\ No newline at end of file
+});