Commit 12f407e2 authored by Benjamin Bouvier's avatar Benjamin Bouvier
Browse files

Rename the `has` helper to `assertHas`;

parent ebbcc440
import React from 'react';
import { has, translate as $t } from '../../helpers';
import { assertHas, translate as $t } from '../../helpers';
import ColorPicker from '../ui/color-picker';
export default class CreateForm extends React.Component {
constructor(props) {
has(props, 'onSave');
has(props, 'onCancel');
assertHas(props, 'onSave');
assertHas(props, 'onCancel');
// Facultative: previousValue, previousColor
super(props);
this.handleSave = this.handleSave.bind(this);
......
import React from 'react';
import { connect } from 'react-redux';
import { has, translate as $t } from '../../helpers';
import { assertHas, translate as $t } from '../../helpers';
import { actions } from '../../store';
import ConfirmDeleteModal from '../ui/confirm-delete-modal';
class DeleteOperation extends React.Component {
constructor(props) {
has(props, 'operation');
has(props, 'formatCurrency');
assertHas(props, 'operation');
assertHas(props, 'formatCurrency');
super(props);
}
......
import React from 'react';
import { has, translate as $t } from '../../helpers';
import { assertHas, translate as $t } from '../../helpers';
import { DetailedViewLabel } from './label';
import DeleteOperation from './delete-operation';
......@@ -15,10 +15,10 @@ export function computeAttachmentLink(op) {
export default class OperationDetails extends React.Component {
constructor(props) {
has(props, 'onToggleDetails');
has(props, 'operation');
has(props, 'rowClassName');
has(props, 'formatCurrency');
assertHas(props, 'onToggleDetails');
assertHas(props, 'operation');
assertHas(props, 'rowClassName');
assertHas(props, 'formatCurrency');
super(props);
}
......
import React from 'react';
import { translate as $t, has } from '../../helpers';
import { translate as $t, assertHas } from '../../helpers';
import { default as OperationDetails, computeAttachmentLink } from './details';
import { OperationListViewLabel } from './label';
......@@ -11,8 +11,8 @@ import CategorySelect from './category-select';
export default class Operation extends React.Component {
constructor(props) {
has(props, 'operation');
has(props, 'formatCurrency');
assertHas(props, 'operation');
assertHas(props, 'formatCurrency');
super(props);
this.state = {
showDetails: false
......
import React from 'react';
import { connect } from 'react-redux';
import { has, assert, translate as $t } from '../../helpers';
import { assertHas, assert, translate as $t } from '../../helpers';
import { actions } from '../../store';
// If the length of the short label (of an operation) is smaller than this
......@@ -12,7 +12,7 @@ const SMALL_TITLE_THRESHOLD = 4;
class LabelComponent extends React.Component {
constructor(props) {
has(props, 'operation');
assertHas(props, 'operation');
super(props);
this.state = {
editMode: false
......@@ -129,7 +129,7 @@ function mapDispatch(component) {
class DetailedViewLabel_ extends LabelComponent {
constructor(props) {
has(props, 'operation');
assertHas(props, 'operation');
super(props);
}
......@@ -150,8 +150,8 @@ export const DetailedViewLabel = mapDispatch(DetailedViewLabel_);
class OperationListViewLabel_ extends LabelComponent {
constructor(props) {
has(props, 'operation');
has(props, 'link');
assertHas(props, 'operation');
assertHas(props, 'link');
super(props);
}
......
import React from 'react';
import { connect } from 'react-redux';
import { has, translate as $t } from '../../helpers';
import { assertHas, translate as $t } from '../../helpers';
import { get, actions } from '../../store';
export default connect(state => {
......@@ -15,7 +15,7 @@ export default connect(state => {
}
};
})(props => {
has(props, 'account');
assertHas(props, 'account');
let text = (
props.synchronizing ?
......
......@@ -2,7 +2,7 @@ import React from 'react';
import { connect } from 'react-redux';
import { get, actions } from '../../../store';
import { has, translate as $t, NONE_CATEGORY_ID } from '../../../helpers';
import { assertHas, translate as $t, NONE_CATEGORY_ID } from '../../../helpers';
import CategorySelect from '../../operations/category-select';
import OperationTypeSelect from '../../operations/operation-type-select';
......@@ -14,7 +14,7 @@ import ValidableInputDate from '../../ui/checked-date';
class AddOperationModal extends React.Component {
constructor(props) {
has(props, 'account');
assertHas(props, 'account');
super(props);
this.state = this.makeClearState();
......
import React from 'react';
import { has, translate as $t } from '../../../helpers';
import { assertHas, translate as $t } from '../../../helpers';
export default class CustomBankField extends React.Component {
constructor(props) {
has(props, 'params');
assertHas(props, 'params');
super(props);
}
......
import React from 'react';
import { has, translate as $t } from '../../../helpers';
import { assertHas, translate as $t } from '../../../helpers';
import CustomBankField from './custom-bank-field';
import Modal from '../../ui/modal';
......@@ -37,7 +37,7 @@ export default class EditAccessModal extends React.Component {
}
constructor(props) {
has(props, 'modalId');
assertHas(props, 'modalId');
super(props);
this.handleSubmit = this.handleSubmit.bind(this);
this.extractCustomFieldValue = this.extractCustomFieldValue.bind(this);
......
......@@ -2,13 +2,13 @@ import React from 'react';
import { connect } from 'react-redux';
import { get, actions } from '../../../store';
import { has, assert, translate as $t } from '../../../helpers';
import { assertHas, assert, translate as $t } from '../../../helpers';
import CustomBankField from './custom-bank-field';
class NewBankForm extends React.Component {
constructor(props) {
has(props, 'expanded');
assertHas(props, 'expanded');
super(props);
this.state = {
......
import React from 'react';
import { connect } from 'react-redux';
import { has, translate as $t } from '../../../helpers';
import { assertHas, translate as $t } from '../../../helpers';
import { actions } from '../../../store';
import AccountSelector from './account-select';
......@@ -11,10 +11,10 @@ import Modal from '../../ui/modal';
class AlertCreationModal extends React.Component {
constructor(props) {
has(props, 'alertType');
has(props, 'modalId');
has(props, 'titleTranslationKey');
has(props, 'sendIfText');
assertHas(props, 'alertType');
assertHas(props, 'modalId');
assertHas(props, 'titleTranslationKey');
assertHas(props, 'sendIfText');
super(props);
this.state = { maybeLimitError: '' };
this.handleSubmit = this.handleSubmit.bind(this);
......
import React from 'react';
import { connect } from 'react-redux';
import { assert, has, translate as $t } from '../../../helpers';
import { assert, assertHas, translate as $t } from '../../../helpers';
import { actions } from '../../../store';
import ConfirmDeleteModal from '../../ui/confirm-delete-modal';
......@@ -9,9 +9,9 @@ import ConfirmDeleteModal from '../../ui/confirm-delete-modal';
class AlertItem extends React.Component {
constructor(props) {
has(props, 'alert');
has(props, 'account');
has(props, 'sendIfText');
assertHas(props, 'alert');
assertHas(props, 'account');
assertHas(props, 'sendIfText');
super(props);
this.handleSelect = this.handleSelect.bind(this);
this.handleChangeLimit = this.handleChangeLimit.bind(this);
......
import React from 'react';
import { connect } from 'react-redux';
import { has, translate as $t } from '../../../helpers';
import { assertHas, translate as $t } from '../../../helpers';
import { get } from '../../../store';
import AlertCreationModal from './alert-form-modal';
......@@ -10,10 +10,10 @@ import AlertItem from './alert-item';
class Alerts extends React.Component {
constructor(props) {
has(props, 'alertType');
has(props, 'sendIfText');
has(props, 'titleTranslationKey');
has(props, 'panelTitleKey');
assertHas(props, 'alertType');
assertHas(props, 'sendIfText');
assertHas(props, 'titleTranslationKey');
assertHas(props, 'panelTitleKey');
super(props);
}
......
import React from 'react';
import { connect } from 'react-redux';
import { assert, has, translate as $t } from '../../../helpers';
import { assert, assertHas, translate as $t } from '../../../helpers';
import { actions } from '../../../store';
import ConfirmDeleteModal from '../../ui/confirm-delete-modal';
......@@ -23,7 +23,7 @@ class ReportItem extends React.Component {
render() {
let { account, alert } = this.props;
has(alert, 'frequency');
assertHas(alert, 'frequency');
assert(alert.type === 'report');
return (
......
import React from 'react';
import { has } from '../../helpers';
import { assertHas } from '../../helpers';
import DatePicker from './date-picker';
export default class ValidableInputDate extends React.Component {
constructor(props) {
has(props, 'returnInputValue');
has(props, 'inputID');
has(props, 'label');
assertHas(props, 'returnInputValue');
assertHas(props, 'inputID');
assertHas(props, 'label');
super(props);
this.state = { valid: false };
this.handleSelect = this.handleSelect.bind(this);
......
import React from 'react';
import { has } from '../../helpers';
import { assertHas } from '../../helpers';
export default class ValidableInputNumber extends React.Component {
constructor(props) {
has(props, 'returnInputValue');
has(props, 'inputID');
has(props, 'step');
has(props, 'label');
assertHas(props, 'returnInputValue');
assertHas(props, 'inputID');
assertHas(props, 'step');
assertHas(props, 'label');
super(props);
this.state = { valid: false };
this.handleChange = this.handleChange.bind(this);
......
import React from 'react';
import { has } from '../../helpers';
import { assertHas } from '../../helpers';
export default class ValidableInputText extends React.Component {
constructor(props) {
has(props, 'returnInputValue');
has(props, 'inputID');
has(props, 'label');
assertHas(props, 'returnInputValue');
assertHas(props, 'inputID');
assertHas(props, 'label');
super(props);
this.state = { valid: false };
this.handleChange = this.handleChange.bind(this);
......
import React from 'react';
import { has, translate as $t } from '../../helpers';
import { assertHas, translate as $t } from '../../helpers';
import Modal from './modal';
export default class ConfirmDeleteModal extends React.Component {
constructor(props) {
has(props, 'modalId');
has(props, 'modalBody');
has(props, 'onDelete');
assertHas(props, 'modalId');
assertHas(props, 'modalBody');
assertHas(props, 'onDelete');
super(props);
}
......
import React from 'react';
import { has } from '../../helpers';
import { assertHas } from '../../helpers';
export default class Modal extends React.Component {
export default props => {
assertHas(props, 'modalId');
assertHas(props, 'modalBody');
assertHas(props, 'modalTitle');
assertHas(props, 'modalFooter');
constructor(props) {
has(props, 'modalId');
has(props, 'modalBody');
has(props, 'modalTitle');
has(props, 'modalFooter');
super(props);
}
render() {
return (
<div className="modal fade" id={ this.props.modalId } tabIndex="-1"
role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div className="modal-dialog">
<div className="modal-content">
<div className="modal-header">
<button type="button" className="close" data-dismiss="modal"
aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 className="modal-title" id="myModalLabel">
{ this.props.modalTitle }
</h4>
</div>
<div className="modal-body">
{ this.props.modalBody }
</div>
<div className="modal-footer">
{ this.props.modalFooter }
</div>
return (
<div className="modal fade" id={ props.modalId } tabIndex="-1"
role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div className="modal-dialog">
<div className="modal-content">
<div className="modal-header">
<button type="button" className="close" data-dismiss="modal"
aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 className="modal-title" id="myModalLabel">
{ props.modalTitle }
</h4>
</div>
<div className="modal-body">
{ props.modalBody }
</div>
<div className="modal-footer">
{ props.modalFooter }
</div>
</div>
</div>
);
}
}
</div>
);
};
import React from 'react';
import { has } from '../../helpers';
import { assertHas } from '../../helpers';
export default class SelectWithDefault extends React.Component {
constructor(props, options) {
has(props, 'defaultValue');
has(props, 'onChange');
has(props, 'htmlId');
assertHas(props, 'defaultValue');
assertHas(props, 'onChange');
assertHas(props, 'htmlId');
super(props);
this.options = options;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment