capybara-angular 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  module Capybara
2
2
  module Angular
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  end
@@ -15,6 +15,7 @@ module Capybara
15
15
  start = Time.now
16
16
  until ready?
17
17
  timeout! if timeout?(start)
18
+ setup_ready if page_reloaded_on_wait?
18
19
  sleep(0.01)
19
20
  end
20
21
  end
@@ -34,13 +35,19 @@ module Capybara
34
35
  end
35
36
 
36
37
  def angular_app?
37
- page.evaluate_script "(typeof $ != 'undefined') && $('[ng-app]').length > 0"
38
+ begin
39
+ js = "(typeof angular !== 'undefined') && "
40
+ js += "angular.element(document.querySelector('[ng-app]')).length > 0"
41
+ page.evaluate_script js
42
+ rescue Capybara::NotSupportedByDriverError
43
+ false
44
+ end
38
45
  end
39
46
 
40
47
  def setup_ready
41
48
  page.execute_script <<-JS
42
49
  window.angularReady = false;
43
- var app = $('*[ng-app]');
50
+ var app = angular.element(document.querySelector('[ng-app]'));
44
51
  var injector = app.injector();
45
52
 
46
53
  injector.invoke(function($browser) {
@@ -50,6 +57,10 @@ module Capybara
50
57
  });
51
58
  JS
52
59
  end
60
+
61
+ def page_reloaded_on_wait?
62
+ page.evaluate_script("window.angularReady === undefined")
63
+ end
53
64
  end
54
65
  end
55
66
  end
metadata CHANGED
@@ -1,71 +1,60 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: capybara-angular
3
- version: !ruby/object:Gem::Version
4
- version: 0.0.3
3
+ version: !ruby/object:Gem::Version
5
4
  prerelease:
5
+ version: 0.0.4
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Pawel Pierzchala
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-28 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
12
+
13
+ date: 2014-03-20 00:00:00 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
15
16
  name: capybara
16
- requirement: !ruby/object:Gem::Requirement
17
+ requirement: &id001 !ruby/object:Gem::Requirement
17
18
  none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: '0'
19
+ requirements:
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: "0"
22
23
  type: :runtime
23
24
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: '0'
30
- - !ruby/object:Gem::Dependency
25
+ version_requirements: *id001
26
+ - !ruby/object:Gem::Dependency
31
27
  name: bundler
32
- requirement: !ruby/object:Gem::Requirement
28
+ requirement: &id002 !ruby/object:Gem::Requirement
33
29
  none: false
34
- requirements:
30
+ requirements:
35
31
  - - ~>
36
- - !ruby/object:Gem::Version
37
- version: '1.3'
32
+ - !ruby/object:Gem::Version
33
+ version: "1.3"
38
34
  type: :development
39
35
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ~>
44
- - !ruby/object:Gem::Version
45
- version: '1.3'
46
- - !ruby/object:Gem::Dependency
36
+ version_requirements: *id002
37
+ - !ruby/object:Gem::Dependency
47
38
  name: rake
48
- requirement: !ruby/object:Gem::Requirement
39
+ requirement: &id003 !ruby/object:Gem::Requirement
49
40
  none: false
50
- requirements:
51
- - - ! '>='
52
- - !ruby/object:Gem::Version
53
- version: '0'
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: "0"
54
45
  type: :development
55
46
  prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
47
+ version_requirements: *id003
62
48
  description: Capybara API that knows how to wait for Angular in end to end specs
63
- email:
49
+ email:
64
50
  - pawelpierzchala@gmail.com
65
51
  executables: []
52
+
66
53
  extensions: []
54
+
67
55
  extra_rdoc_files: []
68
- files:
56
+
57
+ files:
69
58
  - .gitignore
70
59
  - Gemfile
71
60
  - LICENSE.txt
@@ -76,35 +65,38 @@ files:
76
65
  - lib/capybara/angular/dsl.rb
77
66
  - lib/capybara/angular/version.rb
78
67
  - lib/capybara/angular/waiter.rb
79
- homepage: ''
80
- licenses:
68
+ homepage: ""
69
+ licenses:
81
70
  - MIT
82
71
  post_install_message:
83
72
  rdoc_options: []
84
- require_paths:
73
+
74
+ require_paths:
85
75
  - lib
86
- required_ruby_version: !ruby/object:Gem::Requirement
76
+ required_ruby_version: !ruby/object:Gem::Requirement
87
77
  none: false
88
- requirements:
89
- - - ! '>='
90
- - !ruby/object:Gem::Version
91
- version: '0'
92
- segments:
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ hash: -575955853
82
+ segments:
93
83
  - 0
94
- hash: -926384177
95
- required_rubygems_version: !ruby/object:Gem::Requirement
84
+ version: "0"
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
96
86
  none: false
97
- requirements:
98
- - - ! '>='
99
- - !ruby/object:Gem::Version
100
- version: '0'
101
- segments:
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ hash: -575955853
91
+ segments:
102
92
  - 0
103
- hash: -926384177
93
+ version: "0"
104
94
  requirements: []
95
+
105
96
  rubyforge_project:
106
97
  rubygems_version: 1.8.25
107
98
  signing_key:
108
99
  specification_version: 3
109
100
  summary: Stable Capybara API for AngularJS applications
110
101
  test_files: []
102
+