Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock committed Mar 29, 2021
1 parent 0b03c5b commit 4f2bbb6
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/fixture/webpack/src/app.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { useCounter } from './useCounter'
import { h } from 'preact'
import { setup } from 'goober';
import { List } from './List.jsx';
import { Greeting } from './greeting.jsx';
import { StoreProvider } from './context.jsx';
import { Products } from './products.jsx';
import { Effect } from './effect.jsx';
import { Style } from './styles';
import { setup } from 'goober';
import { useCounter } from './useCounter'

setup(h);

Expand All @@ -31,6 +32,7 @@ export function App(props) {
<Products />
</StoreProvider>
<Effect />
<List />
</Style>
)
}
3 changes: 3 additions & 0 deletions test/fixture/webpack/src/hoc.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { h } from 'preact';

export const applyHOC = (Component) => (props) => <Component {...props} HOCApplied={true} />
8 changes: 8 additions & 0 deletions test/fixture/webpack/src/list.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { h } from 'preact'
import Item from './listItem.jsx'

const items = [0, 1, 2, 3]

export const List = () => {
return <div id="item-list">{items.map(item => <Item key={`item-${item}`} index={item}/>)}</div>
}
12 changes: 12 additions & 0 deletions test/fixture/webpack/src/listItem.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { h, Component } from 'preact'
import { applyHOC } from './hoc.jsx'

class ListItem extends Component {
render() {
return <div>item {this.props.index}</div>
}
}

const WrappedListItem = applyHOC(ListItem)

export default WrappedListItem

0 comments on commit 4f2bbb6

Please sign in to comment.