Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use contentBoxSize as an array in useElementSize
- Loading branch information
Showing
60 changed files
with
2,172 additions
and
1,854 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 |
---|---|---|
|
@@ -35,4 +35,3 @@ jobs: | |
env: | ||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | ||
NODE_OPTIONS: --max-old-space-size=6144 | ||
|
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 |
---|---|---|
|
@@ -196,4 +196,3 @@ function getFunctionsSideBar() { | |
|
||
return links | ||
} | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,6 @@ onKeyStroke(true, (e) => { | |
onKeyStroke((e) => { | ||
e.preventDefault() | ||
}) | ||
|
||
``` | ||
|
||
### Custom Event Target | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { useActiveElement } from '.' | ||
|
||
describe('useActiveElement', () => { | ||
let shadowHost: HTMLElement | ||
let input: HTMLInputElement | ||
let shadowInput: HTMLInputElement | ||
let shadowRoot: ShadowRoot | ||
|
||
beforeEach(() => { | ||
shadowHost = document.createElement('div') | ||
shadowRoot = shadowHost.attachShadow({ mode: 'open' }) | ||
input = document.createElement('input') | ||
shadowInput = input.cloneNode() as HTMLInputElement | ||
shadowRoot.appendChild(shadowInput) | ||
document.body.appendChild(input) | ||
document.body.appendChild(shadowHost) | ||
}) | ||
|
||
afterEach(() => { | ||
shadowHost.remove() | ||
input.remove() | ||
}) | ||
|
||
it('should be defined', () => { | ||
expect(useActiveElement).toBeDefined() | ||
}) | ||
|
||
it('should initialise correctly', () => { | ||
const activeElement = useActiveElement() | ||
|
||
expect(activeElement.value).to.equal(document.body) | ||
}) | ||
|
||
it('should initialise with already-active element', () => { | ||
input.focus() | ||
|
||
const activeElement = useActiveElement() | ||
|
||
expect(activeElement.value).to.equal(input) | ||
}) | ||
|
||
it('should accept custom document', () => { | ||
const activeElement = useActiveElement({ document: shadowRoot }) | ||
|
||
shadowInput.focus() | ||
|
||
expect(activeElement.value).to.equal(shadowInput) | ||
}) | ||
|
||
it('should observe focus/blur events', () => { | ||
const activeElement = useActiveElement() | ||
|
||
input.focus() | ||
|
||
expect(activeElement.value).to.equal(input) | ||
|
||
input.blur() | ||
|
||
expect(activeElement.value).to.equal(document.body) | ||
}) | ||
}) |
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
Oops, something went wrong.