-
Notifications
You must be signed in to change notification settings - Fork 1k
ensured the scheduler input checked attribute is being set, not just setting the active css class #1074
Conversation
…setting the active css class
@mbeard travis is failing on test failing |
@@ -515,7 +515,7 @@ | |||
item.find('label').removeClass('active'); | |||
temp = recur.BYDAY.split(','); | |||
for (i = 0, l = temp.length; i < l; i++) { | |||
item.find('input[data-value="' + temp[i] + '"]').parent().addClass('active'); | |||
item.find('input[data-value="' + temp[i] + '"]').attr('checked',true).parent().addClass('active'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't look like your unit test is checking for the checked attr to be present and true, is this on purpose?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was intending to test getValue which in turn tests this indirectly. I will create a separate unit test to explicitly test the checked
attribute.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this should be .prop('checked', true)
not attr('checked', true)
. http://api.jquery.com/prop/
the most important concept to remember about the checked attribute is that it does not correspond to the checked property. The attribute actually corresponds to the defaultChecked property and should be used only to set the initial value of the checkbox. The checked attribute value does not change with the state of the checkbox, while the checked property does.
Why not rely on our defined API for interrogating the scheduler vs. supporting inspecting the classnames, attributes, etc. on the DOM elements of the scheduler? The latter seems to be problematic and cause for future issues. |
ensured the scheduler input checked attribute is being set, not just setting the active css class
This has possible ramifications for anyone who was incorrectly accessing the value using |
We have something in that essentially said we will legacy support our API and initial markup if we change it, custom DOM interrogating though may break, but I can't find it now. Here it is. It's only about events though.
We could add a disclaimer for markup and/or jQuery selectors inspecting into the control, etc. |
Should we add access attributes directly from markup to this? This isn't the first time we've ran into attributes not being synced. It's a common problem with jQuery objects. |
fixes #992