mirror of
https://github.com/mattermost/mattermost.git
synced 2026-05-28 04:35:04 -04:00
Fixing cancel ids for selenium (#5896)
* Fixing ids for selenium * Fixing ids * Fixing prop
This commit is contained in:
parent
022627f940
commit
ca8b8d1245
3 changed files with 15 additions and 5 deletions
|
|
@ -87,8 +87,10 @@ export default class SettingItemMax extends React.Component {
|
|||
}
|
||||
|
||||
let title;
|
||||
let titleProp = 'unknownTitle';
|
||||
if (this.props.title) {
|
||||
title = <li className='col-sm-12 section-title'>{this.props.title}</li>;
|
||||
titleProp = this.props.title;
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
@ -107,7 +109,7 @@ export default class SettingItemMax extends React.Component {
|
|||
{clientError}
|
||||
{submit}
|
||||
<a
|
||||
id={Utils.createSafeId(this.props.title.toString() + 'Cancel')}
|
||||
id={Utils.createSafeId(titleProp) + 'Cancel'}
|
||||
className='btn btn-sm'
|
||||
href='#'
|
||||
onClick={this.props.updateSection}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ export default class SettingItemMin extends React.Component {
|
|||
editButton = (
|
||||
<li className='col-xs-12 col-sm-3 section-edit'>
|
||||
<a
|
||||
id={Utils.createSafeId(this.props.title.toString() + 'Edit')}
|
||||
id={Utils.createSafeId(this.props.title) + 'Edit'}
|
||||
className='theme'
|
||||
href='#'
|
||||
onClick={this.props.updateSection}
|
||||
|
|
@ -36,7 +36,7 @@ export default class SettingItemMin extends React.Component {
|
|||
<li className='col-xs-12 col-sm-9 section-title'>{this.props.title}</li>
|
||||
{editButton}
|
||||
<li
|
||||
id={Utils.createSafeId(this.props.title.toString() + 'Desc')}
|
||||
id={Utils.createSafeId(this.props.title) + 'Desc'}
|
||||
className='col-xs-12 section-describe'
|
||||
>
|
||||
{this.props.describe}
|
||||
|
|
|
|||
|
|
@ -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'), '_');
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue