Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"jquery": "^3.4.1",
"knockout": "^3.5.0",
"mithril": "^2.0.3",
"preact": "^8.4.2",
"preact": "^10.4.8",
"react": "^16.8.6",
"svelte": "^3.6.9",
"vue": "^2.6.10"
Expand Down
27 changes: 13 additions & 14 deletions preact.test.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
/** @jsx Preact.h */
/** @jsx h */
import '@testing-library/jest-dom/extend-expect'
import * as Preact from 'preact'
import {h, render as preactRender} from 'preact'
import {useState} from 'preact/hooks'
import {getQueriesForElement, fireEvent, wait} from '@testing-library/dom'

class Counter extends Preact.Component {
state = {count: 0}
increment = () => this.setState(({count}) => ({count: count + 1}))
render() {
return (
<div>
<button onClick={this.increment}>{this.state.count}</button>
</div>
)
}
function Counter() {
const [count, setCount] = useState(0)
const increment = () => setCount(c => c + 1)
return (
<div>
<button onClick={increment}>{count}</button>
</div>
)
}

function render(ui) {
const container = document.createElement('div')
Preact.render(ui, container)
preactRender(ui, container)
return {
container,
...getQueriesForElement(container),
container,
}
}

Expand Down