touch_action 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/CHANGELOG.md +9 -0
 - data/README.md +12 -1
 - data/lib/touch_action/capybara_rspec_helper.rb +19 -0
 - data/lib/touch_action/javascripts/touch_action.js.erb +47 -0
 - data/lib/touch_action/script_generator.rb +32 -0
 - data/lib/touch_action/selenium-webdriver.rb +15 -0
 - data/lib/touch_action/version.rb +1 -1
 - data/lib/touch_action/watir-webdriver.rb +14 -0
 - data/lib/touch_action.rb +7 -48
 - data/spec/features/tap_spec.rb +10 -2
 - data/spec/spec_helper.rb +11 -3
 - data/spec/unit/capybara/rspec_helper_spec.rb +8 -0
 - data/spec/unit/selenium-webdriver/element_spec.rb +11 -0
 - data/spec/unit/watir-webdriver/element_spec.rb +1 -1
 - data/touch_action.gemspec +3 -2
 - metadata +29 -11
 - data/lib/touch_action/javascripts/doubletap.js.erb +0 -40
 - data/lib/touch_action/javascripts/flick.js.erb +0 -44
 - data/lib/touch_action/javascripts/move.js.erb +0 -44
 - data/lib/touch_action/javascripts/pinch.js.erb +0 -41
 - data/lib/touch_action/javascripts/press.js.erb +0 -41
 - data/lib/touch_action/javascripts/rotate.js.erb +0 -39
 - data/lib/touch_action/javascripts/tap.js.erb +0 -40
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: ac69e5fc03cafbb3f96364acbd76a79e019f9d8c
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: c03002404832e2f0db41aa555d9b78e1cb2a41d0
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 6b14239c58b2950a8e6e68b9c6eb02d4f70b1095579d42ff4d6ad78f5a5d150b6f3708766226544ef534527e372d5da8d553766e039f73658a1a0defbe0ddf94
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 2c139c4b07ae7003ea18aa083d3acf0d888386274365ce563f12f5f13eba1ba4cc836df17bbfa8721237fd441ee3e015b50c918f7c012a49a0ea966a15424f12
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | 
         @@ -2,7 +2,7 @@ 
     | 
|
| 
       2 
