stencil
stencil copied to clipboard
fix(mock-doc): Add missing properties of object retuned by matchMedia
Pull request checklist
Please check if your PR fulfills the following requirements:
- [x] Tests for the changes have been added (for bug fixes / features)
- [ ] Docs have been reviewed and added / updated if needed (for bug fixes / features)
- [x] Build (
npm run build) was run locally and any changes were pushed - [x] Unit tests (
npm test) were run locally and passed - [ ] E2E Tests (
npm run test.karma.prod) were run locally and passed - [x] Prettier (
npm run prettier) was run locally and passed
Pull request type
Please check the type of change your PR introduces:
- [x] Bugfix
- [ ] Feature
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] Documentation content changes
- [ ] Other (please describe):
What is the current behavior?
matchMedia is supposed to return a MediaQueryList which inherits from the EventTarget interface. As such the stub object returned from the mock should have addEventListener, removeEventListener, and dispatchEvent methods. It was also missing the media property.
GitHub Issue Number: N/A
What is the new behavior?
Missing properties were added:
-
addEventListener -
removeEventListener -
dispatchEvent -
media
Does this introduce a breaking change?
- [ ] Yes
- [x] No
Testing
I got my unit tests to run for my project that uses matchMedia, also I added tests to ensure the moc-doc matches expectations going forward.
Other information
Tests included, and a typo fix.