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 {
389389 throwError ( 'cannot call wrapper.text() on a wrapper without an element' )
390390 }
391391
392- return this . element . textContent
392+ return this . element . textContent . trim ( )
393393 }
394394
395395 /**
Original file line number Diff line number Diff line change @@ -10,6 +10,17 @@ describe('text', () => {
1010 expect ( wrapper . text ( ) ) . to . equal ( text )
1111 } )
1212
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
1324 it ( 'throws error if wrapper does not contain element' , ( ) => {
1425 const wrapper = mount ( { render : ( h ) => h ( 'div' ) } )
1526 const div = wrapper . find ( 'div' )
You can’t perform that action at this time.
0 commit comments