Andrew Premdas wrote: > The key phrase is semantic meaning. Its good to use CSS to give semantic > meaning to things that appear on web pages. Not only can these id's or > classes be useful for using with screen readers, they should be stable > things that don't change even if the design of the page does. It should
This is an example of my current practice, consequential on the discussions I have had on this list: <h2 id="authentication_request">To Proceed Please Authenticate Yourself</h2> <div id="authentication_fields"> <form action="/user_session" class="new_user_session" id="new_user_session" method="post" > <label for="user_session_username">User Name</label> <br /> <input id="user_session_username" name="user_session[username]" size="30" type="text" /> ... <input id="user_session_submit" name="commit" type="submit" value="Authenticate" /> </form> </div> My intent is that id values are tied to the presentation elements they deal with, not to the layout they find themselves in. So I test the UI by calling the ids in webrat, rather than the labels. This will ease any future transition to I18n.t calls in the templates. As a side issue, in getting the input box ids to work with label ids as I specified in the templates, I discovered that I had misread the FormHelper api. I uncovered my mistake by writing a few tests to exercise this feature as Rails own test/form_helper_test.rb did not. The point is that I have submitted these tests as a patch to Rails and they are awaiting verification for inclusion. Patches require three reviewers for consideration by the core team. My submission has had one positive review already. I would appreciate a couple of more. The lighthouse ticket is 2096. http://rails.lighthouseapp.com/projects/8994/tickets/2096-added-select-method-tests-to-form_helper_testrb -- Posted via http://www.ruby-forum.com/. _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users