Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a class or id on a field to easily identify in test #20

Open
blimmer opened this issue Jun 5, 2015 · 1 comment
Open

Provide a class or id on a field to easily identify in test #20

blimmer opened this issue Jun 5, 2015 · 1 comment

Comments

@blimmer
Copy link
Collaborator

blimmer commented Jun 5, 2015

Right now, it's difficult to confirm the presence of certain states on form groups. For instance, consider an email field with an error. Today, we get this:

<div id="ember486" class="ember-view form-group has-error">
  <label for="Email-Address" class="control-label">Email Address</label>
  <input id="Email-Address" class="ember-view ember-text-field form-control has-error" type="text">
  <span id="ember566" class="ember-view help-block">can't be blank</span>
</div>

Its hard to confirm the presence of the help-block with other inputs in the same form, because the outer form-group has no identifiable information on it. This requires a selector like this to ensure it's the help-block associated with the email-address input:

$('input#Email-Address ~.help-block')

It would be much easier if the outer form-group had an identifiable class or id to select. Then it would just be something like:

$('.form-group#email .help-block')

...or...

$('.form-group.email .help-block')

without using the more uncommonly used sibling selector.

This should be implemented on all components, including checkbox since, today, they're not uniquely identifiable.

@jelhan
Copy link
Contributor

jelhan commented Nov 14, 2015

Even a bigger concern if you consider i18n. Label is mostly translated, which is used for input id. So you have to deal with translation issues just to identify your form fields in acceptance tests.

You could pass a class name in like this to use in your acceptance tests:

{{fm-field
  class='your-class-name'
}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants