From 8cc04b955ccd2864b97b40d56eb3c21eb71e1c85 Mon Sep 17 00:00:00 2001 From: Kristofer Krause Date: Wed, 15 Feb 2017 19:52:15 -0500 Subject: [PATCH] Abide plug-in unit tests for checkbox and select --- test/javascript/components/abide.js | 30 ++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) 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); + }); + }); }); -- 2.47.2