Sha256: 542785ab1f850012fc39659615fc996cc0d6c10daa18808916d0cb92a31e88d6

Contents?: true

Size: 1014 Bytes

Versions: 5

Compression:

Stored size: 1014 Bytes

Contents

Given %r{the HTML element has a lang attribute set to "([^"]*)"$} do |lang|
  page.execute_script("$('html').attr('lang', '#{lang}')")
end

Given %r{the element "([^"]*)" has a lang attribute set to "([^"]*)"$} do |id, lang|
  page.execute_script("$('##{id}').attr('lang', '#{lang}')")
end

Then %r{^the numeric value of "([^"]*)" should be "([^"]*)"$} do |input, value|
  page.evaluate_script("$('##{input}').numericValue()").should be_within(0.0001).of value.to_f
end

Then %r{^the numeric value \(ignoring currency sign\) of "([^"]*)" should be "([^"]*)"$} do |input, value|
  page.evaluate_script("$('##{input}').numericValue({ignoreCurrencySign: true})").should be_within(0.0001).of value.to_f
end

Then %r{^the numeric value \(using `nullOnError: true`\) of "([^"]*)" should be "([^"]*)"$} do |input, value|
  actual = page.evaluate_script("$('##{input}').numericValue({nullOnError: true})")
  if value == "null"
    actual.should eq("") 
  else
    actual.should be_within(0.0001).of(value.to_f)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
da-js-1.2.1 features/step_definitions/numeric_value_steps.rb
da-js-1.2.0 features/step_definitions/numeric_value_steps.rb
da-js-1.1.2 features/step_definitions/numeric_value_steps.rb
da-js-1.1.1 features/step_definitions/numeric_value_steps.rb
da-js-1.1.0 features/step_definitions/numeric_value_steps.rb