File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
test/unit/specs/mount/Wrapper Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -389,7 +389,7 @@ export default class Wrapper implements BaseWrapper {
389
389
throwError ( 'cannot call wrapper.text() on a wrapper without an element' )
390
390
}
391
391
392
- return this . element . textContent
392
+ return this . element . textContent . trim ( )
393
393
}
394
394
395
395
/**
Original file line number Diff line number Diff line change @@ -10,6 +10,17 @@ describe('text', () => {
10
10
expect ( wrapper . text ( ) ) . to . equal ( text )
11
11
} )
12
12
13
+ it ( 'returns trimmed text content of wrapper node' , ( ) => {
14
+ const text = 'test text prop'
15
+ const compiled = compileToFunctions ( `
16
+ <div>
17
+ ${ text }
18
+ </div>` )
19
+ const wrapper = mount ( compiled )
20
+
21
+ expect ( wrapper . text ( ) ) . to . equal ( text )
22
+ } )
23
+ 152
13
24
it ( 'throws error if wrapper does not contain element' , ( ) => {
14
25
const wrapper = mount ( { render : ( h ) => h ( 'div' ) } )
15
26
const div = wrapper . find ( 'div' )
You can’t perform that action at this time.
0 commit comments