-
Notifications
You must be signed in to change notification settings - Fork 41
Closed
Labels
Description
expect(imageElement.style[computed]).toBe(`inset 0px 0px 0px 400px ${c}`)
This errors:
A fatal parsing error occurred in autofix.
Error: Parsing error: Unexpected token :
Autofix output:
expect(imageElement).toHaveStyle(: inset 0px 0px 0px 400px ${c}`)
We should not provide a fixer for this case, because we can't determine if the matcher value is meant to be a property or a value (since the accessor could either be the name of a property, or the index of one) so can't correctly fix it.
e.g.
expect(el.style[computed]).toEqual('padding');
// should become
expect(el.style[computed]).toHaveStyle({ padding: expect.anything() });
// but instead becomes
expect(el.style[computed]).toHaveStyle('padding');
expect(el.style[computed]).toEqual('padding');
// should become
expect(el.style[computed]).toHaveStyle({ [computed]: '5px' });
expect(el.style[computed]).toHaveStyle({ padding: expect.anything() });
// but instead becomes
expect(el.style[computed]).toHaveStyle({ '5px': expect.anything() });
(because of #264)