Fixing issue with ids for selenium (#5859)

* Fixing issue with ids for selenium

* removing comment
Этот коммит содержится в:
Corey Hulen
2017-03-23 19:41:08 -07:00
коммит произвёл GitHub
родитель 6935e2d5ea
Коммит 98baf1536e
3 изменённых файлов: 12 добавлений и 3 удалений

Просмотреть файл

@@ -107,7 +107,7 @@ export default class SettingItemMax extends React.Component {
{clientError} {clientError}
{submit} {submit}
<a <a
id={this.props.title + 'Cancel'} id={Utils.createSafeId(this.props.title.toString() + 'Cancel')}
className='btn btn-sm' className='btn btn-sm'
href='#' href='#'
onClick={this.props.updateSection} onClick={this.props.updateSection}

Просмотреть файл

@@ -2,6 +2,7 @@
// See License.txt for license information. // See License.txt for license information.
import {FormattedMessage} from 'react-intl'; import {FormattedMessage} from 'react-intl';
import * as Utils from 'utils/utils.jsx';
import React from 'react'; import React from 'react';
@@ -12,7 +13,7 @@ export default class SettingItemMin extends React.Component {
editButton = ( editButton = (
<li className='col-xs-12 col-sm-3 section-edit'> <li className='col-xs-12 col-sm-3 section-edit'>
<a <a
id={this.props.title} id={Utils.createSafeId(this.props.title.toString() + 'Edit')}
className='theme' className='theme'
href='#' href='#'
onClick={this.props.updateSection} onClick={this.props.updateSection}
@@ -35,7 +36,7 @@ export default class SettingItemMin extends React.Component {
<li className='col-xs-12 col-sm-9 section-title'>{this.props.title}</li> <li className='col-xs-12 col-sm-9 section-title'>{this.props.title}</li>
{editButton} {editButton}
<li <li
id={this.props.title + 'Desc'} id={Utils.createSafeId(this.props.title.toString() + 'Desc')}
className='col-xs-12 section-describe' className='col-xs-12 section-describe'
> >
{this.props.describe} {this.props.describe}

Просмотреть файл

@@ -31,6 +31,14 @@ export function isMac() {
return navigator.platform.toUpperCase().indexOf('MAC') >= 0; return navigator.platform.toUpperCase().indexOf('MAC') >= 0;
} }
export function createSafeId(str) {
if (str === null) {
return null;
}
return str.replace(' ', '_');
}
export function cmdOrCtrlPressed(e) { export function cmdOrCtrlPressed(e) {
return (isMac() && e.metaKey) || (!isMac() && e.ctrlKey && !e.altKey); return (isMac() && e.metaKey) || (!isMac() && e.ctrlKey && !e.altKey);
} }