jquery-pjax
jquery-pjax copied to clipboard
Fixed issue #518: Textarea and select value isn't preserved
Fixed issue #518: Textarea and select value isn't preserved when going back/forward
Hi thanks for the contribution. This would need automated tests in order to be accepted. The tests should also verify whether regular <input>
fields have their values preserved (I assume they have by default?).
Does this handle <select>
boxes with multiple values? Also, could this adversely affect our caching functionality somehow?
Given this PR is already a few months old, I have decided to jump in and help with the tests, see https://github.com/masone/jquery-pjax/commit/f9c06149f6058a1fd440d3e885c4d225a9e58e29. I can confirm that <textarea>
and <select>
do not preserve their values, but other form elements do. There are now 5 failing tests on my branch.
When testing @the-ress' changes, the one for the single <select>
is still failing. I'm not sure wether your code or my tests need additional work, it would be nice to have a second pair of eyes on it. Please note that the assertions for the multi are slightly different from the single which might lead to one test failing while the other works.
I'm new to jquery-pjax, so please have a thorough look before merging my changes.
Thank you for the tests. I never managed to set up the environment to be able to run them.
The single value select was a bug in the original PR. I fixed it and merged your test branch.
@the-ress I'm sorry you had problems running the test suite locally. You need to have Ruby with Bundler installed and run script/bootstrap
. Then, you can run script/server -p 3000
(or another port of your choise) and open http://localhost:3000
in your browser.
Ugh sorry, I messed up the git history on the temporary form_tests_theress
branch. I thought you would merge the form_tests
instead. Please squash the commits before you finish this PR :see_no_evil: :smile: