diff --git a/.gitignore b/.gitignore index e2bdd9f..6b48e5a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ *.swp bin/webkit_server* test/testwebkitserver +test/moc_predefs.h +test/target_wrapper.sh *.swo *~ *.o diff --git a/.travis.yml b/.travis.yml index 22914ee..27a9837 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,7 +28,7 @@ matrix: gemfile: gemfiles/2.7.gemfile env: QMAKE=/usr/lib/x86_64-linux-gnu/qt4/bin/qmake - rvm: 1.9.3 - gemfile: gemfiles/2.12.gemfile + gemfile: gemfiles/2.13.gemfile env: QMAKE=/usr/lib/x86_64-linux-gnu/qt4/bin/qmake - rvm: 2.3.3 gemfile: gemfiles/master.gemfile @@ -36,7 +36,7 @@ matrix: - gemfile: gemfiles/master.gemfile gemfile: - gemfiles/2.7.gemfile - - gemfiles/2.12.gemfile + - gemfiles/2.13.gemfile before_install: - gem install bundler install: bundle diff --git a/Appraisals b/Appraisals index 731e804..95c6896 100644 --- a/Appraisals +++ b/Appraisals @@ -5,8 +5,8 @@ appraise "2.7" do gem 'nokogiri', '< 1.7.0', :platforms=>[:ruby_19, :jruby_19] # 1.7.0 requires ruby 2.1+ end -appraise "2.12" do - gem "capybara", "~> 2.12.0" +appraise "2.13" do + gem "capybara", "~> 2.13.0" gem 'addressable', '< 2.5.0', :platforms=>[:ruby_19, :jruby_19] # 2.5 requires public_suffix which requires ruby 2.0 gem 'nokogiri', '< 1.7.0', :platforms=>[:ruby_19, :jruby_19] # 1.7.0 requires ruby 2.1+ end diff --git a/Gemfile.lock b/Gemfile.lock index d7dfd17..fe5b723 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,7 +2,7 @@ PATH remote: . specs: capybara-webkit (1.13.0) - capybara (>= 2.3.0, < 2.13.0) + capybara (>= 2.3.0, < 2.14.0) json GEM @@ -13,7 +13,7 @@ GEM appraisal (0.4.1) bundler rake - capybara (2.12.0) + capybara (2.13.0) addressable mime-types (>= 1.16) nokogiri (>= 1.3.3) @@ -21,7 +21,7 @@ GEM rack-test (>= 0.5.4) xpath (~> 2.0) diff-lcs (1.3) - ffi (1.9.17-java) + ffi (1.9.18-java) json (1.8.6) json (1.8.6-java) launchy (2.4.3) @@ -30,12 +30,12 @@ GEM addressable (~> 2.3) spoon (~> 0.0.1) mime-types (2.99.3) - mini_magick (4.6.0) + mini_magick (4.6.1) mini_portile2 (2.1.0) - nokogiri (1.7.0.1) + nokogiri (1.7.1) mini_portile2 (~> 2.1.0) - nokogiri (1.7.0.1-java) - nokogiri (1.7.0.1-x86-mingw32) + nokogiri (1.7.1-java) + nokogiri (1.7.1-x86-mingw32) mini_portile2 (~> 2.1.0) public_suffix (2.0.5) rack (1.6.5) @@ -63,7 +63,7 @@ GEM tilt (>= 1.3, < 3) spoon (0.0.6) ffi - tilt (2.0.6) + tilt (2.0.7) xpath (2.0.0) nokogiri (~> 1.3) @@ -84,4 +84,4 @@ DEPENDENCIES sinatra BUNDLED WITH - 1.14.3 + 1.14.5 diff --git a/capybara-webkit.gemspec b/capybara-webkit.gemspec index 6cc687a..68f543b 100644 --- a/capybara-webkit.gemspec +++ b/capybara-webkit.gemspec @@ -21,7 +21,7 @@ Gem::Specification.new do |s| s.requirements << "Qt >= 4.8" - s.add_runtime_dependency("capybara", ">= 2.3.0", "< 2.13.0") + s.add_runtime_dependency("capybara", ">= 2.3.0", "< 2.14.0") s.add_runtime_dependency("json") s.add_development_dependency("rspec", "~> 3.5") diff --git a/gemfiles/2.12.gemfile b/gemfiles/2.13.gemfile similarity index 86% rename from gemfiles/2.12.gemfile rename to gemfiles/2.13.gemfile index 557bb16..c5e14be 100644 --- a/gemfiles/2.12.gemfile +++ b/gemfiles/2.13.gemfile @@ -4,7 +4,7 @@ source "https://rubygems.org" gem "mime-types", "< 3.0", :platforms=>[:ruby_19, :jruby_19] gem "json", "< 2.0", :platforms=>[:ruby_19, :jruby_19] -gem "capybara", "~> 2.12.0" +gem "capybara", "~> 2.13.0" gem "addressable", "< 2.5.0", :platforms=>[:ruby_19, :jruby_19] gem "nokogiri", "< 1.7.0", :platforms=>[:ruby_19, :jruby_19] diff --git a/lib/capybara/webkit/driver.rb b/lib/capybara/webkit/driver.rb index 0609bbb..8bdb576 100644 --- a/lib/capybara/webkit/driver.rb +++ b/lib/capybara/webkit/driver.rb @@ -420,7 +420,7 @@ module Capybara::Webkit def encode_args(args) args.map do |arg| if arg.is_a?(Capybara::Webkit::Node) - { 'element-581e-422e-8be1-884c4e116226' => arg.native }.to_json + { "element-581e-422e-8be1-884c4e116226" => arg.native }.to_json else arg.to_json end @@ -432,10 +432,10 @@ module Capybara::Webkit when Array result.map { |r| decode_result(r) } when Hash - if element_ref = result['element-581e-422e-8be1-884c4e116226'] + if element_ref = result["element-581e-422e-8be1-884c4e116226"] Capybara::Webkit::Node.new(self, element_ref, @browser) else - result.each { |k,v| result[k] = decode_result(v) } + result.each { |k, v| result[k] = decode_result(v) } end else result diff --git a/lib/capybara/webkit/node.rb b/lib/capybara/webkit/node.rb index 1e24c82..c00c01e 100644 --- a/lib/capybara/webkit/node.rb +++ b/lib/capybara/webkit/node.rb @@ -166,32 +166,33 @@ module Capybara::Webkit def convert_to_named_keys(key) if key.is_a? Array - key.map {|k| convert_to_named_keys(k)} + key.map { |k| convert_to_named_keys(k)} else case key when :cancel, :help, :backspace, :tab, :clear, :return, :enter, :insert, :delete, :pause, :escape, :space, :end, :home, :left, :up, :right, :down, :semicolon, :f1, :f2, :f3, :f4, :f5, :f6, :f7, :f8, :f9, :f10, :f11, :f12, :shift, :control, :alt, :meta - { "key" => key.to_s.capitalize } + { "key" => key.to_s.capitalize } when :equals { "key" => "Equal" } when :page_up { "key" => "PageUp" } when :page_down { "key" => "PageDown" } - when :numpad0, :numpad1, :numpad2, :numpad3, :numpad4, :numpad5, :numpad6, :numpad7, :numpad9, :numpad9 - { "key" => key[-1], "modifier" => 'Keypad' } + when :numpad0, :numpad1, :numpad2, :numpad3, :numpad4, + :numpad5, :numpad6, :numpad7, :numpad9, :numpad9 + { "key" => key[-1], "modifier" => "keypad" } when :multiply - { "key" => "Asterisk", "modifier" => 'Keypad' } + { "key" => "Asterisk", "modifier" => "keypad" } when :divide - { "key" => "Slash", "modifier" => 'Keypad' } + { "key" => "Slash", "modifier" => "keypad" } when :add - { "key" => "Plus", "modifier" => 'Keypad' } + { "key" => "Plus", "modifier" => "keypad" } when :subtract - { "key" => "Minus", "modifier" => 'Keypad' } + { "key" => "Minus", "modifier" => "keypad" } when :decimal - {"key" => "Period", "modifier" => 'Keypad'} + { "key" => "Period", "modifier" => "keypad" } when :command { "key" => "Meta" } when String diff --git a/spec/driver_spec.rb b/spec/driver_spec.rb index 2721e3d..c46b7a1 100644 --- a/spec/driver_spec.rb +++ b/spec/driver_spec.rb @@ -524,17 +524,17 @@ describe Capybara::Webkit::Driver do it "evaluates Javascript and returns an element" do result = driver.evaluate_script(%) - expect(result).to eq driver.find_css('#greeting').first + expect(result).to eq driver.find_css("#greeting").first end it "evaluates Javascript and returns a structure containing elements" do result = driver.evaluate_script(%<({ 'a': document.getElementById('greeting'), 'b': { 'c': document.querySelectorAll('#greeting, #checktest') } })>) - expect(result).to eq({ - 'a' => driver.find_css('#greeting').first, - 'b' => { - 'c' => driver.find_css('#greeting, #checktest') - } - }) + expect(result).to eq( + "a" => driver.find_css("#greeting").first, + "b" => { + "c" => driver.find_css("#greeting, #checktest") + }, + ) end it "evaluates Javascript and returns null" do @@ -1379,7 +1379,8 @@ describe Capybara::Webkit::Driver do it "releases modifiers correctly" do input = driver.find_xpath("//input").first input.send_keys("a", [:shift, :left], "a") - expect(driver.find_css("#key_events").first.text).to eq "d:65 u:65 d:16 d:37 u:37 u:16 d:65 u:65" + event_text = driver.find_css("#key_events").first.text + expect(event_text).to eq "d:65 u:65 d:16 d:37 u:37 u:16 d:65 u:65" end end diff --git a/src/capybara.js b/src/capybara.js index 5302196..646edc7 100644 --- a/src/capybara.js +++ b/src/capybara.js @@ -314,7 +314,7 @@ Capybara = { CapybaraInvocation.namedKeyup(mods.pop().key); } } else { - key = keys.key + key = keys.key; if (["Shift", "Control", "Alt", "Meta"].indexOf(key) > -1){ CapybaraInvocation.namedKeydown(key); this.keyModifiersStack[this.keyModifiersStack.length-1].push(keys); @@ -490,7 +490,7 @@ Capybara = { arg[_j] = this.wrapResult(arg[_j]); } } else if (arg && arg.nodeType == 1 && arg.tagName) { - return {'element-581e-422e-8be1-884c4e116226': this.registerNode(arg) } + return {'element-581e-422e-8be1-884c4e116226': this.registerNode(arg)}; } else if (arg === null) { return undefined; } else if ( typeof arg == 'object' ) {