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/components/setting_item_max.jsx | 4 +++- webapp/components/setting_item_min.jsx | 4 ++-- webapp/utils/utils.jsx | 12 ++++++++++-- 3 files changed, 15 insertions(+), 5 deletions(-) (limited to 'webapp') diff --git a/webapp/components/setting_item_max.jsx b/webapp/components/setting_item_max.jsx index 2da500394..2e7be779a 100644 --- a/webapp/components/setting_item_max.jsx +++ b/webapp/components/setting_item_max.jsx @@ -87,8 +87,10 @@ export default class SettingItemMax extends React.Component { } let title; + let titleProp = 'unknownTitle'; if (this.props.title) { title =
  • {this.props.title}
  • ; + titleProp = this.props.title; } return ( @@ -107,7 +109,7 @@ export default class SettingItemMax extends React.Component { {clientError} {submit} {this.props.title} {editButton}
  • {this.props.describe} 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