Sha256: 63e3acb8db9d0cdf86f687fd966c3e8c7d9b476572cfec8e8522ae0239eb1521

Contents?: true

Size: 826 Bytes

Versions: 19

Compression:

Stored size: 826 Bytes

Contents

# frozen_string_literal: true

module FormHelpers
  def setup_form_tracking(driver)
    driver.execute_script <<~JS
      window.lastSubmittedForm = null;

      document.addEventListener('submit', (e) => {
        e.preventDefault();
        window.lastSubmittedForm = e.target.id;
      });
    JS
  end
end

RSpec.configure do |config|
  config.include FormHelpers, type: :feature
end

RSpec::Matchers.define :be_invalid do
  match do |element|
    element[:validity] == 'false' ||
      element.evaluate_script('!this.validity.valid')
  end
end

RSpec::Matchers.define :have_been_submitted do
  match do |form|
    page.evaluate_script('window.lastSubmittedForm') == form['id']
  end
end

RSpec::Matchers.define :have_invisible_textarea do
  match do |element|
    element.has_css?('textarea', visible: :hidden)
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
ckeditor5-1.20.1 spec/e2e/support/form_helpers.rb
ckeditor5-1.20.0 spec/e2e/support/form_helpers.rb
ckeditor5-1.19.5 spec/e2e/support/form_helpers.rb
ckeditor5-1.19.4 spec/e2e/support/form_helpers.rb
ckeditor5-1.19.3 spec/e2e/support/form_helpers.rb
ckeditor5-1.19.2 spec/e2e/support/form_helpers.rb
ckeditor5-1.19.1 spec/e2e/support/form_helpers.rb
ckeditor5-1.19.0 spec/e2e/support/form_helpers.rb
ckeditor5-1.18.3 spec/e2e/support/form_helpers.rb
ckeditor5-1.18.1 spec/e2e/support/form_helpers.rb
ckeditor5-1.18.0 spec/e2e/support/form_helpers.rb
ckeditor5-1.17.4 spec/e2e/support/form_helpers.rb
ckeditor5-1.17.3 spec/e2e/support/form_helpers.rb
ckeditor5-1.17.2 spec/e2e/support/form_helpers.rb
ckeditor5-1.17.1 spec/e2e/support/form_helpers.rb
ckeditor5-1.17.0 spec/e2e/support/form_helpers.rb
ckeditor5-1.16.2 spec/e2e/support/form_helpers.rb
ckeditor5-1.16.1 spec/e2e/support/form_helpers.rb
ckeditor5-1.16.0 spec/e2e/support/form_helpers.rb