spreewald 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -373,50 +373,52 @@ end
373
373
  Then /^"([^\"]+)" should( not)? be visible$/ do |text, negate|
374
374
  case Capybara::current_driver
375
375
  when :selenium, :webkit
376
- visibility_detecting_javascript = %[
377
- (function() {
378
-
379
- var containsSelector = ':contains(#{text.to_json})';
380
- var jqueryLoaded = (typeof jQuery != 'undefined');
381
-
382
- function findCandidates() {
383
- if (jqueryLoaded) {
384
- return $(containsSelector);
385
- } else {
386
- return $$(containsSelector);
376
+ patiently do
377
+ visibility_detecting_javascript = %[
378
+ (function() {
379
+
380
+ var containsSelector = ':contains(#{text.to_json})';
381
+ var jqueryLoaded = (typeof jQuery != 'undefined');
382
+
383
+ function findCandidates() {
384
+ if (jqueryLoaded) {
385
+ return $(containsSelector);
386
+ } else {
387
+ return $$(containsSelector);
388
+ }
387
389
  }
388
- }
389
390
 
390
- function isExactCandidate(candidate) {
391
- if (jqueryLoaded) {
392
- return $(candidate).find(containsSelector).length == 0;
393
- } else {
394
- return candidate.select(containsSelector).length == 0;
391
+ function isExactCandidate(candidate) {
392
+ if (jqueryLoaded) {
393
+ return $(candidate).find(containsSelector).length == 0;
394
+ } else {
395
+ return candidate.select(containsSelector).length == 0;
396
+ }
395
397
  }
396
- }
397
398
 
398
- function elementVisible(element) {
399
- if (jqueryLoaded) {
400
- return $(element).is(':visible');
401
- } else {
402
- return element.offsetWidth > 0 && element.offsetHeight > 0;
399
+ function elementVisible(element) {
400
+ if (jqueryLoaded) {
401
+ return $(element).is(':visible');
402
+ } else {
403
+ return element.offsetWidth > 0 && element.offsetHeight > 0;
404
+ }
403
405
  }
404
- }
405
406
 
406
- var candidates = findCandidates();
407
+ var candidates = findCandidates();
407
408
 
408
- for (var i = 0; i < candidates.length; i++) {
409
- var candidate = candidates[i];
410
- if (isExactCandidate(candidate) && elementVisible(candidate)) {
411
- return true;
409
+ for (var i = 0; i < candidates.length; i++) {
410
+ var candidate = candidates[i];
411
+ if (isExactCandidate(candidate) && elementVisible(candidate)) {
412
+ return true;
413
+ }
412
414
  }
413
- }
414
- return false;
415
+ return false;
415
416
 
416
- })();
417
- ].gsub(/\n/, ' ')
418
- matcher = negate ? be_false : be_true
419
- page.evaluate_script(visibility_detecting_javascript).should matcher
417
+ })();
418
+ ].gsub(/\n/, ' ')
419
+ matcher = negate ? be_false : be_true
420
+ page.evaluate_script(visibility_detecting_javascript).should matcher
421
+ end
420
422
  else
421
423
  invisibility_detecting_matcher = have_css('.hidden, .invisible, [style~="display: none"]', :text => text)
422
424
  expectation = negate ? :should : :should_not # sic
@@ -1,5 +1,5 @@
1
1
  # coding: UTF-8
2
2
 
3
3
  module Spreewald
4
- VERSION = "0.3.1"
4
+ VERSION = "0.3.2"
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spreewald
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 1
10
- version: 0.3.1
9
+ - 2
10
+ version: 0.3.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tobias Kraze
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-11-12 00:00:00 +01:00
18
+ date: 2012-11-13 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency