Skip to content

Commit 0c27987

Browse files
test(attributes-to-props): test that CSS comment is not parsed
This helps improve test coverage for `attributes-to-props.js`. Move empty style test to its own it block.
1 parent ef04eff commit 0c27987

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

test/attributes-to-props.js

+12-10
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,19 @@ describe('attributes-to-props', () => {
171171
});
172172
});
173173

174+
// cssToJs
174175
describe('style', () => {
175-
it('converts inline style to object', () => {
176+
it('parses empty inline style to object', () => {
177+
assert.deepEqual(attributesToProps({ style: '' }), { style: {} });
178+
});
179+
180+
it('does not parse CSS comment', () => {
181+
assert.deepEqual(attributesToProps({ style: '/* comment */' }), {
182+
style: {}
183+
});
184+
});
185+
186+
it('parses inline style to object', () => {
176187
assert.deepEqual(
177188
attributesToProps({
178189
style:
@@ -222,15 +233,6 @@ describe('attributes-to-props', () => {
222233
style: undefined
223234
}
224235
);
225-
226-
assert.deepEqual(
227-
attributesToProps({
228-
style: ''
229-
}),
230-
{
231-
style: {}
232-
}
233-
);
234236
});
235237

236238
[Object, Array, Number, Date, Function].forEach(type => {

0 commit comments

Comments
 (0)