Skip to content
This repository was archived by the owner on Aug 9, 2023. It is now read-only.

Commit 666a3aa

Browse files
committed
Update tests for new react
1 parent 909604d commit 666a3aa

File tree

3 files changed

+13
-15
lines changed

3 files changed

+13
-15
lines changed

index.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,7 @@ function toH(h, node, ctx) {
111111

112112
/* Ensure no React warnings are triggered for
113113
* void elements having children passed in. */
114-
if (elements.length === 0) {
115-
elements = undefined;
116-
}
117-
118-
return h(selector, attributes, elements);
114+
return elements.length === 0 ? h(selector, attributes) : h(selector, attributes, elements);
119115
}
120116

121117
/* Add `name` and its `value` to `props`. */

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
"esmangle": "^1.0.0",
3737
"hyperscript": "^2.0.2",
3838
"nyc": "^11.0.0",
39-
"react": "^15.1.0",
40-
"react-dom": "^15.5.4",
39+
"react": "^16.1.1",
40+
"react-dom": "^16.1.1",
4141
"rehype": "^5.0.0",
4242
"remark-cli": "^4.0.0",
4343
"remark-preset-wooorm": "^3.0.0",

test.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,9 @@ test('hast-to-hyperscript', function (t) {
143143

144144
t.test('should support `React.createElement` in `development`', function (st) {
145145
var currentEnv = process.env.NODE_ENV;
146+
var baseline = doc.replace(/color:red;/, 'color:red');
146147
process.env.NODE_ENV = 'development';
147148

148-
var baseline = doc.replace(/ camel-case="on off"/, '');
149149
var actual = toH(r, hast);
150150
var expected = r(
151151
'h1',
@@ -154,14 +154,15 @@ test('hast-to-hyperscript', function (t) {
154154
id: 'a',
155155
className: 'b c',
156156
hidden: true,
157-
height: '2'
157+
height: 2
158158
},
159159
'bravo ',
160160
r('strong', {
161161
key: 'h-2',
162162
style: {color: 'red'},
163-
'aria-valuenow': '1',
164-
'data-some': 'yes'
163+
'camel-case': 'on off',
164+
'data-some': 'yes',
165+
'aria-valuenow': '1'
165166
}, ['charlie']),
166167
' delta',
167168
r('input', {
@@ -179,9 +180,9 @@ test('hast-to-hyperscript', function (t) {
179180

180181
t.test('should support `React.createElement` in `production`', function (st) {
181182
var currentEnv = process.env.NODE_ENV;
183+
var baseline = doc.replace(/color:red;/, 'color:red');
182184
process.env.NODE_ENV = 'production';
183185

184-
var baseline = doc.replace(/ camel-case="on off"/, '');
185186
var actual = toH(r, hast);
186187
var expected = r(
187188
'h1',
@@ -190,14 +191,15 @@ test('hast-to-hyperscript', function (t) {
190191
id: 'a',
191192
className: 'b c',
192193
hidden: true,
193-
height: '2'
194+
height: 2
194195
},
195196
'bravo ',
196197
r('strong', {
197198
key: 'h-2',
198199
style: {color: 'red'},
199-
'aria-valuenow': '1',
200-
'data-some': 'yes'
200+
'camel-case': 'on off',
201+
'data-some': 'yes',
202+
'aria-valuenow': '1'
201203
}, ['charlie']),
202204
' delta',
203205
r('input', {

0 commit comments

Comments
 (0)