]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Added tests for home and end keyboard events. 9963/head
authorMarius Olbertz <marius.olbertz@gmail.com>
Wed, 19 Apr 2017 15:12:56 +0000 (17:12 +0200)
committerMarius Olbertz <marius.olbertz@gmail.com>
Wed, 19 Apr 2017 15:12:56 +0000 (17:12 +0200)
test/javascript/components/slider.js

index 22c900357183e3a9eadcffdfd252f3c4e9188901..ffca592fccd743af13948d8d00901def627be8ae 100644 (file)
@@ -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