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

Fix 1144 (Fix and Re-enable some unit tests on dialog, tooltip, and draggable) #1173

Closed
wants to merge 5 commits into from

Conversation

bdowling
Copy link
Contributor

This PR replaces #1144.

Note that it did not seem feasible to separate the issues. Fixing the :focus ones would be a NOP because the dialog tests still could not be enabled because they would fail on the viewPort issue. So instead I locally fixed the viewpPort issue by specifying a phantomScript option to qunit and including the (minimally modified) version that supports options.page. Cleaned up to use the now published grunt-lib-phantomjs v0.5.0 via grunt-contrib-qunit v0.4.0 with needed feature

Hopefully this works.

@jzaefferer
Copy link
Member

Thank you for yet another update. I just landed your grunt-lib-phantomjs PR. I can publish that to npm, so we have to wait for that: gruntjs/grunt-lib-phantomjs#52

Once that is done, I can update grunt-contrib-qunit, if necessary, and then we can get rid of the custom phantomjs script here.

@jzaefferer
Copy link
Member

@bdowling if you rebase this on top of master, you can drop the custom phantom script and specify the page options anyway. I got the necessary updates for grunt-contrib-qunit and grunt-lib-phantomjs published.

I noticed some unit tests were disabled in phantomjs.  dialog and draggable depend
on a larger viewPort.  tooltip just seemed to work, so I reenebaled that as well.

Changing the viewportSize depends on a not yet merged feature in gruntjs/grunt-lib-phantomjs#21
Note, this depends on the new phantomjs/main.js in the not yet merged feature
in gruntjs/grunt-lib-phantomjs#21
@bdowling
Copy link
Contributor Author

@jzaefferer awesome. I updated this branch. (Edited: I realized the fix was in grunt-contrib-qunit v0.4.0 so I repushed)

Thanks everyone!

@jzaefferer
Copy link
Member

Sorry, its v0.4.0 (0.5.0 was grunt-lib-phantomjs). It should install just fine with npm install.

// TODO except for all|index|test, try to include more as we go
return !( /(all|index|test|dialog|tooltip)\.html$/ ).test( file );
})
files: expandFiles( "tests/unit/**/*.html" ).filter(function( file ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you fix the indent here and the following lines?

@jzaefferer
Copy link
Member

This looks good to me. Any thoughts on the test fixes, @scottgonzalez?

@bdowling
Copy link
Contributor Author

fwiw, @tjvantoll commented on the :focus stuff here #1144 (comment)

@bdowling
Copy link
Contributor Author

Does anyone know what it is about this test inside Phantom that causes it to fail?

 "focus": function( elem ) {
                        return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
                },

I won't claim to understand why :focus is this complex ;)

This should probably be addressed separately, but that is why I found changing the test worked.. As I mentioned in other pr, this probably should be fixed the right way in Phantom and have unit tests upstream.

Ref ariya/phantomjs#10427

@scottgonzalez
Copy link
Member

The changes to the individual assertions look fine to me, though there's a spacing problem on the first change.

@bdowling
Copy link
Contributor Author

@scottgonzalez can you point out which spacing is an issue? I think I was asked to put the spaces inside the parens in #1144 if that is what you mean?

@@ -361,9 +361,9 @@ test("ensure dialog keeps focus when clicking modal overlay", function() {
var element = $( "<div></div>" ).dialog({
modal: true
});
ok( $(":focus").closest(".ui-dialog").length, "focus is in dialog" );
equal( $(document.activeElement ).closest( ".ui-dialog" ).length, 1, "focus is in dialog" );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space after $(.

@jzaefferer
Copy link
Member

I squashed the commits and updated the commit message. Code changes were good to go. Thanks @bdowling!

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

Successfully merging this pull request may close these issues.

3 participants