Fix bug where labels with spaces weren't being escaped when selected

This commit is contained in:
Clement Ho 2016-12-12 10:55:43 -06:00
parent 5589ab1e0b
commit aebee11884

View file

@ -29,7 +29,6 @@
let escapedText = text;
const hasSpace = text.indexOf(' ') !== -1;
const hasDoubleQuote = text.indexOf('"') !== -1;
const hasSingleQuote = text.indexOf('\'') !== -1;
// Encapsulate value with quotes if it has spaces
// Known side effect: values's with both single and double quotes
@ -37,7 +36,8 @@
if (hasSpace) {
if (hasDoubleQuote) {
escapedText = `'${text}'`;
} else if (hasSingleQuote) {
} else {
// Encapsulate singleQuotes or if it hasSpace
escapedText = `"${text}"`;
}
}