Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit a8930a2

Browse files
committed
add test for stateless function components
1 parent 9363eb2 commit a8930a2

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

test/react-kup.coffee

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,3 +364,31 @@ test 'another complex react example', (t) ->
364364
"""
365365

366366
t.end()
367+
368+
test 'stateless functional component', (t) ->
369+
helloMessage = (props) ->
370+
reactKup (k) ->
371+
k.div "Hello #{props.name}"
372+
373+
element = React.createElement helloMessage,
374+
name: 'John'
375+
376+
t.ok elementProducesMarkup element, """
377+
<div>Hello John</div>
378+
"""
379+
380+
t.end()
381+
382+
test 'stateless functional component with implicit return', (t) ->
383+
helloMessage = ({name}) ->
384+
reactKup (k) ->
385+
k.div "Hello #{name}"
386+
387+
element = React.createElement helloMessage,
388+
name: 'John'
389+
390+
t.ok elementProducesMarkup element, """
391+
<div>Hello John</div>
392+
"""
393+
394+
t.end()

0 commit comments

Comments
 (0)