]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
test: add unit test for Abide.addGlobalErrorA11yAttributes()
authorNicolas Coden <nicolas@ncoden.fr>
Thu, 18 Jan 2018 22:38:28 +0000 (23:38 +0100)
committerNicolas Coden <nicolas@ncoden.fr>
Thu, 18 Jan 2018 22:38:28 +0000 (23:38 +0100)
test/javascript/components/abide.js

index f57d924787fa92e52fb0975e79bc68b419eb9df4..bca4420482f6df0c5c1475ba9a0a91e15acc4002 100644 (file)
@@ -92,6 +92,16 @@ describe('Abide', function() {
     });
   });
 
+  describe('addGlobalErrorA11yAttributes()', function () {
+    it('adds [aria-live] attribute on element', function () {
+      $html = $(`<form data-abide><span data-abide-error></span></form>`).appendTo('body');
+      plugin = new Foundation.Abide($html, { a11yErrorLevel: 'test-level' });
+      plugin.addA11yAttributes($html.find('[data-abide-error]'));
+
+      $html.find('[data-abide-error]').should.have.attr('aria-live', 'test-level');
+    });
+  });
+
   describe('addA11yAttributes()', function () {
     it('adds [aria-describedby] attribute to field and [for] attribute to form error', function() {
       $html = $(`