From: Kristofer Krause Date: Thu, 16 Feb 2017 00:52:15 +0000 (-0500) Subject: Abide plug-in unit tests for checkbox and select X-Git-Tag: 6.3.1~1^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F9784%2Fhead;p=thirdparty%2Ffoundation%2Ffoundation-sites.git Abide plug-in unit tests for checkbox and select --- diff --git a/test/javascript/components/abide.js b/test/javascript/components/abide.js index b476bfe92..13ae0e98b 100644 --- a/test/javascript/components/abide.js +++ b/test/javascript/components/abide.js @@ -34,6 +34,34 @@ describe('Abide', function() { plugin.validateInput($html.find("input")).should.equal(true); }); - }); + it('returns true for checked checkboxes', function() { + $html = $("
").appendTo("body"); + plugin = new Foundation.Abide($html, {}); + + plugin.validateInput($html.find("input")).should.equal(true); + }); + + it('returns false for unchecked checkboxes', function() { + $html = $("
").appendTo("body"); + plugin = new Foundation.Abide($html, {}); + + plugin.validateInput($html.find("input")).should.equal(false); + }); + + it('returns true for selected select option', function() { + $html = $("
").appendTo("body"); + plugin = new Foundation.Abide($html, {}); + + plugin.validateInput($html.find("select")).should.equal(true); + $html.find("select").val().should.equal("Two"); + }); + + it('returns false for unselected select option', function() { + $html = $("
").appendTo("body"); + plugin = new Foundation.Abide($html, {}); + + plugin.validateInput($html.find("select")).should.equal(false); + }); + }); });