rails/actionview/test
Alex Ghiculescu 49c2e51808 Allow f.select to be called with a single hash containing options and HTML options
I do this a lot:

```erb
<%= select :post, :author, authors, required: true %>
```

It doesn't work; the `required` attribute is ignored! Instead, you need to do this:

```erb
<%= select :post, :author, authors, {}, required: true %>
```

It's hard to remember the right API, and it looks to me like a code smell. It looks even smellier when you end up with this:

```erb
<%= select :post, :author, authors, { include_blank: "Choose an option" }, { required: true } %>
```

Where this would be nicer, but again, the `required` attribute is ignored:

```erb
<%= select :post, :author, authors, include_blank: "Choose an option", required: true %>
```

This PR implements a special handling for `required`, `multiple`, and `size` HTML attributes so that these now do the same thing:

```erb
<%= select :post, :author, authors, include_blank: "Choose an option", required: true %>
<%= select :post, :author, authors, { include_blank: "Choose an option" }, { required: true } %>
```

ps. as proof I'm not the only person who makes this mistake, one of the tests in the Rails test suite was wrong! The test added in https://github.com/rails/rails/pull/40522 puts the `multiple` attribute in the wrong place and has the wrong assertion as as result. This PR includes a fix for the test.
2022-12-13 11:44:34 -06:00
..
actionpack Fix word case. html -> HTML 2022-09-18 04:21:22 +10:00
activerecord Fix Active Record :db_runtime metric 2022-09-15 10:43:33 +02:00
fixtures Add tests that column information can be translated 2022-10-09 14:52:17 -07:00
lib Allow hash-like record_object in FormBuilder#fields_for 2022-11-22 20:03:43 +01:00
template Allow f.select to be called with a single hash containing options and HTML options 2022-12-13 11:44:34 -06:00
ujs upgrade to QUnit 2 for ujs tests 2022-09-20 18:03:55 +10:00
abstract_unit.rb Add ActionView.deprecator 2022-10-30 16:01:39 -05:00
active_record_unit.rb Always preload if using proc with multifetch cache 2022-05-07 22:19:39 +10:00
buffers_test.rb Add OutputBuffer#raw and #capture to reduce the need to swap the buffer 2022-08-03 12:56:34 +02:00