appjs-rails 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -94,7 +94,7 @@ Use requires the following steps:
94
94
  app._bootstrap.inputDownCounter();
95
95
  ```
96
96
 
97
- * Adding class 'js-input-down-counter-x' (where x is a natural number) into an input tag.
97
+ * Adding class 'js-input-down-counter-x' (where x is a limit to down count) into an input tag.
98
98
 
99
99
  For Example
100
100
 
@@ -84,9 +84,9 @@ var app = (function() {
84
84
  },
85
85
  _bootstrap: {
86
86
  inputDownCounter: function(){
87
- jInputs = $('[class*="js-input-down-counter-"]');
87
+ var jInputs = $('[class*="js-input-down-counter-"]');
88
88
 
89
- for(var i=0; i< jInputs.length; i++){
89
+ for(var i = 0; i < jInputs.length; i++){
90
90
  if (!$(jInputs[i]).hasClass('js-used-input-down-counter')) {
91
91
  var maxNameLength = undefined;
92
92
 
@@ -96,7 +96,7 @@ var app = (function() {
96
96
  }
97
97
  })
98
98
 
99
- jInputGroup = $('<div class="input-group"></div>');
99
+ var jInputGroup = $('<div class="input-group"></div>');
100
100
  jInputGroup.insertBefore($(jInputs[i]));
101
101
  jInputGroup.append($(jInputs[i]));
102
102
 
@@ -117,14 +117,15 @@ var app = (function() {
117
117
  }
118
118
  },
119
119
  showIcons: function(){
120
- styles = document.styleSheets;
121
- result = []
122
-
123
- for (i=0; i< styles.length; i++) {
124
- style = styles[i];
125
- for(j=0; j< style.cssRules.length; j++) {
126
- if(style.cssRules[j].cssText.match('glyphicon-.*::')) {
127
- result.push(style.cssRules[j].cssText.match("(glyphicon-.*)::.*")[1])
120
+ var styles = document.styleSheets;
121
+ var result = []
122
+ for (var i = 0; i < styles.length; i++) {
123
+ var style = styles[i];
124
+ if (style.cssRules != null) {
125
+ for(var j=0; j < style.cssRules.length; j++) {
126
+ if(style.cssRules[j].cssText.match('glyphicon-.*::')) {
127
+ result.push(style.cssRules[j].cssText.match("(glyphicon-.*)::.*")[1])
128
+ }
128
129
  }
129
130
  }
130
131
  }
@@ -132,8 +133,10 @@ var app = (function() {
132
133
  for(i=0; i<result.length; i++){
133
134
  $('#page-wrapper').append("<div class='col-lg-3'><span style='font-size: 30px' class='glyphicon " + result[i] + "'></span> " + result[i] + "</div>")
134
135
  }
136
+ },
137
+ icon: function(subname) {
138
+ return $("<span class='glyphicon glyphicon-" + subname + "'></span>")
135
139
  }
136
140
  }
137
-
138
141
  }
139
142
  })();
@@ -1,5 +1,5 @@
1
1
  module Appjs
2
2
  module Rails
3
- VERSION = "1.0.5"
3
+ VERSION = "1.0.6"
4
4
  end
5
5
  end
@@ -68,4 +68,22 @@ describe("app", function() {
68
68
  })
69
69
  })
70
70
 
71
+ describe('#_bootstrap', function(){
72
+ it('#inputDownCounter', function(){
73
+ $('body').append('<div class="jasmine-content"><input class="js-input-down-counter-25" value="Example"></div>')
74
+ app._bootstrap.inputDownCounter();
75
+ expect($('input').next().text()).toEqual('18');
76
+ $('.jasmine-content').remove();
77
+ })
78
+
79
+ it('#showIcons', function(){
80
+ app._bootstrap.showIcons();
81
+ })
82
+
83
+ it('#icon', function(){
84
+ expect(app._bootstrap.icon('ok')).toEqual($("<span class='glyphicon glyphicon-ok'></span>"));
85
+ })
86
+
87
+ })
88
+
71
89
  });
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appjs-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-03-24 00:00:00.000000000 Z
12
+ date: 2014-03-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler