-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Widget: Support events with dashes and colons #1159
Widget: Support events with dashes and colons #1159
Conversation
These tests don't verify that the events are working as intended. The implementation could be simply reading everything up to the first colon or dash and trigger that event and all tests would still pass. We need assertions that verify the explicit event types. There's also no need to test for multiple colons and multiple dashes while you have the assertion that combines both. |
Gave events unique names and dropped few tests as you suggested. Anything else? |
They do have unique names now, but you're still not verifying that your'e getting the correct |
$.widget( "ui.testWidget", { | ||
_create: function() { | ||
this._on( this.document, { | ||
"customevent": "_handler" | ||
"customevent": "_handler", | ||
"colon:devided": "_handler", |
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.
The correct spelling is "divided", though I wouldn't really use that word since nobody is using dashes as a divider, they're using them as spacers. How about "with:colons", "with-dashes", "with-dashes:and-colons"?
Ah damn typo. Anyway fixed it the way you suggested. Okay so now we are triggering different event for each expression; is that the way you meant it? The build fails due to "unknown property 'touch-action'", which by my guess is caused by 28310ff. Despite the error the widget tests (alongside with all other tests) should pass. |
You may have to run |
Yup. I'll squash and land this right now. |
Actually, you signed the CLA with a different email address than the commit. Which email address did you want to use? |
Hmm I thought I've signed it with ruslan@ruslan.io (which is the one listed on github). NVM — signed it again using the email address. |
You did sign the CLA with that address, but your git config uses the .sk address (the address you have set in GitHub is irrelevant). I'll change the commit to use .io. |
@@ -414,7 +414,7 @@ $.Widget.prototype = { | |||
handler.guid || handlerProxy.guid || $.guid++; | |||
} | |||
|
|||
var match = event.match( /^(\w+)\s*(.*)$/ ), | |||
var match = event.match( /^([\w:-]*)\s*(.*)$/ ), |
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.
Any reason this isn't /^([\w:-]+)\s*(.*)$/
instead?
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.
If I had written it, that's what I would have used as it more accurately represents what we're looking for. In practice it won't matter though; the only difference occurs on invalid input.
Added support for dashes and colons into the widget component. It will now listen to any triggered event which name contains colon or dash (hyphen).
Fixes #9708
Ref #1158 (closed PR)
Thanks @scottgonzalez for pointing me into the right direction on this one.