rspec-html 0.2.16 → 0.2.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +6 -0
- data/lib/rspec/html/version.rb +1 -1
- data/lib/rspec_html/element.rb +1 -1
- data/lib/rspec_html/search.rb +6 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 202d1ada700f7071e92c4468a5a6777ce953c080d003ddb38da2b1368e0dc4fb
|
4
|
+
data.tar.gz: 16c180dc70119aa3152241e4dfd75249c563df2bf5091a08d594c54b14cf2baa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0cc5a31d66fe3087d9248cb7528b088d667635672de83174f41b45b8a61d2708ade6f50db6cbcada675049bb30f684ed2df7cc83312b096cf4a0e5d1d1ed9dee
|
7
|
+
data.tar.gz: a6611b7dfd07963cbac2d5df0afd403e49afbc57419e5afdb9cc0a5604c73ad0de6407619d577fd03b98ab9675523596bc86aa7dfd89fa8667c58ed3acd95791
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -97,6 +97,12 @@ expect(document.body.div.span[:class]).to contain_text 'my-class'
|
|
97
97
|
expect(document.body.div.span['data-content']).to contain_text 'my content'
|
98
98
|
```
|
99
99
|
|
100
|
+
#### Retrieve all matching elements
|
101
|
+
To select all matching elements as an array, use `#all`:
|
102
|
+
```ruby
|
103
|
+
expect(document.span.all.map(&:text)).to eql ['foo', 'bar', 'baz']
|
104
|
+
```
|
105
|
+
|
100
106
|
#### Indexing a Matching Set
|
101
107
|
To select an index from a set of matched elements use the array-style interface (the first matching element is `1`, not `0`):
|
102
108
|
```ruby
|
data/lib/rspec/html/version.rb
CHANGED
data/lib/rspec_html/element.rb
CHANGED
data/lib/rspec_html/search.rb
CHANGED
@@ -39,6 +39,12 @@ module RSpecHTML
|
|
39
39
|
@element.attributes.key?('checked')
|
40
40
|
end
|
41
41
|
|
42
|
+
def all
|
43
|
+
return [] if @siblings.nil?
|
44
|
+
|
45
|
+
@siblings.map { |sibling| Element.new(sibling, @element&.name) }
|
46
|
+
end
|
47
|
+
|
42
48
|
# rubocop:disable Naming/PredicateName
|
43
49
|
def has_css?(*args)
|
44
50
|
!@element&.css(*args)&.empty?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-html
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Farrell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|