diff --git a/shells/dev/target/Target.vue b/shells/dev/target/Target.vue index 6be6d43f7..901090044 100644 --- a/shells/dev/target/Target.vue +++ b/shells/dev/target/Target.vue @@ -28,7 +28,8 @@ export default { items: [1, 2], regex: /(a\w+b)/g, nan: NaN, - infinity: Infinity + infinity: Infinity, + negativeInfinity: -Infinity } }, computed: { diff --git a/src/devtools/components/DataField.vue b/src/devtools/components/DataField.vue index 2fa1d7037..d1d7e3d8f 100644 --- a/src/devtools/components/DataField.vue +++ b/src/devtools/components/DataField.vue @@ -38,6 +38,7 @@ import { UNDEFINED, INFINITY, + NEGATIVE_INFINITY, NAN, isPlainObject, sortByKey @@ -78,6 +79,7 @@ export default { type === 'boolean' || type === 'number' || value === INFINITY || + value === NEGATIVE_INFINITY || value === NAN ) { return 'literal' @@ -101,6 +103,8 @@ export default { return 'NaN' } else if (value === INFINITY) { return 'Infinity' + } else if (value === NEGATIVE_INFINITY) { + return '-Infinity' } else if (Array.isArray(value)) { return 'Array[' + value.length + ']' } else if (isPlainObject(value)) { diff --git a/src/util.js b/src/util.js index ae1158acf..776064ebd 100644 --- a/src/util.js +++ b/src/util.js @@ -37,6 +37,7 @@ export function inDoc (node) { export const UNDEFINED = '__vue_devtool_undefined__' export const INFINITY = '__vue_devtool_infinity__' +export const NEGATIVE_INFINITY = '__vue_devtool_negative_infinity__' export const NAN = '__vue_devtool_nan__' export function stringify (data) { @@ -48,6 +49,8 @@ function replacer (key, val) { return UNDEFINED } else if (val === Infinity) { return INFINITY + } else if (val === -Infinity) { + return NEGATIVE_INFINITY } else if (Number.isNaN(val)) { return NAN } else if (val instanceof RegExp) { @@ -69,6 +72,8 @@ function reviver (key, val) { return undefined } else if (val === INFINITY) { return Infinity + } else if (val === NEGATIVE_INFINITY) { + return -Infinity } else if (val === NAN) { return NaN } else { diff --git a/test/specs/test.js b/test/specs/test.js index 69b7a0211..392b4eb77 100644 --- a/test/specs/test.js +++ b/test/specs/test.js @@ -38,10 +38,11 @@ module.exports = { .assert.containsText('.data-el.props .data-field:nth-child(2)', 'msg:\n"hi"') .assert.containsText('.data-el.props .data-field:nth-child(3)', 'obj:\nundefined') // Regexp - .assert.containsText('.data-el.data .data-field:nth-child(5)', 'regex:/(a\\w+b)/g') + .assert.containsText('.data-el.data .data-field:nth-child(6)', 'regex:/(a\\w+b)/g') // Literals .assert.containsText('.data-el.data .data-field:nth-child(4)', 'NaN') .assert.containsText('.data-el.data .data-field:nth-child(1)', 'Infinity') + .assert.containsText('.data-el.data .data-field:nth-child(5)', '-Infinity') // expand child instance .click('.instance .instance:nth-child(2) .arrow-wrapper')