Skip to content

Conversation

@broder
Copy link
Contributor

@broder broder commented Dec 24, 2016

Summary

This should cover #2006. Are there any other symbols we would specifically like to test?

Checklist

@jsf-clabot
Copy link

jsf-clabot commented Dec 24, 2016

CLA assistant check
All committers have signed the CLA.

@mention-bot
Copy link

@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.

QUnit.test( "jQuery(symbol separated elements)", function( assert ) {
assert.expect( 34 );

jQuery.each( "- :".split( " " ), function( i, symbol ) {
Copy link
Member

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.


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>" );
Copy link
Member

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.

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 ) {
Copy link
Member

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)".

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" );
Copy link
Member

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?

@gibson042 gibson042 closed this in bd9145f Dec 29, 2016
@gibson042
Copy link
Member

Thanks!

@lock lock bot locked as resolved and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants