From b7ccd984d18d201931dfde0084da28c72fc7f696 Mon Sep 17 00:00:00 2001 From: Nicolas Coden Date: Fri, 27 Apr 2018 23:59:38 +0200 Subject: [PATCH] chore: clean component after DropdownMenu tests #11074 Closes https://github.com/zurb/foundation-sites/issues/11074 --- test/javascript/components/dropdownMenu.js | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/test/javascript/components/dropdownMenu.js b/test/javascript/components/dropdownMenu.js index 248fff807..bd91d8dd5 100644 --- a/test/javascript/components/dropdownMenu.js +++ b/test/javascript/components/dropdownMenu.js @@ -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 +}); -- 2.47.2