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 for jqueryUI 1.12 #73

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Fix for jqueryUI 1.12 #73

wants to merge 7 commits into from

Conversation

wallenium
Copy link

#72
Might not be the best implentation, but works.
Hint: I changed the JS file to the unminified Version, it is easier to debug. Needs to be altered once you tested the fix.

It should work with < 1.12 and > 1.12, i added a $ui.version check.

@benjamin-albert
Copy link
Collaborator

There are a few issues the need to be resolved before we can merge:

  • When you hover the "Year 2017" button it's not animating the buttons label to say "Jump Years".
  • When you click the button and then go back to the months view the next/prev buttons are disabled.
  • We should really find a more DRY way to handle the jQuery UI button options.

There seems to be an issue with the Travis-CI build in general. I'll fix it when I can find time to look at it.

@wallenium
Copy link
Author

Will Check

No idea how to reduce repetitions withiout loosing bckward comp. If You have any idea..

@benjamin-albert
Copy link
Collaborator

According to jQuery UI 1.12 Upgrade Guide:

Although the redesigns introduce breaking changes, 1.12 maintains a lot of compatibility with the 1.11 API by default.

However you can disable backwards compatibility by:

<script src="jquery.js"></script>
<script>$.uiBackCompat = false;</script>
<script src="jquery-ui.js"></script>

It seems they want to remove backwards compatibility in jQuery UI 1.13 so unfortunately I still think it's worth supporting both APIs.

The idea I have is to define the options once according to the new API and always pass them through a jQuery plugin we create which converts the options to the old API if necessary.

Example:

var _isNewApi = $.ui.version >= '1.12';

$.fn.monthPickerButton = function(opts) {
  if (_isNewApi) {
    return this.jqueryUIButton(opts);
  } else {
    var newOpts = {};
    if (opts.showLabel !== void 0) newOpts.text = opts.showLabel;
    // etc...

    return this.jqueryUIButton(newOpts);
  }
};

this._prevButton.monthPickerButton({
    showLabel: false
});

@wallenium
Copy link
Author

I reworked the parts, fixed all bugs. Hopefully implementation is better now ;) Learned a bit, never used functions for These type of work. Thanks a lot

@benjamin-albert
Copy link
Collaborator

benjamin-albert commented Mar 23, 2017

The index.html file in the /demo directory is not intended for development, it's intended to show users how to setup and use the plugin (which is why it uses the minified version).

@wallenium Please revert the changes to use the source files in the demo and read the Contributing section of the project's Wiki.

@benjamin-albert
Copy link
Collaborator

@wallenium It looks like the tests are filming please fix the test so we can merge the pull request.

@benjamin-albert
Copy link
Collaborator

benjamin-albert commented Mar 23, 2017

@wallenium Please reach out if you need help fixing the tests.

We can also send you an invite to join our slack room if you want.

@benjamin-albert
Copy link
Collaborator

benjamin-albert commented Mar 23, 2017

After pulling your branch and adjusting the test environment to use jQuery UI 1.12 it looks like there are a lot of visual glitches:
screen shot 2017-03-23 at 2 16 41 pm

@wallenium Please run the tests from master to see how the plugin should look

This reverts commit 87cbe7c.
@wallenium
Copy link
Author

Gott possible to run the test on my system, not sure why it fails:

PhantomJS threw an error:ERROR

0 [ '' ]
Warning: PhantomJS exited unexpectedly with exit code null. Use --force to continue.

latest its version available. Should work without a problem.. Checked the contribute page.
Layout was a bit different but not that broken as in your screenshot during my tests. At least for me it was acceptable ;)

@benjamin-albert
Copy link
Collaborator

I am also running into this issue on my work machine.

You will have to run the tests from the browser until I can get around to fixing that issue.

@benjamin-albert
Copy link
Collaborator

benjamin-albert commented Mar 23, 2017

@wallenium Don't forget to adjust the test.html file to use jQuery UI 1.12

@wallenium
Copy link
Author

wallenium commented Mar 23, 2017

Some of the failing tests seems to be because of internal problems. Not sure why done() fails...

RTL is working, the test needs to be adjusted because of the missing span, not sure why the test result shows wrong dates with strange numbers while the manual tests on the same page are working fine..

only strange things seems to be the click behavior and the disable of prev/next button if limit is reached..

@benjamin-albert
Copy link
Collaborator

@wallenium What do you mean by internal problems? Can you be more specific?

Which test are you having a problem fixing?

@@ -35,11 +35,12 @@ along with this program. If not, see
// conflict with Bootstrap.js button (#35)
$.widget.bridge('jqueryUIButton', $.ui.button);

var _isNewApi = $.ui.version >= '1.12';
Copy link
Collaborator

Choose a reason for hiding this comment

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

The tests are paling because this tests is incorrect.

The unit tests are using version 1.9.2 of jQuery UI and this test returns true because the number 1.9 is greater than 1.12.

I pushed a fix for this to my jquery_1.12_support branch.

@benjamin-albert
Copy link
Collaborator

When I finish writing support for jQuery 1.12 I will open a pull request which will include @wallenium commits.

I think once that PR gets merged this PR will be considered merged as well so I'm leaving it open for now.

@KidSysco Do you think we should keep this PR open unit we merge my PR or we should close this PR?

@wallenium
Copy link
Author

wallenium commented Apr 24, 2017

Sorry, was a bit busy the last weeks. Hopefully i have the time this week to finalize this issue. Or should i wait for you, @benjamin-albert

@benjamin-albert
Copy link
Collaborator

@wallenium I think before we implement support for both versions of the jQuery UI APIs in a single file I want to change our test suits to:

  1. Support testing both versions of the API with a "push of a button".
  2. Make contributing easier by making it possible to run the tests without installing Node.js.

After I adjust the test suite I'd be happy to help you write support for the new API or pick up writing support if you're not up for it.

@KidSysco Can you please send @wallenium an invite to our Slack team. I think this would make collaborating with him easier.

@KidSysco
Copy link
Owner

Sorry I did not reply until now. Springtime chores got me all busy.

I am fine with leaving the PR open until it is ready to merge. It might result in a merge conflict but that should be OK. Either way, whatever is easiest for you guys.

I would be happy to send @wallenium an invite to our slack channel. I will need an email address from you @wallenium in order to do that.

The slack channel is nice for chatting.

Let me know if there is anything else I can do for use guys!

@benjamin-albert
Copy link
Collaborator

@wallenium I've pushed changes to my jquery_1.12_support branch which allow you to test both jQuery UI API versions.

Just open test/test.html and click Run against jQuery UI 1.12.1 API.

@wallenium If you'd prefer that I write support for jQuery UI 1.12 then just say so, and I will be glad to do it whenever I can get around it (usually on the weekends).

@benjamin-albert
Copy link
Collaborator

@wallenium I almost finished fixing the tests. I will start fixing the visual glitches when I can find time for it. (usually on the weekends).

Take a look at my jquery_1.12_support branch.

@benjamin-albert
Copy link
Collaborator

A bit of an update I've been busy trying to fix the visual glitches and I came to a conclusion that I could not fix them.

Since then I've managed to figure out how to git in touch with the jQuery UI development team (which unfortunately isn't as straightforward as opening a GitHub issue) and I have been discussing the issues with @scottgonzalez.

For details discussion:

https://forum.jquery.com/topic/adjusting-the-jquery-ui-month-picker-plugin-for-jquery-ui-1-12

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

Successfully merging this pull request may close these issues.

3 participants