capybara-js_finders 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -8,7 +8,7 @@ you to find a table cell based on column and row descriptions.
8
8
  Simply add it to your Gemfile and bundle it up:
9
9
 
10
10
  ```ruby
11
- gem 'capybara-js_finders', '~> 0.0.1'
11
+ gem 'capybara-js_finders', '~> 0.2.1'
12
12
  gem 'capybara'
13
13
  ```
14
14
 
data/Rakefile CHANGED
@@ -28,12 +28,14 @@ end
28
28
 
29
29
  task :default => :test
30
30
 
31
+ desc "output javascript that is executed before looking for elements"
31
32
  task :script do
32
33
  require "capybara-js_finders"
33
34
  puts Capybara::JsFinders::SCRIPT
34
35
  end
35
36
 
36
37
  namespace :find_cell_tests do
38
+ desc "run sinatra app that is used to serve page necessary for testing find_cell method"
37
39
  task :app do
38
40
  $LOAD_PATH << './test'
39
41
  require 'unit/find_cell_tests/app/app'
@@ -41,6 +43,7 @@ namespace :find_cell_tests do
41
43
  end
42
44
  end
43
45
 
46
+ desc "test generating of readme"
44
47
  task :readme do
45
48
  #require 'redcloth'
46
49
  `redcarpet README.md > README.test.html`
@@ -1,5 +1,5 @@
1
1
  module Capybara
2
2
  module JsFinders
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.1"
4
4
  end
5
5
  end
@@ -22,15 +22,19 @@ module Capybara
22
22
  ary.push(td);
23
23
  }
24
24
  ary.each(function(ele){
25
- var offset = ele.cumulativeOffset();
26
- var lr = offset.left;
27
- var rr = lr + ele.getWidth();
28
- var tr = offset.top;
29
- var br = tr + ele.getHeight();
30
- ele.setAttribute('#{LR}', lr);
31
- ele.setAttribute('#{RR}', rr);
32
- ele.setAttribute('#{TR}', tr);
33
- ele.setAttribute('#{BR}', br);
25
+ try{
26
+ var offset = ele.cumulativeOffset();
27
+ var lr = offset.left;
28
+ var rr = lr + ele.getWidth();
29
+ var tr = offset.top;
30
+ var br = tr + ele.getHeight();
31
+ ele.setAttribute('#{LR}', lr);
32
+ ele.setAttribute('#{RR}', rr);
33
+ ele.setAttribute('#{TR}', tr);
34
+ ele.setAttribute('#{BR}', br);
35
+ } catch(err){
36
+ /* ele.getWidth() and ele.getHeight() sometimes raises an exception, just skip ele in such case, there is nothing we can do about it! */
37
+ }
34
38
  });
35
39
  JS
36
40
  SCRIPT.freeze
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capybara-js_finders
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-07-18 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capybara
16
- requirement: &79594120 !ruby/object:Gem::Requirement
16
+ requirement: &87884780 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.0.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *79594120
24
+ version_requirements: *87884780
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &79593870 !ruby/object:Gem::Requirement
27
+ requirement: &87875910 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.9.0
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *79593870
35
+ version_requirements: *87875910
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rdoc
38
- requirement: &79593610 !ruby/object:Gem::Requirement
38
+ requirement: &87875680 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 2.4.2
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *79593610
46
+ version_requirements: *87875680
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: sinatra
49
- requirement: &79593310 !ruby/object:Gem::Requirement
49
+ requirement: &87875450 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.2.6
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *79593310
57
+ version_requirements: *87875450
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: erubis
60
- requirement: &79593010 !ruby/object:Gem::Requirement
60
+ requirement: &87875220 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 2.6.6
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *79593010
68
+ version_requirements: *87875220
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bbq
71
- requirement: &79592650 !ruby/object:Gem::Requirement
71
+ requirement: &87874990 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 0.0.3
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *79592650
79
+ version_requirements: *87874990
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: redcarpet
82
- requirement: &79592230 !ruby/object:Gem::Requirement
82
+ requirement: &87874760 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ~>
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '1.17'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *79592230
90
+ version_requirements: *87874760
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: ruby-debug19
93
- requirement: &79592030 !ruby/object:Gem::Requirement
93
+ requirement: &87874570 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,7 +98,7 @@ dependencies:
98
98
  version: '0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *79592030
101
+ version_requirements: *87874570
102
102
  description: ! " Additional finders for capybara that for some reason\n cannot
103
103
  use only xpath for finding nodes but needs to\n execute js for some calculations.\n\n
104
104
  \ Ex: I you want to find a table cell\n that is under or next to other cell
@@ -142,7 +142,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
142
142
  version: '0'
143
143
  segments:
144
144
  - 0
145
- hash: -918427759
145
+ hash: -398005553
146
146
  required_rubygems_version: !ruby/object:Gem::Requirement
147
147
  none: false
148
148
  requirements:
@@ -151,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
151
151
  version: '0'
152
152
  segments:
153
153
  - 0
154
- hash: -918427759
154
+ hash: -398005553
155
155
  requirements: []
156
156
  rubyforge_project: capybara-js_finders
157
157
  rubygems_version: 1.8.5