-
Notifications
You must be signed in to change notification settings - Fork 470
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: remove mutationobserver shim (#457)
Closes #413 Closes #357 BREAKING CHANGE: MutationObserver is supported by all major browsers and recent versions of JSDOM. If you need, you can create your own shim (using @sheerun/mutationobserver-shim) and attach it to the window.
- Loading branch information
1 parent
4c0193c
commit ab3e691
Showing
6 changed files
with
27 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,5 @@ | ||
import {getDocument, newMutationObserver} from '../helpers' | ||
import {getDocument} from '../helpers' | ||
|
||
test('returns global document if exists', () => { | ||
expect(getDocument()).toBe(document) | ||
}) | ||
|
||
class DummyClass { | ||
constructor(args) { | ||
this.args = args | ||
} | ||
} | ||
|
||
describe('newMutationObserver', () => { | ||
if (typeof window === 'undefined') { | ||
it('instantiates mock MutationObserver if not availble on window', () => { | ||
expect(newMutationObserver(() => {}).observe).toBeDefined() | ||
}) | ||
} else { | ||
it('instantiates from global MutationObserver if available', () => { | ||
const oldMutationObserver = window.MutationObserver | ||
window.MutationObserver = DummyClass | ||
|
||
try { | ||
expect(newMutationObserver('foobar').args).toEqual('foobar') | ||
} finally { | ||
window.MutationObserver = oldMutationObserver | ||
} | ||
}) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters