浏览代码

Add built files for the rgbColor and keywordColor commits

Emil Rømer Christensen 11 年之前
父节点
当前提交
450e142431
共有 4 个文件被更改,包括 182 次插入1 次删除
  1. 4 0
      dist/css/bootstrapValidator.min.css
  2. 57 0
      dist/js/bootstrapValidator.js
  3. 11 1
      dist/js/bootstrapValidator.min.js
  4. 110 0
      test/spec.js

+ 4 - 0
dist/css/bootstrapValidator.min.css

@@ -2,7 +2,11 @@
  * BootstrapValidator (http://bootstrapvalidator.com)
  * The best jQuery plugin to validate form fields. Designed to use with Bootstrap 3
  *
+<<<<<<< HEAD
  * @version     v0.5.3-dev, built on 2014-10-06 8:02:42 AM
+=======
+ * @version     v0.5.2-dev, built on 2014-09-18 9:55:01 PM
+>>>>>>> Add built files for the rgbColor and keywordColor commits
  * @author      https://twitter.com/nghuuphuoc
  * @copyright   (c) 2013 - 2014 Nguyen Huu Phuoc
  * @license     MIT

文件差异内容过多而无法显示
+ 57 - 0
dist/js/bootstrapValidator.js


文件差异内容过多而无法显示
+ 11 - 1
dist/js/bootstrapValidator.min.js


+ 110 - 0
test/spec.js

@@ -5842,6 +5842,116 @@ describe('stringLength', function() {
     });
 });
 
+describe('rgbColor', function() {
+
+    beforeEach(function() {
+        var html = [
+            '<div class="container">',
+                '<form class="form-horizontal" id="rbgColorForm">',
+                    '<div class="form-group">',
+                        '<input type="text" name="rc" data-bv-rgbcolor />',
+                    '</div>',
+                '</form>',
+            '</div>'
+        ].join('\n');
+
+        $(html).appendTo('body');
+        $('#rbgColorForm').bootstrapValidator();
+
+        this.bv          = $('#rbgColorForm').data('bootstrapValidator');
+        this.$rgbColor = this.bv.getFieldElements('rc');
+    });
+
+    afterEach(function() {
+        $('#rbgColorForm').bootstrapValidator('destroy').parent().remove();
+    });
+
+    it('accept rgb()', function() {
+        this.$rgbColor.val('rgb(255,255,255)');
+        this.bv.validate();
+        expect(this.bv.isValidField('rc')).toBeTruthy();
+    });
+
+    it('accept spaces around numeric values', function() {
+        this.$rgbColor.val('rgb( 255 , 255 , 255 )');
+        this.bv.validate();
+        expect(this.bv.isValidField('rc')).toBeTruthy();
+    });
+
+    it('accept multiple spaces around numeric values', function() {
+        this.$rgbColor.val('rgb(  255,  255,       255  )');
+        this.bv.validate();
+        expect(this.bv.isValidField('rc')).toBeTruthy();
+    });
+
+    it('accept interger values', function() {
+        this.$rgbColor.val('rgb(255,255,255)');
+        this.bv.validate();
+        expect(this.bv.isValidField('rc')).toBeTruthy();
+    });
+
+    it('accept percent values', function() {
+        this.$rgbColor.val('rgb(100%,100%,100%)');
+        this.bv.validate();
+        expect(this.bv.isValidField('rc')).toBeTruthy();
+    });
+
+    it('reject mixed intergers and percentile input', function() {
+        this.$rgbColor.val('rgb(255,255,100%)');
+        this.bv.validate();
+        expect(this.bv.isValidField('rc')).toEqual(false);
+    });
+
+    it('reject negative integers', function() {
+        this.$rgbColor.val('rgb(-10,255,255)');
+        this.bv.validate();
+        expect(this.bv.isValidField('rc')).toEqual(false);
+    });
+
+    it('reject negative percentages', function() {
+        this.$rgbColor.val('rgb(-10%,100%,100%)');
+        this.bv.validate();
+        expect(this.bv.isValidField('rc')).toEqual(false);
+    });
+
+    it('require rgb()', function() {
+        this.$rgbColor.val('255,255,255');
+        this.bv.validate();
+        expect(this.bv.isValidField('rc')).toEqual(false);
+    });
+
+    it('reject intergers above 255', function() {
+        this.$rgbColor.val('rgb(255,255,256)');
+        this.bv.validate();
+        expect(this.bv.isValidField('rc')).toEqual(false);
+    });
+
+    it('reject percentages above 100%', function() {
+        this.$rgbColor.val('rgb(100%,100%,101%)');
+        this.bv.validate();
+        expect(this.bv.isValidField('rc')).toEqual(false);
+    });
+
+    it('reject space between rgb and (', function() {
+        this.$rgbColor.val('rgb (255,255,255)');
+        this.bv.validate();
+        expect(this.bv.isValidField('rc')).toEqual(false);
+    });
+
+    it('reject leading space', function() {
+        this.$rgbColor.val(' rgb(255,255,255)');
+        this.bv.validate();
+        expect(this.bv.isValidField('rc')).toEqual(false);
+    });
+
+    it('reject trailing space', function() {
+        this.$rgbColor.val('rgb(255,255,255) ');
+        this.bv.validate();
+        expect(this.bv.isValidField('rc')).toEqual(false);
+    });
+
+});
+
 describe('uri', function() {
     beforeEach(function() {
         $([