[Clover] jsdom: Mocks for element scrolling methods are missing
See original GitHub issueI’m not sure if Clover is at a stage where you accept issues/PRs 😃 , so let me know if we should wait until you are over a certain point.
But one of the problems† I see is that some scrolling methods are not yet implemented in jsdom like scrollTo
.
https://github.com/jsdom/jsdom/blob/master/lib/jsdom/browser/Window.js#L900
Which causes the server build to fail if a lib uses such a method.
Error: Not implemented: window.scrollTo
at module.exports (<path/to/project>/node_modules/jsdom/lib/jsdom/browser/not-implemented.js:9:17)
at <path/to/project>/node_modules/jsdom/lib/jsdom/browser/Window.js:866:7
at rt.scrollToPosition (http://http/main.b51ee99a0a5badf2c7a5.js:1:111539)
at c._next (http://http/main.b51ee99a0a5badf2c7a5.js:1:513321)
at c.__tryOrUnsub (http://http/main.b51ee99a0a5badf2c7a5.js:1:1113718)
at c.next (http://http/main.b51ee99a0a5badf2c7a5.js:1:1112947)
at u._next (http://http/main.b51ee99a0a5badf2c7a5.js:1:1112126)
at u.next (http://http/main.b51ee99a0a5badf2c7a5.js:1:1111900)
at t.next (http://http/main.b51ee99a0a5badf2c7a5.js:1:1109640)
at triggerEvent (http://http/main.b51ee99a0a5badf2c7a5.js:1:498683) undefined
There is already an issue filled… https://github.com/jsdom/jsdom/issues/1422
…with an open PR: https://github.com/jsdom/jsdom/pull/2626
The question is: Should we mock it for Clover for now or wait and see? For example:
// server-engine.ts
dom = new JSDOM(htmlContent, {
runScripts: 'dangerously',
resources: customResourceLoader,
url: options.url,
referrer: options.headers?.referrer as string | undefined,
userAgent: options.headers?.['user-agent'] as string | undefined,
beforeParse: (window) => {
window.ngRenderMode = true;
// TODO: remove it after https://github.com/jsdom/jsdom/pull/2626 is merged
const noop = () => {};
Object.defineProperty(window, 'scrollTo', { value: noop, writable: true });
...
},
});
† Another problem is routing.
🌍 Your Environment
Angular CLI: 12.0.0
Node: 12.18.0
Package Manager: yarn 1.22.10
OS: darwin x64
Angular: 12.0.0
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, language-service, material, platform-browser
... platform-browser-dynamic, platform-server, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1200.0
@angular-devkit/build-angular 12.0.0
@angular-devkit/core 12.0.0
@angular-devkit/schematics 12.0.0
@angular/fire 6.1.4
@nguniversal/builders 12.0.0
@nguniversal/common 12.0.0
@schematics/angular 12.0.0
rxjs 6.6.6
typescript 4.2.4
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:7
Top Results From Across the Web
How to spy on window.scrollTo in Jest? - javascript
In jest the global name space must be accessed by global not window . global.scrollTo = jest.fn().
Read more >typeerror: cannot read property 'location' of undefined jest
i'm trying to wrap the wrapper and the error is gone, but i caught another ... With this approach, the side effect of...
Read more >Untitled
Brain parts description, 250 lbs to 160 lbs, Art et technique du lavis, ... Download files on iphone jailbreak, Element 99 is named...
Read more >Untitled
Stoicheia elements, Boo puppy, Molino nixtamal precio, Brent richards, Rocknet broadband ... Vincenzo raiola twitter, Multidisciplinary approach dictionary, ...
Read more >Untitled
Granatos live planas, Neymar boots gold, Keputusan pru 10 pahang, Clover irish ... Qc sports club membership, Horizontal scrolling div html5, Baby boutique ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think I might know what’s happening. I’ll take a look at this earlier next week.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.