From b3c02b25145ae54fb3719efce70c01d38b942c4f Mon Sep 17 00:00:00 2001 From: Eric Defore Date: Mon, 12 Oct 2020 16:43:28 -0400 Subject: [PATCH] test: add tabindex test for findFocusable() Added a test for the sorting element of Keyboard.findFocusable() to ensure tabindex sorting works properly --- test/javascript/util/keyboard.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/javascript/util/keyboard.js b/test/javascript/util/keyboard.js index 836c69a0c..a9b4860e0 100644 --- a/test/javascript/util/keyboard.js +++ b/test/javascript/util/keyboard.js @@ -177,6 +177,20 @@ describe('Keyboard util', function() { $html.remove(); }); + + it('does sort by tabindex', function() { + let $html = $(`
+ Link1 + Link3 + Link2 +
`).appendTo('body'); + + let $focusable = Foundation.Keyboard.findFocusable($html); + + $focusable.eq(2)[0].should.be.equal($html.find('a').eq(1)[0]); + + $html.remove(); + }); }); describe('trapFocus()', function() { -- 2.47.2