From ca8b8d1245026672b1a56d256bb8ff3c8bb1bba9 Mon Sep 17 00:00:00 2001 From: Corey Hulen Date: Mon, 27 Mar 2017 18:12:24 -0700 Subject: Fixing cancel ids for selenium (#5896) * Fixing ids for selenium * Fixing ids * Fixing prop --- webapp/utils/utils.jsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'webapp/utils/utils.jsx') diff --git a/webapp/utils/utils.jsx b/webapp/utils/utils.jsx index 16e208409..3bf877781 100644 --- a/webapp/utils/utils.jsx +++ b/webapp/utils/utils.jsx @@ -31,11 +31,19 @@ export function isMac() { return navigator.platform.toUpperCase().indexOf('MAC') >= 0; } -export function createSafeId(str) { - if (str === null) { +export function createSafeId(prop) { + if (prop === null) { return null; } + var str = ''; + + if (prop.props && prop.props.defaultMessage) { + str = prop.props.defaultMessage; + } else { + str = prop.toString(); + } + return str.replace(new RegExp(' ', 'g'), '_'); } -- cgit v1.2.3-1-g7c22