Skip to content

Commit

Permalink
fix(AlertCallContainer): change alertList to children prop
Browse files Browse the repository at this point in the history
BREAKING CHANGE: alertList prop has been changed to children
  • Loading branch information
bfbiggs authored and pauljeter committed Jun 25, 2019
1 parent 7296c05 commit a8efeb4
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 27 deletions.
6 changes: 3 additions & 3 deletions react/src/lib/AlertCall/examples/Default.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ export default class AlertCallDefault extends React.PureComponent {
color='primary'
/>
</div>
<AlertCallContainer
alertList={this.state.alertList}
/>
<AlertCallContainer>
{this.state.alertList}
</AlertCallContainer>
</div>
);
}
Expand Down
6 changes: 3 additions & 3 deletions react/src/lib/AlertCall/examples/Device.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ export default class AlertCallDevice extends React.PureComponent {
color='primary'
/>
</div>
<AlertCallContainer
alertList={this.state.alertList}
/>
<AlertCallContainer>
{this.state.alertList}
</AlertCallContainer>
</div>
);
}
Expand Down
6 changes: 3 additions & 3 deletions react/src/lib/AlertCall/examples/DeviceList.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ export default class AlertCallDeviceList extends React.PureComponent {
color='primary'
/>
</div>
<AlertCallContainer
alertList={this.state.alertList}
/>
<AlertCallContainer>
{this.state.alertList}
</AlertCallContainer>
</div>
);
}
Expand Down
6 changes: 3 additions & 3 deletions react/src/lib/AlertCall/examples/Number.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ export default class AlertCallNumber extends React.PureComponent {
color='primary'
/>
</div>
<AlertCallContainer
alertList={this.state.alertList}
/>
<AlertCallContainer>
{this.state.alertList}
</AlertCallContainer>
</div>
);
}
Expand Down
4 changes: 2 additions & 2 deletions react/src/lib/AlertCall/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,10 @@ AlertCall.propTypes = {
}).isRequired,
/** @prop Optional default selected device by index value or eventKey | 0 */
defaultSelectedDevice: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
/** @prop Optional header string for device selection list | "Device selection" */
deviceListHeader: PropTypes.string,
/** @prop Props to be passed to device button | null */
deviceBtnProps: PropTypes.object,
/** @prop Optional header string for device selection list | 'Device selection' */
deviceListHeader: PropTypes.string,
/** @prop Optional list of devices to answer call with | [] */
devices: PropTypes.array,
/** @prop Callback function invoked when the share button is clicked | null */
Expand Down
10 changes: 5 additions & 5 deletions react/src/lib/AlertCallContainer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import PropTypes from 'prop-types';

const AlertCallContainer = props => {
const {
alertList,
children,
...otherProps
} = props;

Expand All @@ -14,18 +14,18 @@ const AlertCallContainer = props => {
className='md-alert__container md-alert__container--call'
{...otherProps}
>
{alertList}
{children}
</div>
);
};

AlertCallContainer.defaultProps = {
alertList: []
children: null
};

AlertCallContainer.propTypes = {
/** @prop Array of AlertCall components | [] */
alertList: PropTypes.arrayOf(PropTypes.node)
/** @prop Children Nodes to Render inside container | null */
children: PropTypes.node,
};

AlertCallContainer.displayName = 'AlertCallContainer';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
exports[`tests for <AlertCallContainer /> should match SnapShot 1`] = `
ShallowWrapper {
Symbol(enzyme.__root__): [Circular],
Symbol(enzyme.__unrendered__): <AlertCallContainer
alertList={Array []}
/>,
Symbol(enzyme.__unrendered__): <AlertCallContainer />,
Symbol(enzyme.__renderer__): Object {
"batchedUpdates": [Function],
"checkPropTypes": [Function],
Expand All @@ -20,11 +18,11 @@ ShallowWrapper {
"key": undefined,
"nodeType": "host",
"props": Object {
"children": Array [],
"children": null,
"className": "md-alert__container md-alert__container--call",
},
"ref": null,
"rendered": Array [],
"rendered": null,
"type": "div",
},
Symbol(enzyme.__nodes__): Array [
Expand All @@ -33,11 +31,11 @@ ShallowWrapper {
"key": undefined,
"nodeType": "host",
"props": Object {
"children": Array [],
"children": null,
"className": "md-alert__container md-alert__container--call",
},
"ref": null,
"rendered": Array [],
"rendered": null,
"type": "div",
},
],
Expand Down
2 changes: 1 addition & 1 deletion react/src/lib/AlertCallContainer/tests/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ describe('tests for <AlertCallContainer />', () => {

it('should render no more than two call alerts at the same time', () => {
const alertList = [renderCaller1(), renderCaller2()];
const container = mount(<AlertCallContainer alertList={alertList}/>);
const container = mount(<AlertCallContainer children={alertList}/>);

expect(container.find(AlertCall).length).toEqual(2);
});
Expand Down

0 comments on commit a8efeb4

Please sign in to comment.