From a1c3c35727f926a16fff38ed674691a7892615e6 Mon Sep 17 00:00:00 2001 From: Marius Olbertz Date: Wed, 19 Apr 2017 17:12:56 +0200 Subject: [PATCH] Added tests for home and end keyboard events. --- test/javascript/components/slider.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/javascript/components/slider.js b/test/javascript/components/slider.js index 22c900357..ffca592fc 100644 --- a/test/javascript/components/slider.js +++ b/test/javascript/components/slider.js @@ -153,4 +153,24 @@ describe('Slider', function() { }); }); + describe('keyboard events', function() { + it('sets value to minimum using HOME', function() { + $html = $(template).appendTo('body'); + plugin = new Foundation.Slider($html, {}); + + plugin.$handle.focus() + .trigger(window.mockKeyboardEvent('HOME')); + + plugin.$handle.should.have.attr('aria-valuenow', plugin.$handle.attr('aria-valuemin')); + }); + it('sets value to maximum using END', function() { + $html = $(template).appendTo('body'); + plugin = new Foundation.Slider($html, {}); + + plugin.$handle.focus() + .trigger(window.mockKeyboardEvent('END')); + + plugin.$handle.should.have.attr('aria-valuenow', plugin.$handle.attr('aria-valuemax')); + }); + }); }); \ No newline at end of file -- 2.47.2