Sha256: 7ca623a94a1755a76bfbf80acde44e644dfd8c911a8dbf0cb02f83ba84ccb633

Contents?: true

Size: 764 Bytes

Versions: 6

Compression:

Stored size: 764 Bytes

Contents

module TokenField
  module Capybara
    module Dsl
      def fill_in_token(id, options)
        fill_in "token-input-#{input_id(id, options)}", options
        sleep(1)
        find(".token-input-dropdown-facebook li").click
      end

      def clear_token(id, options={})
        remove_buttons = page.all(:xpath, "//input[@id='#{input_id(id, options)}']/preceding-sibling::ul[@class='token-input-list-facebook'][last()]/descendant::span[@class='token-input-delete-token-facebook']")
        remove_buttons.each{ |button| button.click }
      end

      private

      def input_id(id, options)
        input_id = id
        element_id = options.delete(:element_id)
        input_id << "_#{element_id}" if element_id
        input_id
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
token_field-1.1.0 lib/token_field/capybara/dsl.rb
token_field-1.0.1 lib/token_field/capybara/dsl.rb
token_field-1.0.0 lib/token_field/capybara/dsl.rb
token_field-0.0.3 lib/token_field/capybara/dsl.rb
token_field-0.0.2 lib/token_field/capybara/dsl.rb
token_field-0.0.1 lib/token_field/capybara/dsl.rb