Skip to content

Commit

Permalink
Merge pull request #926 from DavyJonesLocker/chore/update-dependencies
Browse files Browse the repository at this point in the history
Chore/update dependencies
  • Loading branch information
tagliala authored Jan 1, 2024
2 parents e96bd8e + c03f7fd commit f3a9c02
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 88 deletions.
4 changes: 0 additions & 4 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ Metrics/PerceivedComplexity:
Minitest/MultipleAssertions:
Enabled: false

# FIXME: DavyJonesLocker/client_side_validations#927
Minitest/NonExecutableTestMethod:
Enabled: false

Rails/ApplicationRecord:
Exclude:
- 'test/**/*'
Expand Down
86 changes: 44 additions & 42 deletions test/action_view/cases/test_form_for_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -647,61 +647,63 @@ def test_number_format_with_locale

assert_dom_equal expected, output_buffer
end
end

def test_field_with_format_a
assert_field_with_format_has_source(:a, 'a')
end
def test_field_with_format_a
assert_field_with_format_has_source(:a, 'a')
end

def test_field_with_format_backslash
assert_field_with_format_has_source(:backslash, '\\\\')
end
def test_field_with_format_backslash
assert_field_with_format_has_source(:backslash, '\\\\')
end

def test_field_with_format_space
# regression test for issue #460
assert_field_with_format_has_source(:space, ' ')
end
def test_field_with_format_space
# regression test for issue #460
assert_field_with_format_has_source(:space, ' ')
end

def test_field_with_format_escaped_space
assert_field_with_format_has_source(:escaped_space, '\\ ')
end
def test_field_with_format_escaped_space
assert_field_with_format_has_source(:escaped_space, ' ')
end

def test_field_with_format_ascii_escape
assert_field_with_format_has_source(:ascii_escape, '\\x41')
end
def test_field_with_format_ascii_escape
assert_field_with_format_has_source(:ascii_escape, '\\x41')
end

def test_field_with_format_unicode_escape
assert_field_with_format_has_source(:unicode_escape, '\\u263A')
end
def test_field_with_format_unicode_escape
assert_field_with_format_has_source(:unicode_escape, '\\u263A')
end

def test_field_with_format_unicode_literal
assert_field_with_format_has_source(:unicode_literal, '☺')
end
def test_field_with_format_unicode_literal
assert_field_with_format_has_source(:unicode_literal, '☺')
end

def test_field_with_format_newline_escape
assert_field_with_format_has_source(:newline_escape, '\\n')
end
def test_field_with_format_newline_escape
assert_field_with_format_has_source(:newline_escape, '\\n')
end

def test_field_with_format_newline_literal
assert_field_with_format_has_source(:newline_literal, '\\n')
end
def test_field_with_format_newline_literal
assert_field_with_format_has_source(:newline_literal, '\\n')
end

def test_field_with_format_devise_email
assert_field_with_format_has_source(:devise_email, '^[^@\\s]+@([^@\\s]+\\.)+[^@\\W]+$')
end
def test_field_with_format_devise_email
assert_field_with_format_has_source(:devise_email, '^[^@\\s]+@([^@\\s]+\\.)+[^@\\W]+$')
end

def assert_field_with_format_has_source(field, expected_source)
form_for(@format_thing, validate: true) { |f| concat(f.text_field(field)) }
private

validators = {
"format_thing[#{field}]" => { format: [{ message: 'is invalid', with:
{ source: expected_source, options: '' } }] }
}
def assert_field_with_format_has_source(field, expected_source)
form_for(@format_thing, validate: true) { |f| concat(f.text_field(field)) }

expected = whole_form_for('/format_things', 'new_format_thing', 'new_format_thing', validators: validators) do
form_field('input', "format_thing_#{field}", "format_thing[#{field}]", 'text')
end
validators = {
"format_thing[#{field}]" => { format: [{ message: 'is invalid', with:
{ source: expected_source, options: '' } }] }
}

