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 transition options inconsistency/bug #261

Merged
merged 2 commits into from
Oct 22, 2024

Conversation

jaywhy
Copy link
Contributor

@jaywhy jaywhy commented Oct 22, 2024

I found a bug or inconsistency in how transitionOptions are used in the enter() and leave() functions inside transition.js.

enter() expects toggleClass

const toggleClass = element.dataset.toggleClass || transitionOptions.toggleClass || 'hidden'

leave() expects toggle:

const toggleClass = element.dataset.toggleClass || transitionOptions.toggle || 'hidden'

This patch combines transitionOption parsing into one function, getTransitionOptions, to keep everything consistent. It also allows for both toggle and toggleClass options to maintain backward compatibility.

I've added tests to cover this issue.

As an added bonus, I noticed I was using a couple await aTimeout(100) calls in my pull request earlier. They don't need to wait that long, so I changed them to await aTimeout(0). This speeds up the tests by .3 seconds or so. 😃

Between leave() and enter() transitionOptions was inconsistent on how it
handled the toggleClass/toggle option. Now excepting both options.
@excid3 excid3 merged commit 2e98905 into excid3:main Oct 22, 2024
1 check passed
@excid3
Copy link
Owner

excid3 commented Oct 22, 2024

Great catch @jaywhy 👍

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.

2 participants