-
Notifications
You must be signed in to change notification settings - Fork 6.8k
feat(material-experimental/mdc-slider): implement some basic unit tests #22072
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
feat(material-experimental/mdc-slider): implement some basic unit tests #22072
Conversation
wagnermaciel
commented
Mar 1, 2021
- implement unit tests for the standard slider, standard range slider, and for the slider ripple states
- add mdc-slider theme to all-theme
- make MatSliderVisualThumb ripple refs public so their states can be checked & tested
- make MatSlider child component and html element getters default thumbPosition to the end thumb
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.
LGTM, with one more comment
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.
LGTM with a few nits.
30f540b
to
7b22164
Compare
* implement unit tests for the standard slider, standard range slider, and for the slider ripple states * add mdc-slider theme to all-theme * make MatSliderVisualThumb ripple refs public so their states can be checked & tested * make MatSlider child component and html element getters default thumbPosition to the end thumb
* use #waitForAsync instead of #fixture.whenStable
7b22164
to
d2d3ca5
Compare
* remove default value from MatSlider getters * combine #beforeEach's in ripple state tests
* resolve injection error that only throws on ci
* make ripple refs private and check DOM directly in unit tests
c3e4461
to
cd25296
Compare
* Disable the mat ripple on the slider thumbs to prevent the automatic launch that happens on click/touch. The problem is easily reproduced if you undo this change and test it out on a mobile device.
I noticed a bug while trying to fix the unit tests on for ios safari. Here are some screenshots of the fix: BeforeAfterIt's pretty difficult to see, but there was a ripple getting launched by default on touch. You can see it if you look at the bottom left corner closely. The ripple was never centered so it would appear wherever the slider thumb was touched. To fix this I just disabled the mat ripple (ripples can still be launched manually when the mat ripple is disabled) |
// In favor of creating events that work for most of the browsers, the event is created | ||
// as a basic UI Event. The necessary details for the event will be set manually. | ||
const event = document.createEvent('UIEvent'); | ||
const touchDetails = {pageX, pageY}; | ||
const touchDetails = {pageX, pageY, clientX, clientY}; |
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.
The mdc-slider checks the clientX
and clientY
of the targetTouches[0]
when calculating the new value of the slider.
* use touch events instead of pointer events when testing on ios. pointerdown, pointerup, and pointermove are not supported on ios.
b3cca71
to
17d55b2
Compare
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.
LGTM
…ts (angular#22072) * feat(material-experimental/mdc-slider): implement some basic unit tests * implement unit tests for the standard slider, standard range slider, and for the slider ripple states * add mdc-slider theme to all-theme * use #waitForAsync to wait for foundation to finish initializing & layout * use forwardRef to avoid injection errors that only throw on ci * disable the mat ripple on the slider thumbs to prevent the automatic launch that happens on click/touch the problem is easily reproduced if you undo this change and test it out on a mobile device. * note: we use touch events instead of pointer events when testing on ios because pointerdown, pointerup, and pointermove are not supported
…ts (angular#22072) * feat(material-experimental/mdc-slider): implement some basic unit tests * implement unit tests for the standard slider, standard range slider, and for the slider ripple states * add mdc-slider theme to all-theme * use #waitForAsync to wait for foundation to finish initializing & layout * use forwardRef to avoid injection errors that only throw on ci * disable the mat ripple on the slider thumbs to prevent the automatic launch that happens on click/touch the problem is easily reproduced if you undo this change and test it out on a mobile device. * note: we use touch events instead of pointer events when testing on ios because pointerdown, pointerup, and pointermove are not supported
…ts (angular#22072) * feat(material-experimental/mdc-slider): implement some basic unit tests * implement unit tests for the standard slider, standard range slider, and for the slider ripple states * add mdc-slider theme to all-theme * use #waitForAsync to wait for foundation to finish initializing & layout * use forwardRef to avoid injection errors that only throw on ci * disable the mat ripple on the slider thumbs to prevent the automatic launch that happens on click/touch the problem is easily reproduced if you undo this change and test it out on a mobile device. * note: we use touch events instead of pointer events when testing on ios because pointerdown, pointerup, and pointermove are not supported
…ts (angular#22072) * feat(material-experimental/mdc-slider): implement some basic unit tests * implement unit tests for the standard slider, standard range slider, and for the slider ripple states * add mdc-slider theme to all-theme * use #waitForAsync to wait for foundation to finish initializing & layout * use forwardRef to avoid injection errors that only throw on ci * disable the mat ripple on the slider thumbs to prevent the automatic launch that happens on click/touch the problem is easily reproduced if you undo this change and test it out on a mobile device. * note: we use touch events instead of pointer events when testing on ios because pointerdown, pointerup, and pointermove are not supported
…ts (angular#22072) * feat(material-experimental/mdc-slider): implement some basic unit tests * implement unit tests for the standard slider, standard range slider, and for the slider ripple states * add mdc-slider theme to all-theme * use #waitForAsync to wait for foundation to finish initializing & layout * use forwardRef to avoid injection errors that only throw on ci * disable the mat ripple on the slider thumbs to prevent the automatic launch that happens on click/touch the problem is easily reproduced if you undo this change and test it out on a mobile device. * note: we use touch events instead of pointer events when testing on ios because pointerdown, pointerup, and pointermove are not supported
…ts (angular#22072) * feat(material-experimental/mdc-slider): implement some basic unit tests * implement unit tests for the standard slider, standard range slider, and for the slider ripple states * add mdc-slider theme to all-theme * use #waitForAsync to wait for foundation to finish initializing & layout * use forwardRef to avoid injection errors that only throw on ci * disable the mat ripple on the slider thumbs to prevent the automatic launch that happens on click/touch the problem is easily reproduced if you undo this change and test it out on a mobile device. * note: we use touch events instead of pointer events when testing on ios because pointerdown, pointerup, and pointermove are not supported
…ts (angular#22072) * feat(material-experimental/mdc-slider): implement some basic unit tests * implement unit tests for the standard slider, standard range slider, and for the slider ripple states * add mdc-slider theme to all-theme * use #waitForAsync to wait for foundation to finish initializing & layout * use forwardRef to avoid injection errors that only throw on ci * disable the mat ripple on the slider thumbs to prevent the automatic launch that happens on click/touch the problem is easily reproduced if you undo this change and test it out on a mobile device. * note: we use touch events instead of pointer events when testing on ios because pointerdown, pointerup, and pointermove are not supported
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |