webkit_remote 0.5.0 → 0.5.1

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: 95ab18456b034195d0905cf56ab3a5d7915ce186
4
- data.tar.gz: fc8dad063ba5493c45e6ff9017b9c954d1a09453
3
+ metadata.gz: bb9d8b3286536660ca3d24fa8a141624cf481ac7
4
+ data.tar.gz: 230b9d1de0ac94e75371b5b70008d34a0f314827
5
5
  SHA512:
6
- metadata.gz: 8170978254202fcfba7393ceeb536292302d1c4710ac6e77d03f271e0faccd0ccc5a9fcdf58549edbe342301a2af241c0eab0822845444dc9f64d09ae9fc35c2
7
- data.tar.gz: 90c803cb8956bc3da08a4c474aae08f80632528b4f5f3dbdaff555845150724ad4681530a2acd1a7034687d19770daa332dda2c9563df439ee309f7ba03db6d8
6
+ metadata.gz: 7f81789922130b6afaff41745a2476c9d6dc724cec3f0c9c2159f828598a2ee4ad0af1f513f259c3bb66b21ee0e7bdc6ca02829049afbd0915b8034b9184ae6b
7
+ data.tar.gz: 9c28a1f6f474f6e0992629e1d15e67f204e9891770f9a32fda629b2e555c00dd37b77c7b93217afd37f68c66759ac9a3ca3ecbae92b6277c9247c420722dcd4b
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.0
1
+ 0.5.1
@@ -28,7 +28,7 @@ module Dom
28
28
 
29
29
  # Looks up cached information about a DOM node.
30
30
  #
31
- # @private Use WebkitRemote::Client::Dom#querySelector or the other public
31
+ # @private Use WebkitRemote::Client::Dom#query_selector or the other public
32
32
  # APIs instead of calling this directly
33
33
  #
34
34
  # @param [String] remote_id value of the nodeId attribute in the JSON
@@ -139,11 +139,14 @@ class DomNode
139
139
  #
140
140
  # @param [String] css_selector the CSS selector that must be matched by the
141
141
  # returned node
142
- # @return [WebkitRemote::Client::DomNode] DOM nodes in this node's subtree
143
- # that match the given selector
142
+ # @return [WebkitRemote::Client::DomNode] the first DOM node in this node's
143
+ # subtree that matches the given selector; if no such node exists, nil is
144
+ # returned
144
145
  def query_selector(css_selector)
145
146
  result = @client.rpc.call 'DOM.querySelector', nodeId: @remote_id,
146
147
  selector: css_selector
148
+ node_id = result['nodeId']
149
+ return nil if node_id == 0
147
150
  @client.dom_node result['nodeId']
148
151
  end
149
152
 
@@ -38,18 +38,27 @@ describe WebkitRemote::Client::DomNode do
38
38
  end
39
39
 
40
40
  describe 'querySelector' do
41
- before :all do
42
- @p = @root.query_selector 'p#load-confirmation'
43
- end
41
+ describe 'with a selector that matches' do
42
+ before :all do
43
+ @p = @root.query_selector 'p#load-confirmation'
44
+ end
45
+
46
+ it 'returns a WebkitRemote::Client::DomNode' do
47
+ @p.must_be_kind_of WebkitRemote::Client::DomNode
48
+ end
44
49
 
45
- it 'returns a WebkitRemote::Client::DomNode' do
46
- @p.must_be_kind_of WebkitRemote::Client::DomNode
50
+ it 'returns a WebkitRemote::Client::DomNode with correct attributes' do
51
+ skip 'On-demand node processing not implemented'
52
+ @p.node_type.must_equal :element
53
+ @p.name.must_equal 'P'
54
+ end
47
55
  end
48
56
 
49
- it 'returns a WebkitRemote::Client::DomNode with correct attributes' do
50
- skip 'On-demand node processing not implemented'
51
- @p.node_type.must_equal :element
52
- @p.name.must_equal 'P'
57
+ describe 'with a selector that does not match' do
58
+ it 'returns nil' do
59
+ node = @root.query_selector '#this-id-should-not-exist'
60
+ node.must_equal nil
61
+ end
53
62
  end
54
63
  end
55
64
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "webkit_remote"
8
- s.version = "0.5.0"
8
+ s.version = "0.5.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Victor Costan"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webkit_remote
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Costan