assert_dom_equal expected, output_buffer
expected = whole_form_for('/format_things', 'new_format_thing', 'new_format_thing', validators: validators) do
form_field('input', id: "format_thing_#{field}", name: "format_thing[#{field}]", type: 'text')
end

assert_dom_equal expected, output_buffer
end
end
end
86 changes: 44 additions & 42 deletions test/action_view/cases/test_form_with_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -646,62 +646,64 @@ def test_form_with_number_format_with_locale

assert_dom_equal expected, output_buffer
end
end

def test_form_with_field_with_format_a
assert_field_with_format_has_source(:a, 'a')
end
def test_form_with_field_with_format_a
assert_field_with_format_has_source(:a, 'a')
end

def test_form_with_field_with_format_backslash
assert_field_with_format_has_source(:backslash, '\\\\')
end
def test_form_with_field_with_format_backslash
assert_field_with_format_has_source(:backslash, '\\\\')
end

def test_form_with_field_with_format_space
# regression test for issue #460
assert_field_with_format_has_source(:space, ' ')
end
def test_form_with_field_with_format_space
# regression test for issue #460
assert_field_with_format_has_source(:space, ' ')
end

def test_form_with_field_with_format_escaped_space
assert_field_with_format_has_source(:escaped_space, '\\ ')
end
def test_form_with_field_with_format_escaped_space
assert_field_with_format_has_source(:escaped_space, ' ')
end

def test_form_with_field_with_format_ascii_escape
assert_field_with_format_has_source(:ascii_escape, '\\x41')
end
def test_form_with_field_with_format_ascii_escape
assert_field_with_format_has_source(:ascii_escape, '\\x41')
end

def test_form_with_field_with_format_unicode_escape
assert_field_with_format_has_source(:unicode_escape, '\\u263A')
end
def test_form_with_field_with_format_unicode_escape
assert_field_with_format_has_source(:unicode_escape, '\\u263A')
end

def test_form_with_field_with_format_unicode_literal
assert_field_with_format_has_source(:unicode_literal, '☺')
end
def test_form_with_field_with_format_unicode_literal
assert_field_with_format_has_source(:unicode_literal, '☺')
end

def test_form_with_field_with_format_newline_escape
assert_field_with_format_has_source(:newline_escape, '\\n')
end
def test_form_with_field_with_format_newline_escape
assert_field_with_format_has_source(:newline_escape, '\\n')
end

def test_form_with_field_with_format_newline_literal
assert_field_with_format_has_source(:newline_literal, '\\n')
end
def test_form_with_field_with_format_newline_literal
assert_field_with_format_has_source(:newline_literal, '\\n')
end

def test_form_with_field_with_format_devise_email
assert_field_with_format_has_source(:devise_email, '^[^@\\s]+@([^@\\s]+\\.)+[^@\\W]+$')
end
def test_form_with_field_with_format_devise_email
assert_field_with_format_has_source(:devise_email, '^[^@\\s]+@([^@\\s]+\\.)+[^@\\W]+$')
end

def assert_field_with_format_has_source(field, expected_source)
form_with(model: @format_thing, validate: true) { |f| concat(f.text_field(field)) }
private

validators = {
"format_thing[#{field}]" => { format: [{ message: 'is invalid', with:
{ source: expected_source, options: '' } }] }
}
def assert_field_with_format_has_source(field, expected_source)
form_with(model: @format_thing, validate: true) { |f| concat(f.text_field(field)) }

expected = whole_form_with('/format_things', validators: validators) do
form_field('input', "format_thing_#{field}", "format_thing[#{field}]", 'text')
end
validators = {
"format_thing[#{field}]" => { format: [{ message: 'is invalid', with:
{ source: expected_source, options: '' } }] }
}

expected = whole_form_with('/format_things', validators: validators) do
form_field('input', id: "format_thing_#{field}", name: "format_thing[#{field}]", type: 'text')
end

assert_dom_equal expected, output_buffer
assert_dom_equal expected, output_buffer
end
end
end
end

0 comments on commit f3a9c02

Please sign in to comment.