Fix bug in WizardPanel property passing

This commit is contained in:
Eric Schultz 2018-06-27 16:19:55 -05:00
parent 68dcbaf515
commit 607b654091
3 changed files with 6 additions and 4 deletions
javascripts/src/components/common/wizard

View file

@ -28,7 +28,7 @@ describe('WizardPanel', () => {
ws.addTab('something', 'something label',{} ) ws.addTab('something', 'something label',{} )
ws.initialize() ws.initialize()
const tree = shallow(<Component.WizardPanel tab={ws.tabsByName['something']}><hr/></Component.WizardPanel>) const tree = shallow(<Component.WizardPanel tab={ws.tabsByName['something']} anotherProp={false}><hr/></Component.WizardPanel>)
expect(toJson(tree)).toMatchSnapshot() expect(toJson(tree)).toMatchSnapshot()

View file

@ -4,6 +4,7 @@ import { TabPanel } from "react-aria-tabpanel";
import { observer } from 'mobx-react' import { observer } from 'mobx-react'
import { WizardTabPanelState} from './wizard_state'; import { WizardTabPanelState} from './wizard_state';
import {computed} from 'mobx'; import {computed} from 'mobx';
import * as _ from 'lodash'
export interface WizardTabPanelProps { export interface WizardTabPanelProps {
@ -26,9 +27,9 @@ export class WizardPanel extends React.Component<WizardPanelProps, {}> {
} }
render() { render() {
let props = this.props.props ? this.props.props : {} let props = _.omit(this.props, ['tab'])
return <TabPanel tabId={this.tab.id} active={this.isActive} return <TabPanel {...props} tabId={this.tab.id} active={this.isActive}
{...props} className="wizard-step"> className="wizard-step">
{this.props.children} {this.props.children}
</TabPanel> </TabPanel>
} }

View file

@ -3,6 +3,7 @@
exports[`WizardPanel shallow render 1`] = ` exports[`WizardPanel shallow render 1`] = `
<AriaTabPanel-TabPanel <AriaTabPanel-TabPanel
active={true} active={true}
anotherProp={false}
className="wizard-step" className="wizard-step"
tabId="tab1" tabId="tab1"
tag="div" tag="div"