react: trying to get enzyme and mobx tests working

This commit is contained in:
Torkel Ödegaard
2018-01-01 15:39:26 +01:00
parent 8f50795a94
commit 3301f8f194
7 changed files with 300 additions and 16 deletions

View File

@@ -25,19 +25,21 @@ export class AlertRuleList extends React.Component<AlertRuleListProps, any> {
constructor(props) {
super(props);
const store = this.props.store;
store.nav.load('alerting', 'alert-list');
store.alertList.setStateFilter(store.view.query.get('state') || 'all');
store.alertList.loadRules();
this.props.store.nav.load('alerting', 'alert-list');
this.fetchRules();
}
onStateFilterChanged = evt => {
this.props.store.alertList.setStateFilter(evt.target.value);
this.props.store.view.updateQuery({ state: evt.target.value });
this.props.store.alertList.loadRules();
this.fetchRules();
};
fetchRules() {
this.props.store.alertList.loadRules({
state: this.props.store.view.query.get('state') || 'all',
});
}
onOpenHowTo = () => {
appEvents.emit('show-modal', {
src: 'public/app/features/alerting/partials/alert_howto.html',
@@ -48,6 +50,7 @@ export class AlertRuleList extends React.Component<AlertRuleListProps, any> {
render() {
const { nav, alertList } = this.props.store;
console.log('render', alertList.rules.length);
return (
<div>