@@ -71,7 +71,7 @@ describe('DOMElement Plugin', () => {
71
71
const parent = document . createElement ( 'div' ) ;
72
72
parent . setAttribute ( 'style' , 'color: #99424F' ) ;
73
73
const text = document . createTextNode ( 'Jest' ) ;
74
- parent . appendChild ( text ) ;
74
+ parent . append ( text ) ;
75
75
76
76
expect ( parent ) . toPrettyPrintTo (
77
77
'<div\n style="color: #99424F"\n>\n Jest\n</div>' ,
@@ -81,22 +81,22 @@ describe('DOMElement Plugin', () => {
81
81
it ( 'supports an element with text content' , ( ) => {
82
82
const parent = document . createElement ( 'div' ) ;
83
83
const child = document . createTextNode ( 'texty texty' ) ;
84
- parent . appendChild ( child ) ;
84
+ parent . append ( child ) ;
85
85
86
86
expect ( parent ) . toPrettyPrintTo ( '<div>\n texty texty\n</div>' ) ;
87
87
} ) ;
88
88
89
89
it ( 'supports nested elements' , ( ) => {
90
90
const parent = document . createElement ( 'div' ) ;
91
91
const child = document . createElement ( 'span' ) ;
92
- parent . appendChild ( child ) ;
92
+ parent . append ( child ) ;
93
93
expect ( parent ) . toPrettyPrintTo ( '<div>\n <span />\n</div>' ) ;
94
94
} ) ;
95
95
96
96
it ( 'supports nested elements with attributes' , ( ) => {
97
97
const parent = document . createElement ( 'div' ) ;
98
98
const child = document . createElement ( 'span' ) ;
99
- parent . appendChild ( child ) ;
99
+ parent . append ( child ) ;
100
100
101
101
// set attributes in sorted order by name
102
102
child . setAttribute ( 'class' , 'classy' ) ;
@@ -110,11 +110,11 @@ describe('DOMElement Plugin', () => {
110
110
it ( 'supports nested elements with attribute and text content' , ( ) => {
111
111
const parent = document . createElement ( 'div' ) ;
112
112
const child = document . createElement ( 'span' ) ;
113
- parent . appendChild ( child ) ;
113
+ parent . append ( child ) ;
114
114
115
115
child . setAttribute ( 'style' , 'color: #99424F' ) ;
116
116
const text = document . createTextNode ( 'Jest' ) ;
117
- child . appendChild ( text ) ;
117
+ child . append ( text ) ;
118
118
119
119
expect ( parent ) . toPrettyPrintTo (
120
120
'<div>\n <span\n style="color: #99424F"\n >\n Jest\n </span>\n</div>' ,
@@ -124,7 +124,7 @@ describe('DOMElement Plugin', () => {
124
124
it ( 'supports nested elements with text content' , ( ) => {
125
125
const parent = document . createElement ( 'div' ) ;
126
126
const child = document . createElement ( 'span' ) ;
127
- parent . appendChild ( child ) ;
127
+ parent . append ( child ) ;
128
128
child . textContent = 'texty texty' ;
129
129
130
130
expect ( parent ) . toPrettyPrintTo (
@@ -228,11 +228,11 @@ Testing.`;
228
228
// React 16 does not render text in comments (see below)
229
229
const parent = document . createElement ( 'span' ) ;
230
230
const text = document . createTextNode ( '' ) ;
231
- parent . appendChild ( text ) ;
231
+ parent . append ( text ) ;
232
232
const abbr = document . createElement ( 'abbr' ) ;
233
233
abbr . setAttribute ( 'title' , 'meter' ) ;
234
234
abbr . innerHTML = 'm' ;
235
- parent . appendChild ( abbr ) ;
235
+ parent . append ( abbr ) ;
236
236
237
237
expect ( parent ) . toPrettyPrintTo (
238
238
[
@@ -321,7 +321,7 @@ Testing.`;
321
321
for ( const browser of browsers ) {
322
322
const li = document . createElement ( 'li' ) ;
323
323
li . textContent = browser ;
324
- fragment . appendChild ( li ) ;
324
+ fragment . append ( li ) ;
325
325
}
326
326
327
327
expect ( fragment ) . toPrettyPrintTo (
@@ -458,7 +458,7 @@ Testing.`;
458
458
const namespace = 'http://www.w3.org/2000/svg' ;
459
459
460
460
const title = document . createElementNS ( namespace , 'title' ) ;
461
- title . appendChild ( document . createTextNode ( 'JS community logo' ) ) ;
461
+ title . append ( document . createTextNode ( 'JS community logo' ) ) ;
462
462
463
463
const rect = document . createElementNS ( namespace , 'rect' ) ;
464
464
// printProps sorts attributes in order by name
@@ -475,18 +475,18 @@ Testing.`;
475
475
g . setAttribute ( 'fill' , 'none' ) ;
476
476
g . setAttribute ( 'stroke' , '#000000' ) ;
477
477
g . setAttribute ( 'stroke-width' , '0.095' ) ;
478
- g . appendChild ( polyline ) ;
479
- g . appendChild ( comment ) ;
478
+ g . append ( polyline ) ;
479
+ g . append ( comment ) ;
480
480
481
481
const svg = document . createElementNS ( namespace , 'svg' ) ;
482
482
svg . setAttribute ( 'viewBox' , '0 0 1 1' ) ;
483
- svg . appendChild ( title ) ;
484
- svg . appendChild ( rect ) ;
485
- svg . appendChild ( g ) ;
483
+ svg . append ( title ) ;
484
+ svg . append ( rect ) ;
485
+ svg . append ( g ) ;
486
486
487
487
const parent = document . createElement ( 'div' ) ;
488
488
parent . setAttribute ( 'id' , 'JS' ) ;
489
- parent . appendChild ( svg ) ;
489
+ parent . append ( svg ) ;
490
490
491
491
expect ( parent ) . toPrettyPrintTo (
492
492
[
@@ -558,9 +558,9 @@ Testing.`;
558
558
dd2 . setAttribute ( 'style' , 'color: #99424F' ) ;
559
559
560
560
const dl = document . createElement ( 'dl' ) ;
561
- dl . appendChild ( dt ) ;
562
- dl . appendChild ( dd1 ) ;
563
- dl . appendChild ( dd2 ) ;
561
+ dl . append ( dt ) ;
562
+ dl . append ( dd1 ) ;
563
+ dl . append ( dd2 ) ;
564
564
565
565
expect ( dl ) . toPrettyPrintTo (
566
566
[
0 commit comments