-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Ignore before/after pseudo elements in JSDOM (#380)
- Loading branch information
Showing
8 changed files
with
123 additions
and
84 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
"dom-accessibility-api": minor | ||
--- | ||
|
||
**BREAKING CHANGE** | ||
|
||
Ignore `::before` and `::after` by default. | ||
|
||
This was necessary to prevent excessive warnings in `jsdom@^16.3.0`. | ||
If you use this package in a browser that supports the second argument of `window.getComputedStyle` you can set the `computedStyleSupportsPseudoElements` option to true: | ||
|
||
```ts | ||
computeAccessibleName(element, { | ||
computedStyleSupportsPseudoElements: true, | ||
}); | ||
|
||
computeAccessibleDescription(element, { | ||
computedStyleSupportsPseudoElements: true, | ||
}); | ||
``` | ||
|
||
If you pass a custom implementation of `getComputedStyle` then this option defaults to `true`. | ||
The following two calls are equivalent: | ||
|
||
```ts | ||
computeAccessibleName(element, { | ||
computedStyleSupportsPseudoElements: true, | ||
}); | ||
|
||
computeAccessibleName(element, { | ||
getComputedStyle: (element, pseudoElement) => { | ||
// custom implementation | ||
}, | ||
}); | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* eslint-env jest */ | ||
|
||
let spy; | ||
beforeEach(() => { | ||
spy = jest.spyOn(console, "error").mockImplementation((message) => { | ||
console.log(message); | ||
throw new Error(message); | ||
}); | ||
}); | ||
|
||
afterEach(() => { | ||
spy.mockRestore(); | ||
}); |
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