Skip to content

Commit 309e507

Browse files
DylanPierceyKent C. Dodds
authored and
Kent C. Dodds
committed
test: add tests for get-node-text (#307)
1 parent aa60afe commit 309e507

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/__tests__/get-node-text.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import {getNodeText} from '../get-node-text'
2+
import {render} from './helpers/test-utils'
3+
4+
test('it prints out the text content of a container', () => {
5+
const {container} = render('Hello <!--skipped-->World!')
6+
expect(getNodeText(container)).toMatchInlineSnapshot(`"Hello World!"`)
7+
})
8+
9+
test('it prints the value for submit and button inputs', () => {
10+
const {container} = render(
11+
'<input type="submit" value="save"><input type="button" value="reset">',
12+
)
13+
14+
expect(getNodeText(container.firstChild)).toMatchInlineSnapshot(`"save"`)
15+
16+
expect(getNodeText(container.lastChild)).toMatchInlineSnapshot(`"reset"`)
17+
})

0 commit comments

Comments
 (0)