diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2016-01-18 00:40:16 +0100 |
---|---|---|
committer | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2016-01-18 00:40:16 +0100 |
commit | bf0dd2a1cc6eeca0ec50ffcd38f0e57ab4fb2911 (patch) | |
tree | 204442dbeeafcaa63eb3d5c52cbe69d06f03e6eb /spec | |
parent | 6f602f10613b81daf73fdf9604e4360c784b2c57 (diff) | |
download | svg.js-bf0dd2a1cc6eeca0ec50ffcd38f0e57ab4fb2911.tar.gz svg.js-bf0dd2a1cc6eeca0ec50ffcd38f0e57ab4fb2911.zip |
added specs for `isNumber()` and compile svg.js
Diffstat (limited to 'spec')
-rw-r--r-- | spec/spec/regex.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/spec/regex.js b/spec/spec/regex.js index f017059..67b03ef 100644 --- a/spec/spec/regex.js +++ b/spec/spec/regex.js @@ -45,6 +45,22 @@ describe('Regex', function() { expect(SVG.regex.isRgb.test('hsb(255, 100, 100)')).toBeFalsy() }) }) + + describe('isNumber', function() { + + it('is true with a number', function() { + ["1", "-1", "+15", "1.55", ".5", "5.", "1.3e2", "1E-4", "1e+12"].forEach(function(s) { + expect(SVG.regex.isNumber.test(s)).toBeTruthy() + }) + }) + + it('is false with a faulty number', function() { + ["1a", "+-1", "1.2.3", "1+1", "1e4.5", ".5.", "1f5", "."].forEach(function(s) { + expect(SVG.regex.isNumber.test(s)).toBeFalsy() + }) + }) + + }) }) |