Skip to content

Commit bbc4382

Browse files
fix test
1 parent fe1603b commit bbc4382

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed

src/runtime/parse-property-value.ts

+21-19
Original file line numberDiff line numberDiff line change
@@ -55,29 +55,31 @@ export const parsePropertyValue = (propValue: unknown, propType: number): any =>
5555
return deserializeProperty(propValue);
5656
}
5757

58-
/**
59-
* ensure this value is of the correct prop type
60-
*/
61-
if (BUILD.propBoolean && propType & MEMBER_FLAGS.Boolean) {
58+
if (propValue != null && !isComplexType(propValue)) {
6259
/**
63-
* per the HTML spec, any string value means it is a boolean true value
64-
* but we'll cheat here and say that the string "false" is the boolean false
60+
* ensure this value is of the correct prop type
6561
*/
66-
return propValue === 'false' ? false : propValue === '' || !!propValue;
67-
}
62+
if (BUILD.propBoolean && propType & MEMBER_FLAGS.Boolean) {
63+
/**
64+
* per the HTML spec, any string value means it is a boolean true value
65+
* but we'll cheat here and say that the string "false" is the boolean false
66+
*/
67+
return propValue === 'false' ? false : propValue === '' || !!propValue;
68+
}
6869

69-
/**
70-
* force it to be a number
71-
*/
72-
if (typeof propValue === 'string' && BUILD.propNumber && propType & MEMBER_FLAGS.Number) {
73-
return parseFloat(propValue);
74-
}
70+
/**
71+
* force it to be a number
72+
*/
73+
if (BUILD.propNumber && propType & MEMBER_FLAGS.Number) {
74+
return parseFloat(propValue);
75+
}
7576

76-
/**
77-
* could have been passed as a number or boolean but we still want it as a string
78-
*/
79-
if (BUILD.propString && propType & MEMBER_FLAGS.String) {
80-
return String(propValue);
77+
/**
78+
* could have been passed as a number or boolean but we still want it as a string
79+
*/
80+
if (BUILD.propString && propType & MEMBER_FLAGS.String) {
81+
return String(propValue);
82+
}
8183
}
8284

8385
/**

0 commit comments

Comments
 (0)