Add selectors for tests and fix bugs

This commit is contained in:
soupette 2018-11-16 09:18:57 +01:00
parent d9ee893c8f
commit 5406b678ac
3 changed files with 12 additions and 8 deletions

View File

@ -30,22 +30,25 @@ function PopUpWarning({ content, isOpen, onConfirm, onlyConfirmButton, popUpWarn
const buttons = [
{
className: styles.secondary,
id: content.cancel || 'components.popUpWarning.button.cancel',
id: 'ctaCancel',
handleClick: toggleModal,
message: content.cancel || 'components.popUpWarning.button.cancel',
style: {},
},
{
className: styles.primary,
id: content.confirm || 'components.popUpWarning.button.confirm',
id: 'ctaConfirm',
handleClick: onConfirm,
message: content.confirm || 'components.popUpWarning.button.confirm',
style: {},
},
];
const singleButton = [
{
className: styles.primary,
id: content.confirm || 'components.popUpWarning.button.confirm',
id: 'ctaConfirm',
handleClick: onConfirm,
message: content.confirm || 'components.popUpWarning.button.confirm',
style: { width: '100%' },
},
];
@ -68,8 +71,8 @@ function PopUpWarning({ content, isOpen, onConfirm, onlyConfirmButton, popUpWarn
</div>
<div className={styles.popUpWarningButtonContainer}>
{map(footerButtons, (button) => (
<FormattedMessage id={button.id} key={button.id}>
{(message) => <Button onClick={button.handleClick} className={button.className} style={button.style}>{message}</Button>}
<FormattedMessage id={button.message} key={button.id}>
{(message) => <Button onClick={button.handleClick} className={button.className} id={button.id} style={button.style}>{message}</Button>}
</FormattedMessage>
))}
</div>

View File

@ -35,7 +35,7 @@ class TableList extends React.Component { // eslint-disable-line react/prefer-st
</div>
<div className="row">
<div className={styles.ulContainer}>
<ul>
<ul id="ctbModelsList">
<li>
<div className={`${styles.liHeaderContainer} row`}>
<div className="col-md-1"></div>

View File

@ -6,7 +6,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { isEmpty, startCase } from 'lodash';
import { get, isEmpty, startCase } from 'lodash';
import { FormattedMessage } from 'react-intl';
import IcoContainer from 'components/IcoContainer';
import ListRow from 'components/ListRow';
@ -51,6 +51,7 @@ class TableListRow extends React.Component {
handleShowModalWarning = () => this.setState({ showWarning: !this.state.showWarning });
render() {
const name = get(this.props.rowItem, 'name', 'default');
const pluginSource = this.props.rowItem.source ? (
<FormattedMessage id="content-type-builder.from">
{message => (
@ -75,7 +76,7 @@ class TableListRow extends React.Component {
? []
: [
{ icoType: 'pencil', onClick: this.handleEdit },
{ icoType: 'trash', onClick: this.handleShowModalWarning },
{ icoType: 'trash', onClick: this.handleShowModalWarning, id: `delete${name}` },
];
return (