diff options
author | Mike Gerwitz <gerwitm@lovullo.com> | 2016-06-24 15:19:43 -0400 |
---|---|---|
committer | Mike Gerwitz <gerwitm@lovullo.com> | 2016-06-27 16:51:25 -0400 |
commit | c0df3ef02e8f2d55b4ada57b447b25ff41b472b5 (patch) | |
tree | c5b222ba395fc70bfd949f4ddf10b93f3956fcf7 /test/validate | |
parent | 8a264064684ceac2f6596defdf071c41ac272bf9 (diff) | |
download | liza-c0df3ef02e8f2d55b4ada57b447b25ff41b472b5.tar.gz liza-c0df3ef02e8f2d55b4ada57b447b25ff41b472b5.tar.bz2 liza-c0df3ef02e8f2d55b4ada57b447b25ff41b472b5.zip |
Add Number formatter
* src/validate/formatter/Number.js: Added
* test/validate/formatter/NumberTest.js: Added
Diffstat (limited to 'test/validate')
-rw-r--r-- | test/validate/formatter/NumberTest.js | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/test/validate/formatter/NumberTest.js b/test/validate/formatter/NumberTest.js new file mode 100644 index 0000000..74d2595 --- /dev/null +++ b/test/validate/formatter/NumberTest.js @@ -0,0 +1,50 @@ +/** + * Number formatter test + * + * Copyright (C) 2016 LoVullo Associates, Inc. + * + * This file is part of liza. + * + * liza is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +var liza = require( '../../../' ), + Sut = liza.validate.formatter.Number, + EchoFormatter = liza.validate.formatter.EchoFormatter, + common = require( './common' ); + + +describe( 'validate.formatter.Number', function() +{ + common.testValidate( EchoFormatter.use( Sut )(), { + "1": [ "1", "1" ], + "123": [ "123", "123" ], + "12345": [ "12345", "12,345" ], + "12,345": [ "12345", "12,345" ], + ",12,345": [ "12345", "12,345" ], + "12,345,": [ "12345", "12,345" ], + " 12,345 ,": [ "12345", "12,345" ], + " 1, ,": [ "1", "1" ], + } ); + + + common.testMixin( + EchoFormatter, + Sut, + '123', + '4567', + '1234567', + '1,234,567' + ); +} ); |