File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ module.exports = {
28
28
} ,
29
29
rootDir : __dirname ,
30
30
testMatch : [
31
- // '<rootDir>/packages/nerv/__tests__/event .spec.js',
31
+ // '<rootDir>/packages/nerv/__tests__/cloneElement .spec.js',
32
32
// '<rootDir>/packages/nerv/__tests__/component.spec.js',
33
33
// '<rootDir>/packages/nerv/__tests__/render.spec.js',
34
34
// '<rootDir>/packages/nerv/__tests__/lifecycle.spec.js',
Original file line number Diff line number Diff line change @@ -9,6 +9,28 @@ describe('cloneElement()', () => {
9
9
scratch = document . createElement ( 'div' )
10
10
} )
11
11
12
+ it ( 'can clone vtext' , ( ) => {
13
+ const t = cloneElement ( 'test' )
14
+ expect ( t . text ) . toEqual ( 'test' )
15
+ } )
16
+
17
+ it ( 'can clone svg' , ( ) => {
18
+ const t1 = createElement ( 'svg' )
19
+ render ( t1 , scratch )
20
+ const t2 = cloneElement ( t1 )
21
+ expect ( t2 . namespace ) . toBeTruthy ( )
22
+ } )
23
+
24
+ it ( 'can clone fragment' , ( ) => {
25
+ const f1 = [
26
+ < div > 1</ div > ,
27
+ < span > 2</ span >
28
+ ]
29
+ const f2 = cloneElement ( f1 )
30
+ expect ( f2 [ 0 ] . children . text ) . toBe ( '1' )
31
+ expect ( f2 [ 1 ] . children . text ) . toBe ( '2' )
32
+ } )
33
+
12
34
it ( 'can clone a vnode with props' , ( ) => {
13
35
const vnode = < div className = 'hh' style = { { width : '800px' } } />
14
36
const cloneVNode = cloneElement ( vnode )
You can’t perform that action at this time.
0 commit comments