-
Notifications
You must be signed in to change notification settings - Fork 20.5k
Tests: Added tests for colon separated tag names #3473
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
Conversation
|
@broder, thanks for your PR! By analyzing the history of the files in this pull request, we identified @markelog, @LeonardoBraga and @jeresig to be potential reviewers. |
test/unit/core.js
Outdated
| QUnit.test( "jQuery(symbol separated elements)", function( assert ) { | ||
| assert.expect( 34 ); | ||
|
|
||
| jQuery.each( "- :".split( " " ), function( i, symbol ) { |
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.
This looks unnecessarily complex, just [ "-", ":" ] will do.
test/unit/core.js
Outdated
|
|
||
| jQuery.each( "- :".split( " " ), function( i, symbol ) { | ||
| jQuery.each( "thead tbody tfoot colgroup caption tr th td".split( " " ), function( k, element ) { | ||
| var j = jQuery( "<" + element + symbol + "test></" + element + symbol + "test>" ); |
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.
And this is getting even harder to read. Let's just introduce a tagName variable.
test/unit/core.js
Outdated
| var j = jQuery( "<" + name + "-d></" + name + "-d>" ); | ||
| assert.ok( j[ 0 ], "Create a tag-hyphenated elements" ); | ||
| assert.ok( jQuery.nodeName( j[ 0 ], name.toUpperCase() + "-D" ), "Tag-hyphenated element has expected node name" ); | ||
| QUnit.test( "jQuery(symbol separated elements)", function( assert ) { |
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.
More accurately, "jQuery(element with non-alphanumeric name)".
test/unit/core.js
Outdated
| var tagName = tag + symbol + "test"; | ||
| var el = jQuery( "<" + tagName + "></" + tagName + ">" ); | ||
| assert.ok( el[ 0 ], "Create a " + tagName + " element" ); | ||
| assert.ok( jQuery.nodeName( el[ 0 ], tagName.toUpperCase() ), tagName + " element has expected node name" ); |
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.
This looks good, but I have one last request: can you keep the lines to a maximum of 100 characters by introducing line breaks before the last argument to the long assert.oks and the inner jQuery.each?
|
Thanks! |
Summary
This should cover #2006. Are there any other symbols we would specifically like to test?
Checklist