From: SassNinja Date: Tue, 13 Aug 2019 07:36:15 +0000 (+0200) Subject: test: add abide unit tests for validateForm X-Git-Tag: v6.6.0~3^2~5^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=18b3a0e28b26ddd3bbb2d9be3ce74c4ea0ff1399;p=thirdparty%2Ffoundation%2Ffoundation-sites.git test: add abide unit tests for validateForm --- diff --git a/test/javascript/components/abide.js b/test/javascript/components/abide.js index bca442048..a8883bb4c 100644 --- a/test/javascript/components/abide.js +++ b/test/javascript/components/abide.js @@ -36,6 +36,32 @@ describe('Abide', function() { }); }); + describe('validateForm()', function() { + it('returns true after validation is disabled', function() { + $html = $("
").appendTo("body"); + plugin = new Foundation.Abide($html, {}); + + plugin.disableValidation(); + plugin.validateForm().should.equal(true); + }); + + it('returns false after validation is (re)enabled', function() { + $html = $("
").appendTo("body"); + plugin = new Foundation.Abide($html, {}); + + plugin.disableValidation(); + plugin.enableValidation(); + plugin.validateForm().should.equal(false); + }); + + it('returns true if first submit has formnovalidate is disabled', function() { + $html = $("
").appendTo("body"); + plugin = new Foundation.Abide($html, {}); + + plugin.validateForm().should.equal(true); + }); + }); + describe('validateInput()', function() { it('returns true for hidden inputs', function() { $html = $("
").appendTo("body");