2 
     | 
    
         
             
            [](https://travis-ci.org/Ricardonacif/touch_action)
         
     | 
| 
       3 
3 
     | 
    
         
             
            [](https://codeclimate.com/github/Ricardonacif/touch_action)
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
     | 
    
         
            -
            Touch Action is a Ruby Gem used to add touch gestures simulation to the Watir-WebDriver  
     | 
| 
      
 5 
     | 
    
         
            +
            Touch Action is a Ruby Gem used to add touch gestures simulation to the Watir-WebDriver, Selenium-WebDriver anc Capybara in order to perform automated tests on (mobile and desktops) websites that requires those type of actions. It encapsulates the touch action library of [YUI JS](http://yuilibrary.com/yui/docs/event/simulate.html#simulating-touch-gestures). Very useful for example when testing mobile websites using [Appium](http://appium.io).
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
            ## Installation
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
         @@ -44,6 +44,17 @@ It's currently supporting the gestures bellow. The only required argument is the 
     | 
|
| 
       44 
44 
     | 
    
         | 
| 
       45 
45 
     | 
    
         
             
              element.touch_action(:rotate, {rotation: -75})
         
     | 
| 
       46 
46 
     | 
    
         | 
| 
      
 47 
     | 
    
         
            +
            ```
         
     | 
| 
      
 48 
     | 
    
         
            +
            ###Capybara and RSpec
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
            To use it with Capybara and Rspec, just do the following:
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 53 
     | 
    
         
            +
                it "should tap using capybara", js: true do
         
     | 
| 
      
 54 
     | 
    
         
            +
                    visit('http://mywebsite.com')
         
     | 
| 
      
 55 
     | 
    
         
            +
                    touch_action '#myElement', :tap #it will also accept options here
         
     | 
| 
      
 56 
     | 
    
         
            +
                end
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
       47 
58 
     | 
    
         
             
            ```
         
     | 
| 
       48 
59 
     | 
    
         
             
            For more information about how those methods work, please check the [YUI Documentation](http://yuilibrary.com/yui/docs/event/simulate.html#simulating-touch-gestures).
         
     | 
| 
       49 
60 
     | 
    
         | 
| 
         @@ -0,0 +1,19 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'capybara'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require "touch_action/script_generator"
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            module TouchAction
         
     | 
| 
      
 5 
     | 
    
         
            +
              module Capybara
         
     | 
| 
      
 6 
     | 
    
         
            +
                module RspecHelper
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
                  def touch_action locator, *args
         
     | 
| 
      
 9 
     | 
    
         
            +
                    final_script = TouchAction::ScriptGenerator.generate_javascript(*args)
         
     | 
| 
      
 10 
     | 
    
         
            +
                    page.driver.browser.execute_script( final_script, locator )
         
     | 
| 
      
 11 
     | 
    
         
            +
                  end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                end
         
     | 
| 
      
 14 
     | 
    
         
            +
              end
         
     | 
| 
      
 15 
     | 
    
         
            +
            end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            RSpec.configure do |config|
         
     | 
| 
      
 18 
     | 
    
         
            +
              config.include TouchAction::Capybara::RspecHelper, :type => :feature
         
     | 
| 
      
 19 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,47 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            (function( touch_action, $, undefined ) {
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
              // private property
         
     | 
| 
      
 4 
     | 
    
         
            +
              var execute_gesture = function() {
         
     | 
| 
      
 5 
     | 
    
         
            +
                YUI().use('node-event-simulate', function(Y) {
         
     | 
| 
      
 6 
     | 
    
         
            +
                  
         
     | 
| 
      
 7 
     | 
    
         
            +
                  var node = Y.one(touch_action.element);
         
     | 
| 
      
 8 
     | 
    
         
            +
                  node.simulateGesture(touch_action.gesture, touch_action.options);
         
     | 
| 
      
 9 
     | 
    
         
            +
                    
         
     | 
| 
      
 10 
     | 
    
         
            +
                });
         
     | 
| 
      
 11 
     | 
    
         
            +
              };
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
              // private method
         
     | 
| 
      
 14 
     | 
    
         
            +
              function loadYui() { 
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                var head = document.getElementsByTagName('head')[0];
         
     | 
| 
      
 17 
     | 
    
         
            +
                var script = document.createElement('script');
         
     | 
| 
      
 18 
     | 
    
         
            +
                script.type = 'text/javascript';
         
     | 
| 
      
 19 
     | 
    
         
            +
                script.src = "//yui.yahooapis.com/3.18.1/build/yui/yui-min.js";
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                script.onreadystatechange = execute_gesture;
         
     | 
| 
      
 22 
     | 
    
         
            +
                script.onload = execute_gesture;
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                head.appendChild(script);
         
     | 
| 
      
 25 
     | 
    
         
            +
             
         
     | 
| 
      
 26 
     | 
    
         
            +
              };
         
     | 
| 
      
 27 
     | 
    
         
            +
              // public method
         
     | 
| 
      
 28 
     | 
    
         
            +
              touch_action.perform = function() {
         
     | 
| 
      
 29 
     | 
    
         
            +
                
         
     | 
| 
      
 30 
     | 
    
         
            +
                if (typeof YUI == 'undefined') {
         
     | 
| 
      
 31 
     | 
    
         
            +
                  loadYui();
         
     | 
| 
      
 32 
     | 
    
         
            +
                } else {
         
     | 
| 
      
 33 
     | 
    
         
            +
                  execute_gesture();
         
     | 
| 
      
 34 
     | 
    
         
            +
                };
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
              };
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
            }( window.touch_action = window.touch_action || {} ));
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
            touch_action.element = arguments[0];
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
            touch_action.gesture = "<%=gesture%>";
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
            touch_action.options =  <%=options.to_json%>;
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
            touch_action.perform();
         
     | 
| 
         @@ -0,0 +1,32 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'erb'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'ostruct'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            module TouchAction
         
     | 
| 
      
 5 
     | 
    
         
            +
              class ScriptGenerator
         
     | 
| 
      
 6 
     | 
    
         
            +
                ACTIONS_WITH_DEFAULT_OPTIONS = {
         
     | 
| 
      
 7 
     | 
    
         
            +
                  tap: {},
         
     | 
| 
      
 8 
     | 
    
         
            +
                  doubletap: {},
         
     | 
| 
      
 9 
     | 
    
         
            +
                  flick: {axis: 'x', distance: 100,  duration: 500},
         
     | 
| 
      
 10 
     | 
    
         
            +
                  pinch: {r1: 50, r2: 100},
         
     | 
| 
      
 11 
     | 
    
         
            +
                  press: {hold: 2000},
         
     | 
| 
      
 12 
     | 
    
         
            +
                  move: {path: {xdist: 70, ydist: -50},  duration: 500},
         
     | 
| 
      
 13 
     | 
    
         
            +
                  rotate: {rotation: -75}
         
     | 
| 
      
 14 
     | 
    
         
            +
                }
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                def self.generate_javascript action, options = {}
         
     | 
| 
      
 17 
     | 
    
         
            +
                  action = :flick if action == :swipe
         
     | 
| 
      
 18 
     | 
    
         
            +
                  raise ArgumentError, "The touch action #{action} doesn't exist" unless ACTIONS_WITH_DEFAULT_OPTIONS[action]
         
     | 
| 
      
 19 
     | 
    
         
            +
                  script = File.read(File.expand_path("../javascripts/touch_action.js.erb", __FILE__))
         
     | 
| 
      
 20 
     | 
    
         
            +
                  default_options = ACTIONS_WITH_DEFAULT_OPTIONS[action]
         
     | 
| 
      
 21 
     | 
    
         
            +
                  arguments = {gesture: action.to_s, options: default_options.merge(options)}
         
     | 
| 
      
 22 
     | 
    
         
            +
                  render_erb(script, arguments)
         
     | 
| 
      
 23 
     | 
    
         
            +
                end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
              private
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                def self.render_erb template, vars = {}
         
     | 
| 
      
 28 
     | 
    
         
            +
                  ERB.new(template).result(OpenStruct.new(vars).instance_eval { binding })
         
     | 
| 
      
 29 
     | 
    
         
            +
                end
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
              end
         
     | 
| 
      
 32 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,15 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'selenium-webdriver'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require "touch_action/script_generator"
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            module TouchAction
         
     | 
| 
      
 5 
     | 
    
         
            +
              module SeleniumWebdriver
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                def touch_action *args
         
     | 
| 
      
 8 
     | 
    
         
            +
                  final_script = TouchAction::ScriptGenerator.generate_javascript(*args)
         
     | 
| 
      
 9 
     | 
    
         
            +
                  bridge.executeScript( final_script, self )
         
     | 
| 
      
 10 
     | 
    
         
            +
                end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
              end
         
     | 
| 
      
 13 
     | 
    
         
            +
            end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            Selenium::WebDriver::Element.class_eval { include TouchAction::SeleniumWebdriver }
         
     | 
    
        data/lib/touch_action/version.rb
    CHANGED
    
    
| 
         @@ -0,0 +1,14 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'watir-webdriver'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require "touch_action/script_generator"
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            module TouchAction
         
     | 
| 
      
 5 
     | 
    
         
            +
              module WatirWebdriver
         
     | 
| 
      
 6 
     | 
    
         
            +
                def touch_action *args
         
     | 
| 
      
 7 
     | 
    
         
            +
                  final_script = TouchAction::ScriptGenerator.generate_javascript(*args)
         
     | 
| 
      
 8 
     | 
    
         
            +
                  browser.execute_script( final_script, self )
         
     | 
| 
      
 9 
     | 
    
         
            +
                end
         
     | 
| 
      
 10 
     | 
    
         
            +
              end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            Watir::Element.class_eval { include TouchAction::WatirWebdriver }
         
     | 
    
        data/lib/touch_action.rb
    CHANGED
    
    | 
         @@ -1,54 +1,13 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'erb'
         
     | 
| 
       2 
     | 
    
         
            -
            require 'ostruct'
         
     | 
| 
       3 
1 
     | 
    
         
             
            require "touch_action/version"
         
     | 
| 
       4 
2 
     | 
    
         | 
| 
       5 
3 
     | 
    
         
             
            if Gem::Specification::find_all_by_name('watir-webdriver').any?
         
     | 
| 
       6 
     | 
    
         
            -
              require 'watir-webdriver'
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
              require 'selenium-webdriver'
         
     | 
| 
       9 
     | 
    
         
            -
            end
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
            module TouchAction
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
              ACTIONS_WITH_DEFAULT_OPTIONS = {
         
     | 
| 
       15 
     | 
    
         
            -
                tap: {},
         
     | 
| 
       16 
     | 
    
         
            -
                doubletap: {},
         
     | 
| 
       17 
     | 
    
         
            -
                flick: {axis: 'x', distance: 100,  duration: 50},
         
     | 
| 
       18 
     | 
    
         
            -
                pinch: {r1: 50, r2: 100},
         
     | 
| 
       19 
     | 
    
         
            -
                press: {hold: 2000},
         
     | 
| 
       20 
     | 
    
         
            -
                move: {xdist: 70, ydist: -50,  duration: 500},
         
     | 
| 
       21 
     | 
    
         
            -
                rotate: {rotation: -75}
         
     | 
| 
       22 
     | 
    
         
            -
              }
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
              def touch_action action, options = {}
         
     | 
| 
       25 
     | 
    
         
            -
                action = :flick if action == :swipe
         
     | 
| 
       26 
     | 
    
         
            -
                raise ArgumentError, "The touch action #{action} doesn't exist" unless ACTIONS_WITH_DEFAULT_OPTIONS[action]
         
     | 
| 
       27 
     | 
    
         
            -
                default_options = ACTIONS_WITH_DEFAULT_OPTIONS[action]
         
     | 
| 
       28 
     | 
    
         
            -
                options = default_options.merge options
         
     | 
| 
       29 
     | 
    
         
            -
                script = File.read(File.expand_path("../touch_action/javascripts/#{action.to_s}.js.erb", __FILE__))
         
     | 
| 
       30 
     | 
    
         
            -
                final_script = render_erb(script, options)
         
     | 
| 
       31 
     | 
    
         
            -
                if self.class == Selenium::WebDriver::Element
         
     | 
| 
       32 
     | 
    
         
            -
                  bridge.executeScript( final_script, self )
         
     | 
| 
       33 
     | 
    
         
            -
                else
         
     | 
| 
       34 
     | 
    
         
            -
                  browser.execute_script( final_script, self )
         
     | 
| 
       35 
     | 
    
         
            -
                end
         
     | 
| 
       36 
     | 
    
         
            -
              end
         
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
            private
         
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
              def render_erb template, vars = {}
         
     | 
| 
       41 
     | 
    
         
            -
                ERB.new(template).result(OpenStruct.new(vars).instance_eval { binding })
         
     | 
| 
       42 
     | 
    
         
            -
              end
         
     | 
| 
      
 4 
     | 
    
         
            +
              require 'touch_action/watir-webdriver'
         
     | 
| 
      
 5 
     | 
    
         
            +
            end 
         
     | 
| 
       43 
6 
     | 
    
         | 
| 
      
 7 
     | 
    
         
            +
            if Gem::Specification::find_all_by_name('selenium-webdriver').any?
         
     | 
| 
      
 8 
     | 
    
         
            +
              require 'touch_action/selenium-webdriver'
         
     | 
| 
       44 
9 
     | 
    
         
             
            end
         
     | 
| 
       45 
10 
     | 
    
         | 
| 
       46 
     | 
    
         
            -
            if Gem::Specification::find_all_by_name(' 
     | 
| 
       47 
     | 
    
         
            -
               
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
              Selenium::WebDriver::Element.class_eval { include TouchAction }
         
     | 
| 
       50 
     | 
    
         
            -
            end
         
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
      
 11 
     | 
    
         
            +
            if Gem::Specification::find_all_by_name('capybara').any?
         
     | 
| 
      
 12 
     | 
    
         
            +
              require 'touch_action/capybara_rspec_helper'
         
     | 
| 
      
 13 
     | 
    
         
            +
            end
         
     | 
    
        data/spec/features/tap_spec.rb
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'spec_helper'
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            RSpec.describe TouchAction do
         
     | 
| 
       4 
     | 
    
         
            -
              describe "Tap" do
         
     | 
| 
      
 4 
     | 
    
         
            +
              describe "Tap", type: :feature do
         
     | 
| 
       5 
5 
     | 
    
         
             
                it 'should tap the div bound by HammerJS' do
         
     | 
| 
       6 
6 
     | 
    
         
             
                  @browser.goto('http://localhost:9292/tap')
         
     | 
| 
       7 
7 
     | 
    
         
             
                  element = @browser.div(id: 'myElement')
         
     | 
| 
         @@ -16,5 +16,13 @@ RSpec.describe TouchAction do 
     | 
|
| 
       16 
16 
     | 
    
         
             
                  sleep(5)
         
     | 
| 
       17 
17 
     | 
    
         
             
                  expect(@browser.p(id: 'fast-click-test').text).to include('1 times')
         
     | 
| 
       18 
18 
     | 
    
         
             
                end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                it "should tap using webdriver capybara", js: true, use_webdriver: :capybara do
         
     | 
| 
      
 21 
     | 
    
         
            +
                  visit('http://localhost:9292/tap')
         
     | 
| 
      
 22 
     | 
    
         
            +
                  touch_action '#myElement', :tap
         
     | 
| 
      
 23 
     | 
    
         
            +
                  sleep(5)
         
     | 
| 
      
 24 
     | 
    
         
            +
                  expect(find("#myElement").text).to include('tap')
         
     | 
| 
      
 25 
     | 
    
         
            +
                end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
       19 
27 
     | 
    
         
             
              end
         
     | 
| 
       20 
     | 
    
         
            -
            end
         
     | 
| 
      
 28 
     | 
    
         
            +
            end
         
     | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    | 
         @@ -4,6 +4,8 @@ require 'rack' 
     | 
|
| 
       4 
4 
     | 
    
         
             
            require 'thin'
         
     | 
| 
       5 
5 
     | 
    
         
             
            require 'touch_action'
         
     | 
| 
       6 
6 
     | 
    
         
             
            require 'watir-webdriver'
         
     | 
| 
      
 7 
     | 
    
         
            +
            require 'capybara'
         
     | 
| 
      
 8 
     | 
    
         
            +
            require 'capybara/rspec'
         
     | 
| 
       7 
9 
     | 
    
         | 
| 
       8 
10 
     | 
    
         
             
            Dir["./spec/support/**/*.rb"].sort.each { |f| require f}
         
     | 
| 
       9 
11 
     | 
    
         | 
| 
         @@ -43,12 +45,18 @@ ENV['browser'] ||= 'firefox' 
     | 
|
| 
       43 
45 
     | 
    
         | 
| 
       44 
46 
     | 
    
         
             
            RSpec.configure do |config|
         
     | 
| 
       45 
47 
     | 
    
         | 
| 
       46 
     | 
    
         
            -
              config.before(:each) do
         
     | 
| 
      
 48 
     | 
    
         
            +
              config.before(:each) do |example|
         
     | 
| 
       47 
49 
     | 
    
         
             
                if ENV['platform']
         
     | 
| 
       48 
50 
     | 
    
         
             
                  @browser = Watir::Browser.new(Selenium::WebDriver.for(:remote, :desired_capabilities => capabilities, :url => ENV['appium_url']))
         
     | 
| 
       49 
51 
     | 
    
         
             
                else
         
     | 
| 
       50 
     | 
    
         
            -
                   
     | 
| 
       51 
     | 
    
         
            -
                   
     | 
| 
      
 52 
     | 
    
         
            +
                  case example.metadata[:use_webdriver] 
         
     | 
| 
      
 53 
     | 
    
         
            +
                  when :selenium
         
     | 
| 
      
 54 
     | 
    
         
            +
                    @browser = Selenium::WebDriver.for :firefox
         
     | 
| 
      
 55 
     | 
    
         
            +
                  when :capybara
         
     | 
| 
      
 56 
     | 
    
         
            +
                    #do nothing
         
     | 
| 
      
 57 
     | 
    
         
            +
                  else
         
     | 
| 
      
 58 
     | 
    
         
            +
                    @browser = Watir::Browser.new ENV['browser']
         
     | 
| 
      
 59 
     | 
    
         
            +
                  end
         
     | 
| 
       52 
60 
     | 
    
         
             
                end
         
     | 
| 
       53 
61 
     | 
    
         
             
              end
         
     | 
| 
       54 
62 
     | 
    
         
             
              config.after(:each) do
         
     | 
| 
         @@ -0,0 +1,8 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'spec_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            RSpec.describe TouchAction::Capybara::RspecHelper, type: :feature do
         
     | 
| 
      
 4 
     | 
    
         
            +
              it 'should respond to the method touch_action', js: true, use_webdriver: :capybara do
         
     | 
| 
      
 5 
     | 
    
         
            +
                visit('http://localhost:9292')
         
     | 
| 
      
 6 
     | 
    
         
            +
                expect(self).to respond_to(:touch_action)
         
     | 
| 
      
 7 
     | 
    
         
            +
              end
         
     | 
| 
      
 8 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,11 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'spec_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            RSpec.describe Selenium::WebDriver::Element do
         
     | 
| 
      
 4 
     | 
    
         
            +
              describe "Selenium::WebDriver instance" do
         
     | 
| 
      
 5 
     | 
    
         
            +
                it 'should respond to the method touch_action', use_webdriver: :selenium do
         
     | 
| 
      
 6 
     | 
    
         
            +
                  @browser.navigate.to('http://localhost:9292')
         
     | 
| 
      
 7 
     | 
    
         
            +
                  element = @browser.find_element(:id, 'hit')
         
     | 
| 
      
 8 
     | 
    
         
            +
                  expect(element).to respond_to(:touch_action)
         
     | 
| 
      
 9 
     | 
    
         
            +
                end
         
     | 
| 
      
 10 
     | 
    
         
            +
              end
         
     | 
| 
      
 11 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -5,7 +5,7 @@ RSpec.describe Watir::Element do 
     | 
|
| 
       5 
5 
     | 
    
         
             
                it 'should respond to the method touch_action' do
         
     | 
| 
       6 
6 
     | 
    
         
             
                  @browser.goto('http://localhost:9292')
         
     | 
| 
       7 
7 
     | 
    
         
             
                  element = @browser.div(id: 'hit')
         
     | 
| 
       8 
     | 
    
         
            -
                  expect(element.respond_to 
     | 
| 
      
 8 
     | 
    
         
            +
                  expect(element).to respond_to(:touch_action)
         
     | 
| 
       9 
9 
     | 
    
         
             
                end
         
     | 
| 
       10 
10 
     | 
    
         
             
              end
         
     | 
| 
       11 
11 
     | 
    
         
             
            end
         
     | 
    
        data/touch_action.gemspec
    CHANGED
    
    | 
         @@ -8,8 +8,8 @@ Gem::Specification.new do |spec| 
     | 
|
| 
       8 
8 
     | 
    
         
             
              spec.version       = TouchAction::VERSION
         
     | 
| 
       9 
9 
     | 
    
         
             
              spec.authors       = ["Ricardo Nacif"]
         
     | 
| 
       10 
10 
     | 
    
         
             
              spec.email         = ["nacif.ricardo@gmail.com"]
         
     | 
| 
       11 
     | 
    
         
            -
              spec.summary       = "Adds touch gestures to Watir-WebDriver  
     | 
| 
       12 
     | 
    
         
            -
              spec.description   = "Adds touch gestures to Watir and  
     | 
| 
      
 11 
     | 
    
         
            +
              spec.summary       = "Adds touch gestures simulation to Watir-WebDriver, Selenium-WebDriver and Capybara using YUI JS."
         
     | 
| 
      
 12 
     | 
    
         
            +
              spec.description   = "Adds touch gestures simulation to Watir, Selenium and Capybara using YUI JS."
         
     | 
| 
       13 
13 
     | 
    
         
             
              spec.homepage      = "https://github.com/Ricardonacif/touch_action"
         
     | 
| 
       14 
14 
     | 
    
         
             
              spec.license       = "MIT"
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
         @@ -19,6 +19,7 @@ Gem::Specification.new do |spec| 
     | 
|
| 
       19 
19 
     | 
    
         
             
              spec.require_paths = ["lib"]
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
21 
     | 
    
         
             
              spec.add_development_dependency "watir-webdriver"
         
     | 
| 
      
 22 
     | 
    
         
            +
              spec.add_development_dependency "capybara"
         
     | 
| 
       22 
23 
     | 
    
         | 
| 
       23 
24 
     | 
    
         
             
              spec.add_development_dependency "bundler", "~> 1.7"
         
     | 
| 
       24 
25 
     | 
    
         
             
              spec.add_development_dependency "rake", "~> 10.0"
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: touch_action
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.1.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Ricardo Nacif
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2015-01-05 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: watir-webdriver
         
     | 
| 
         @@ -24,6 +24,20 @@ dependencies: 
     | 
|
| 
       24 
24 
     | 
    
         
             
                - - ">="
         
     | 
| 
       25 
25 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       26 
26 
     | 
    
         
             
                    version: '0'
         
     | 
| 
      
 27 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 28 
     | 
    
         
            +
              name: capybara
         
     | 
| 
      
 29 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 30 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 31 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 32 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 33 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 34 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 35 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 36 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 37 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 38 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 39 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 40 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
       27 
41 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       28 
42 
     | 
    
         
             
              name: bundler
         
     | 
| 
       29 
43 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -108,7 +122,8 @@ dependencies: 
     | 
|
| 
       108 
122 
     | 
    
         
             
                - - ">="
         
     | 
| 
       109 
123 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       110 
124 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       111 
     | 
    
         
            -
            description: Adds touch gestures to Watir and  
     | 
| 
      
 125 
     | 
    
         
            +
            description: Adds touch gestures simulation to Watir, Selenium and Capybara using
         
     | 
| 
      
 126 
     | 
    
         
            +
              YUI JS.
         
     | 
| 
       112 
127 
     | 
    
         
             
            email:
         
     | 
| 
       113 
128 
     | 
    
         
             
            - nacif.ricardo@gmail.com
         
     | 
| 
       114 
129 
     | 
    
         
             
            executables: []
         
     | 
| 
         @@ -124,14 +139,12 @@ files: 
     | 
|
| 
       124 
139 
     | 
    
         
             
            - README.md
         
     | 
| 
       125 
140 
     | 
    
         
             
            - Rakefile
         
     | 
| 
       126 
141 
     | 
    
         
             
            - lib/touch_action.rb
         
     | 
| 
       127 
     | 
    
         
            -
            - lib/touch_action/ 
     | 
| 
       128 
     | 
    
         
            -
            - lib/touch_action/javascripts/ 
     | 
| 
       129 
     | 
    
         
            -
            - lib/touch_action/ 
     | 
| 
       130 
     | 
    
         
            -
            - lib/touch_action/ 
     | 
| 
       131 
     | 
    
         
            -
            - lib/touch_action/javascripts/press.js.erb
         
     | 
| 
       132 
     | 
    
         
            -
            - lib/touch_action/javascripts/rotate.js.erb
         
     | 
| 
       133 
     | 
    
         
            -
            - lib/touch_action/javascripts/tap.js.erb
         
     | 
| 
      
 142 
     | 
    
         
            +
            - lib/touch_action/capybara_rspec_helper.rb
         
     | 
| 
      
 143 
     | 
    
         
            +
            - lib/touch_action/javascripts/touch_action.js.erb
         
     | 
| 
      
 144 
     | 
    
         
            +
            - lib/touch_action/script_generator.rb
         
     | 
| 
      
 145 
     | 
    
         
            +
            - lib/touch_action/selenium-webdriver.rb
         
     | 
| 
       134 
146 
     | 
    
         
             
            - lib/touch_action/version.rb
         
     | 
| 
      
 147 
     | 
    
         
            +
            - lib/touch_action/watir-webdriver.rb
         
     | 
| 
       135 
148 
     | 
    
         
             
            - spec/features/doubletap_spec.rb
         
     | 
| 
       136 
149 
     | 
    
         
             
            - spec/features/flick_spec.rb
         
     | 
| 
       137 
150 
     | 
    
         
             
            - spec/features/move_spec.rb
         
     | 
| 
         @@ -152,6 +165,8 @@ files: 
     | 
|
| 
       152 
165 
     | 
    
         
             
            - spec/support/static_website/public/pinch.html
         
     | 
| 
       153 
166 
     | 
    
         
             
            - spec/support/static_website/public/tap.html
         
     | 
| 
       154 
167 
     | 
    
         
             
            - spec/support/static_website/rack_app.rb
         
     | 
| 
      
 168 
     | 
    
         
            +
            - spec/unit/capybara/rspec_helper_spec.rb
         
     | 
| 
      
 169 
     | 
    
         
            +
            - spec/unit/selenium-webdriver/element_spec.rb
         
     | 
| 
       155 
170 
     | 
    
         
             
            - spec/unit/watir-webdriver/element_spec.rb
         
     | 
| 
       156 
171 
     | 
    
         
             
            - touch_action.gemspec
         
     | 
| 
       157 
172 
     | 
    
         
             
            homepage: https://github.com/Ricardonacif/touch_action
         
     | 
| 
         @@ -177,7 +192,8 @@ rubyforge_project: 
     | 
|
| 
       177 
192 
     | 
    
         
             
            rubygems_version: 2.4.2
         
     | 
| 
       178 
193 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       179 
194 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       180 
     | 
    
         
            -
            summary: Adds touch gestures to Watir-WebDriver  
     | 
| 
      
 195 
     | 
    
         
            +
            summary: Adds touch gestures simulation to Watir-WebDriver, Selenium-WebDriver and
         
     | 
| 
      
 196 
     | 
    
         
            +
              Capybara using YUI JS.
         
     | 
| 
       181 
197 
     | 
    
         
             
            test_files:
         
     | 
| 
       182 
198 
     | 
    
         
             
            - spec/features/doubletap_spec.rb
         
     | 
| 
       183 
199 
     | 
    
         
             
            - spec/features/flick_spec.rb
         
     | 
| 
         @@ -199,4 +215,6 @@ test_files: 
     | 
|
| 
       199 
215 
     | 
    
         
             
            - spec/support/static_website/public/pinch.html
         
     | 
| 
       200 
216 
     | 
    
         
             
            - spec/support/static_website/public/tap.html
         
     | 
| 
       201 
217 
     | 
    
         
             
            - spec/support/static_website/rack_app.rb
         
     | 
| 
      
 218 
     | 
    
         
            +
            - spec/unit/capybara/rspec_helper_spec.rb
         
     | 
| 
      
 219 
     | 
    
         
            +
            - spec/unit/selenium-webdriver/element_spec.rb
         
     | 
| 
       202 
220 
     | 
    
         
             
            - spec/unit/watir-webdriver/element_spec.rb
         
     | 
| 
         @@ -1,40 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
       2 
     | 
    
         
            -
            var element_locator = arguments[0];
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
            function loadYui(callback) {
         
     | 
| 
       5 
     | 
    
         
            -
                // Adding the script tag to the head as suggested before
         
     | 
| 
       6 
     | 
    
         
            -
                var head = document.getElementsByTagName('head')[0];
         
     | 
| 
       7 
     | 
    
         
            -
                var script = document.createElement('script');
         
     | 
| 
       8 
     | 
    
         
            -
                script.type = 'text/javascript';
         
     | 
| 
       9 
     | 
    
         
            -
                script.src = "http://yui.yahooapis.com/3.17.2/build/yui/yui-min.js";
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
                // Then bind the event to the callback function.
         
     | 
| 
       12 
     | 
    
         
            -
                // There are several events for cross browser compatibility.
         
     | 
| 
       13 
     | 
    
         
            -
                script.onreadystatechange = callback;
         
     | 
| 
       14 
     | 
    
         
            -
                script.onload = callback;
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
                // Fire the loading
         
     | 
| 
       17 
     | 
    
         
            -
                head.appendChild(script);
         
     | 
| 
       18 
     | 
    
         
            -
            }
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
            var doubletap = function() {
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
              YUI().use('node-event-simulate', function(Y) {
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
                var node = Y.one(element_locator);
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
                node.simulateGesture("doubletap");
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
              });
         
     | 
| 
       29 
     | 
    
         
            -
             
         
     | 
| 
       30 
     | 
    
         
            -
            };
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
            if (typeof YUI == 'undefined') {
         
     | 
| 
       35 
     | 
    
         
            -
              loadYui(doubletap);
         
     | 
| 
       36 
     | 
    
         
            -
            } else {
         
     | 
| 
       37 
     | 
    
         
            -
              doubletap();
         
     | 
| 
       38 
     | 
    
         
            -
            };
         
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
         @@ -1,44 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
       2 
     | 
    
         
            -
            var element_locator = arguments[0];
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
            function loadYui(callback) {
         
     | 
| 
       5 
     | 
    
         
            -
                // Adding the script tag to the head as suggested before
         
     | 
| 
       6 
     | 
    
         
            -
                var head = document.getElementsByTagName('head')[0];
         
     | 
| 
       7 
     | 
    
         
            -
                var script = document.createElement('script');
         
     | 
| 
       8 
     | 
    
         
            -
                script.type = 'text/javascript';
         
     | 
| 
       9 
     | 
    
         
            -
                script.src = "http://yui.yahooapis.com/3.17.2/build/yui/yui-min.js";
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
                // Then bind the event to the callback function.
         
     | 
| 
       12 
     | 
    
         
            -
                // There are several events for cross browser compatibility.
         
     | 
| 
       13 
     | 
    
         
            -
                script.onreadystatechange = callback;
         
     | 
| 
       14 
     | 
    
         
            -
                script.onload = callback;
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
                // Fire the loading
         
     | 
| 
       17 
     | 
    
         
            -
                head.appendChild(script);
         
     | 
| 
       18 
     | 
    
         
            -
            }
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
            var flick = function() {
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
              YUI().use('node-event-simulate', function(Y) {
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
                var node = Y.one(element_locator);
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
                node.simulateGesture("flick", {
         
     | 
| 
       27 
     | 
    
         
            -
                    axis: "<%=axis%>",
         
     | 
| 
       28 
     | 
    
         
            -
                    distance: <%=distance%>,
         
     | 
| 
       29 
     | 
    
         
            -
                    duration: <%=duration%>
         
     | 
| 
       30 
     | 
    
         
            -
                });
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
              });
         
     | 
| 
       33 
     | 
    
         
            -
             
         
     | 
| 
       34 
     | 
    
         
            -
            };
         
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
            if (typeof YUI == 'undefined') {
         
     | 
| 
       39 
     | 
    
         
            -
              loadYui(flick);
         
     | 
| 
       40 
     | 
    
         
            -
            } else {
         
     | 
| 
       41 
     | 
    
         
            -
              flick();
         
     | 
| 
       42 
     | 
    
         
            -
            };
         
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
         @@ -1,44 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
       2 
     | 
    
         
            -
            var element_locator = arguments[0];
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
            function loadYui(callback) {
         
     | 
| 
       5 
     | 
    
         
            -
                // Adding the script tag to the head as suggested before
         
     | 
| 
       6 
     | 
    
         
            -
                var head = document.getElementsByTagName('head')[0];
         
     | 
| 
       7 
     | 
    
         
            -
                var script = document.createElement('script');
         
     | 
| 
       8 
     | 
    
         
            -
                script.type = 'text/javascript';
         
     | 
| 
       9 
     | 
    
         
            -
                script.src = "http://yui.yahooapis.com/3.17.2/build/yui/yui-min.js";
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
                // Then bind the event to the callback function.
         
     | 
| 
       12 
     | 
    
         
            -
                // There are several events for cross browser compatibility.
         
     | 
| 
       13 
     | 
    
         
            -
                script.onreadystatechange = callback;
         
     | 
| 
       14 
     | 
    
         
            -
                script.onload = callback;
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
                // Fire the loading
         
     | 
| 
       17 
     | 
    
         
            -
                head.appendChild(script);
         
     | 
| 
       18 
     | 
    
         
            -
            }
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
            var move = function() {
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
              YUI().use('node-event-simulate', function(Y) {
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
                var node = Y.one(element_locator);
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
                node.simulateGesture("move", {
         
     | 
| 
       27 
     | 
    
         
            -
                  path: {
         
     | 
| 
       28 
     | 
    
         
            -
                        xdist: <%= xdist %>,
         
     | 
| 
       29 
     | 
    
         
            -
                        ydist: <%= ydist %>
         
     | 
| 
       30 
     | 
    
         
            -
                    } ,
         
     | 
| 
       31 
     | 
    
         
            -
                  duration: <%= duration %>
         
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
                });
         
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
              });
         
     | 
| 
       36 
     | 
    
         
            -
             
         
     | 
| 
       37 
     | 
    
         
            -
            };
         
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
            if (typeof YUI == 'undefined') {
         
     | 
| 
       41 
     | 
    
         
            -
              loadYui(move);
         
     | 
| 
       42 
     | 
    
         
            -
            } else {
         
     | 
| 
       43 
     | 
    
         
            -
              move();
         
     | 
| 
       44 
     | 
    
         
            -
            };
         
     | 
| 
         @@ -1,41 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
       2 
     | 
    
         
            -
            var element_locator = arguments[0];
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
            function loadYui(callback) {
         
     | 
| 
       5 
     | 
    
         
            -
                // Adding the script tag to the head as suggested before
         
     | 
| 
       6 
     | 
    
         
            -
                var head = document.getElementsByTagName('head')[0];
         
     | 
| 
       7 
     | 
    
         
            -
                var script = document.createElement('script');
         
     | 
| 
       8 
     | 
    
         
            -
                script.type = 'text/javascript';
         
     | 
| 
       9 
     | 
    
         
            -
                script.src = "http://yui.yahooapis.com/3.17.2/build/yui/yui-min.js";
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
                // Then bind the event to the callback function.
         
     | 
| 
       12 
     | 
    
         
            -
                // There are several events for cross browser compatibility.
         
     | 
| 
       13 
     | 
    
         
            -
                script.onreadystatechange = callback;
         
     | 
| 
       14 
     | 
    
         
            -
                script.onload = callback;
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
                // Fire the loading
         
     | 
| 
       17 
     | 
    
         
            -
                head.appendChild(script);
         
     | 
| 
       18 
     | 
    
         
            -
            }
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
            var pinch = function() {
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
              YUI().use('node-event-simulate', function(Y) {
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
                var node = Y.one(element_locator);
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
                //simulate a pinch: "r1" and "r2" are required
         
     | 
| 
       27 
     | 
    
         
            -
                node.simulateGesture("pinch", {
         
     | 
| 
       28 
     | 
    
         
            -
                    r1: <%=r1%>, // start circle radius at the center of the node
         
     | 
| 
       29 
     | 
    
         
            -
                    r2: <%=r2%>   // end circle radius at the center of the node
         
     | 
| 
       30 
     | 
    
         
            -
                });
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
              });
         
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
            };
         
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
            if (typeof YUI == 'undefined') {
         
     | 
| 
       38 
     | 
    
         
            -
              loadYui(pinch);
         
     | 
| 
       39 
     | 
    
         
            -
            } else {
         
     | 
| 
       40 
     | 
    
         
            -
              pinch();
         
     | 
| 
       41 
     | 
    
         
            -
            };
         
     | 
| 
         @@ -1,41 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
       2 
     | 
    
         
            -
            var element_locator = arguments[0];
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
            function loadYui(callback) {
         
     | 
| 
       5 
     | 
    
         
            -
                // Adding the script tag to the head as suggested before
         
     | 
| 
       6 
     | 
    
         
            -
                var head = document.getElementsByTagName('head')[0];
         
     | 
| 
       7 
     | 
    
         
            -
                var script = document.createElement('script');
         
     | 
| 
       8 
     | 
    
         
            -
                script.type = 'text/javascript';
         
     | 
| 
       9 
     | 
    
         
            -
                script.src = "http://yui.yahooapis.com/3.17.2/build/yui/yui-min.js";
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
                // Then bind the event to the callback function.
         
     | 
| 
       12 
     | 
    
         
            -
                // There are several events for cross browser compatibility.
         
     | 
| 
       13 
     | 
    
         
            -
                script.onreadystatechange = callback;
         
     | 
| 
       14 
     | 
    
         
            -
                script.onload = callback;
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
                // Fire the loading
         
     | 
| 
       17 
     | 
    
         
            -
                head.appendChild(script);
         
     | 
| 
       18 
     | 
    
         
            -
            }
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
            var press = function() {
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
              YUI().use('node-event-simulate', function(Y) {
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
                var node = Y.one(element_locator);
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
                node.simulateGesture("press", {
         
     | 
| 
       27 
     | 
    
         
            -
                    hold: <%=hold%>
         
     | 
| 
       28 
     | 
    
         
            -
                });
         
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
              });
         
     | 
| 
       31 
     | 
    
         
            -
             
         
     | 
| 
       32 
     | 
    
         
            -
            };
         
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
            if (typeof YUI == 'undefined') {
         
     | 
| 
       36 
     | 
    
         
            -
              loadYui(press);
         
     | 
| 
       37 
     | 
    
         
            -
            } else {
         
     | 
| 
       38 
     | 
    
         
            -
              press();
         
     | 
| 
       39 
     | 
    
         
            -
            };
         
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
         @@ -1,39 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
       2 
     | 
    
         
            -
            var element_locator = arguments[0];
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
            function loadYui(callback) {
         
     | 
| 
       5 
     | 
    
         
            -
                // Adding the script tag to the head as suggested before
         
     | 
| 
       6 
     | 
    
         
            -
                var head = document.getElementsByTagName('head')[0];
         
     | 
| 
       7 
     | 
    
         
            -
                var script = document.createElement('script');
         
     | 
| 
       8 
     | 
    
         
            -
                script.type = 'text/javascript';
         
     | 
| 
       9 
     | 
    
         
            -
                script.src = "http://yui.yahooapis.com/3.17.2/build/yui/yui-min.js";
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
                // Then bind the event to the callback function.
         
     | 
| 
       12 
     | 
    
         
            -
                // There are several events for cross browser compatibility.
         
     | 
| 
       13 
     | 
    
         
            -
                script.onreadystatechange = callback;
         
     | 
| 
       14 
     | 
    
         
            -
                script.onload = callback;
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
                // Fire the loading
         
     | 
| 
       17 
     | 
    
         
            -
                head.appendChild(script);
         
     | 
| 
       18 
     | 
    
         
            -
            }
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
            var rotate = function() {
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
              YUI().use('node-event-simulate', function(Y) {
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
                var node = Y.one(element_locator);
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
                node.simulateGesture("rotate", {
         
     | 
| 
       27 
     | 
    
         
            -
                    rotation: <%=rotation%>
         
     | 
| 
       28 
     | 
    
         
            -
                });
         
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
              });
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
            };
         
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
            if (typeof YUI == 'undefined') {
         
     | 
| 
       36 
     | 
    
         
            -
              loadYui(rotate);
         
     | 
| 
       37 
     | 
    
         
            -
            } else {
         
     | 
| 
       38 
     | 
    
         
            -
              rotate();
         
     | 
| 
       39 
     | 
    
         
            -
            };
         
     | 
| 
         @@ -1,40 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
       2 
     | 
    
         
            -
            var element_locator = arguments[0];
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
            function loadYui(callback) {
         
     | 
| 
       5 
     | 
    
         
            -
                // Adding the script tag to the head as suggested before
         
     | 
| 
       6 
     | 
    
         
            -
                var head = document.getElementsByTagName('head')[0];
         
     | 
| 
       7 
     | 
    
         
            -
                var script = document.createElement('script');
         
     | 
| 
       8 
     | 
    
         
            -
                script.type = 'text/javascript';
         
     | 
| 
       9 
     | 
    
         
            -
                script.src = "//yui.yahooapis.com/3.18.0/build/yui/yui-min.js";
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
                // Then bind the event to the callback function.
         
     | 
| 
       12 
     | 
    
         
            -
                // There are several events for cross browser compatibility.
         
     | 
| 
       13 
     | 
    
         
            -
                script.onreadystatechange = callback;
         
     | 
| 
       14 
     | 
    
         
            -
                script.onload = callback;
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
                // Fire the loading
         
     | 
| 
       17 
     | 
    
         
            -
                head.appendChild(script);
         
     | 
| 
       18 
     | 
    
         
            -
            }
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
            var tap = function() {
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
              YUI().use('node-event-simulate', function(Y) {
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
                var node = Y.one(element_locator);
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
                node.simulateGesture("tap");
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
              });
         
     | 
| 
       29 
     | 
    
         
            -
             
         
     | 
| 
       30 
     | 
    
         
            -
            };
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
            if (typeof YUI == 'undefined') {
         
     | 
| 
       35 
     | 
    
         
            -
              loadYui(tap);
         
     | 
| 
       36 
     | 
    
         
            -
            } else {
         
     | 
| 
       37 
     | 
    
         
            -
              tap();
         
     | 
| 
       38 
     | 
    
         
            -
            };
         
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
             
     |