capybara-angular 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dc5163484b2fb235380f17e2212c65d4c2712eab
4
- data.tar.gz: 66e006bcf4a55aa1a7eebf2e7e0d65c82ce59a89
3
+ metadata.gz: fb7cac0f774a56afa92223cfedc9904bead05ddf
4
+ data.tar.gz: 45c152c893570c9fd7efe10083e2679c030a6e48
5
5
  SHA512:
6
- metadata.gz: fd74d7bd3463c6788ef04d129e48cfea3185799896339c15f772a3665f18739635f60bf71d84eee9a0712af0c9bef3169b8a5ea2e6c35daecf0d3ac3aec14050
7
- data.tar.gz: da36d777b618cd679d95c416406aa746a9c50c3bbee91e0bebc43da56bb1dc0524d245e40eff42fde375b4094dbcc809cbd9d585b55b4504bfe6b7521a1a3c6c
6
+ metadata.gz: 3d286117b6cd5b5478caab4660cabb4ab359285f19e6afa0b2de47fccb88ab6d9f275164732267e54d111d6f0e3c77422a17f4dde11a41ff67e2e20132d667ef
7
+ data.tar.gz: f74fe7c012054df62cf4dfeb775a1a2c60aa85390f467f1a833b7c15335df4edb09e837fff5188c1dcf682167ed95b04d19d4021ec2d870dd321043b56f12ba1
@@ -10,13 +10,20 @@ module Capybara
10
10
  end
11
11
 
12
12
  def page
13
- wait_until_angular_ready
13
+ wait_until_angular_ready unless @ignoring_angular
14
14
  Capybara.current_session
15
15
  end
16
16
 
17
17
  def wait_until_angular_ready
18
18
  Waiter.new(Capybara.current_session).wait_until_ready
19
19
  end
20
+
21
+ def ignoring_angular
22
+ @ignoring_angular = true
23
+ yield
24
+ ensure
25
+ @ignoring_angular = false
26
+ end
20
27
  end
21
28
  end
22
29
  end
@@ -1,5 +1,5 @@
1
1
  module Capybara
2
2
  module Angular
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
@@ -48,16 +48,17 @@ module Capybara
48
48
 
49
49
  def setup_ready
50
50
  page.execute_script <<-JS
51
- angular.element(document).ready(function() {
52
- var app = angular.element(document.querySelector('[ng-app], [data-ng-app]'));
53
- var injector = app.injector();
54
- injector.invoke(['$browser', function($browser) {
55
- window.angularReady = false;
56
- $browser.notifyWhenNoOutstandingRequests(function() {
57
- window.angularReady = true;
58
- });
59
- }]);
60
- });
51
+ var el = document.querySelector('body')
52
+ window.angularReady = false;
53
+
54
+ if (angular.getTestability) {
55
+ angular.getTestability(el).whenStable(function() { window.angularReady = true; });
56
+ } else {
57
+ var $browser = angular.element(el).injector().get('$browser');
58
+
59
+ if ($browser.outstandingRequestCount > 0) { window.angularReady = false; }
60
+ $browser.notifyWhenNoOutstandingRequests(function() { window.angularReady = true; });
61
+ }
61
62
  JS
62
63
  end
63
64
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capybara-angular
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pawel Pierzchala
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-01 00:00:00.000000000 Z
11
+ date: 2015-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara