eyeballs 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -27,7 +27,7 @@ begin
27
27
  require 'jeweler'
28
28
  Jeweler::Tasks.new do |s|
29
29
  s.name = "eyeballs"
30
- s.version = "0.5.0"
30
+ s.version = "0.5.1"
31
31
  s.author = "Paul Campbell"
32
32
  s.email = "paul@rslw.com"
33
33
  s.homepage = "http://www.github.com/paulca/eyeballs.js"
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{eyeballs}
8
- s.version = "0.5.0"
8
+ s.version = "0.5.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Paul Campbell"]
@@ -20,6 +20,14 @@ o_O.controller = {
20
20
  {
21
21
  this_action_event = ($(this).is('form')) ? 'submit' : 'click';
22
22
  }
23
+ if(this_action_event === 'blur' && event.type == 'focusout')
24
+ {
25
+ this_action_event = 'focusout';
26
+ }
27
+ if(this_action_event === 'focus' && event.type == 'focusin')
28
+ {
29
+ this_action_event = 'focusin';
30
+ }
23
31
  var this_controller_name = parts[6];
24
32
  var this_action = parts[7];
25
33
  if(this_controller_name == controller_name && this_action_event === event.type)
@@ -30,6 +30,12 @@
30
30
  },
31
31
  multi: function(){
32
32
  $(this).html($(this).html() + ' multi!')
33
+ },
34
+ blur: function(){
35
+ $(this).val('blurred!')
36
+ },
37
+ focus: function(){
38
+ $(this).val('focussed!')
33
39
  }
34
40
  });
35
41
 
@@ -83,6 +89,26 @@
83
89
  $('div#shortcut').trigger('mouseover');
84
90
  equals($("div#shortcut").html(), 'shortcut! multi!', 'it should bind multiple events')
85
91
  })
92
+
93
+ test('should let me blur', function(){
94
+ $('input#myBlur').blur();
95
+ equals($('input#myBlur').val(), 'blurred!', 'should set the val')
96
+ });
97
+
98
+ test('should let me focusout', function(){
99
+ $('input#myBlur').trigger('focusout');
100
+ equals($('input#myBlur').val(), 'blurred!', 'should set the val')
101
+ });
102
+
103
+ test('should let me focus', function(){
104
+ $('input#myFocus').focus();
105
+ equals($('input#myFocus').val(), 'focussed!', 'should set the val')
106
+ });
107
+
108
+ test('should let me focusin', function(){
109
+ $('input#myFocus').trigger('focusin');
110
+ equals($('input#myFocus').val(), 'focussed!', 'should set the val')
111
+ });
86
112
 
87
113
  });
88
114
  </script>
@@ -114,7 +140,9 @@
114
140
  <div id="anotherDiv">
115
141
 
116
142
  </div>
117
- <input id="myCheckbox" data-bind="+click:reviews#check" data-default="true" type="checkbox">
143
+ <input id="myCheckbox" data-bind="+click:reviews#check" type="checkbox">
144
+ <input id="myBlur" data-bind="blur:reviews#blur" type="text">
145
+ <input id="myFocus" data-bind="focus:reviews#focus" type="text">
118
146
  </div>
119
147
  </body>
120
148
  </html>
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eyeballs
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 0
10
- version: 0.5.0
9
+ - 1
10
+ version: 0.5.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Paul Campbell