Skip to content

Commit

Permalink
fix(ButtonGroup): update to new context api
Browse files Browse the repository at this point in the history
BREAKING CHANGE:

1. Button
  * add eventKey prop for tracking active
  * add keyboardKey prop for moving focus
  * add id prop to overwrite id from react-uid
  * remove index prop used by prior context
2. ButtonGroup
  * change activeIndex prop to active (string value correlating to eventKey or id)
  * add focusFirstQuery to modify selector query of inital focusable element
  * add focusQuery to modify selector query of focusable elements
  • Loading branch information
bfbiggs authored and pauljeter committed Oct 2, 2019
1 parent 53f570e commit 47bbc4b
Show file tree
Hide file tree
Showing 27 changed files with 980 additions and 1,358 deletions.
48 changes: 16 additions & 32 deletions react/src/lib/ActivityButton/tests/__snapshots__/index.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@ ShallowWrapper {
Symbol(enzyme.__node__): Object {
"instance": null,
"key": undefined,
"nodeType": "class",
"nodeType": "function",
"props": Object {
"active": false,
"ariaLabel": "test",
"ariaLabelledBy": "",
"children": <Icon
append={false}
ariaLabel={null}
Expand All @@ -47,22 +45,11 @@ ShallowWrapper {
/>,
"circle": true,
"className": "md-activity md-activity__chat",
"color": "",
"color": undefined,
"containerLarge": false,
"disabled": false,
"expand": false,
"href": "",
"index": null,
"isButtonGroup": false,
"label": "",
"large": false,
"loading": false,
"onClick": null,
"removeStyle": false,
"size": 68,
"style": Object {},
"tag": "button",
"type": "button",
},
"ref": null,
"rendered": Object {
Expand Down Expand Up @@ -90,17 +77,20 @@ ShallowWrapper {
"rendered": null,
"type": [Function],
},
"type": [Function],
"type": Object {
"$$typeof": Symbol(react.forward_ref),
"defaultProps": undefined,
"propTypes": undefined,
"render": [Function],
},
},
Symbol(enzyme.__nodes__): Array [
Object {
"instance": null,
"key": undefined,
"nodeType": "class",
"nodeType": "function",
"props": Object {
"active": false,
"ariaLabel": "test",
"ariaLabelledBy": "",
"children": <Icon
append={false}
ariaLabel={null}
Expand All @@ -120,22 +110,11 @@ ShallowWrapper {
/>,
"circle": true,
"className": "md-activity md-activity__chat",
"color": "",
"color": undefined,
"containerLarge": false,
"disabled": false,
"expand": false,
"href": "",
"index": null,
"isButtonGroup": false,
"label": "",
"large": false,
"loading": false,
"onClick": null,
"removeStyle": false,
"size": 68,
"style": Object {},
"tag": "button",
"type": "button",
},
"ref": null,
"rendered": Object {
Expand Down Expand Up @@ -163,7 +142,12 @@ ShallowWrapper {
"rendered": null,
"type": [Function],
},
"type": [Function],
"type": Object {
"$$typeof": Symbol(react.forward_ref),
"defaultProps": undefined,
"propTypes": undefined,
"render": [Function],
},
},
],
Symbol(enzyme.__options__): Object {
Expand Down
2 changes: 1 addition & 1 deletion react/src/lib/ActivityButton/tests/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('tests for <ActivityButton />', () => {
});

it('should render one ActivityButton button', () => {
const container = shallow(<ActivityButton type='camera' ariaLabel='test' />);
const container = mount(<ActivityButton type='camera' ariaLabel='test' />);

expect(container.find('Button').length).toEqual(1);
});
Expand Down
148 changes: 22 additions & 126 deletions react/src/lib/Alert/tests/__snapshots__/index.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -46,28 +46,9 @@ ShallowWrapper {
<div
className="md-alert__button"
>
<Button
active={false}
ariaLabel=""
ariaLabelledBy=""
<ForwardRef(ContextTransform(Button))
circle={true}
className=""
color=""
containerLarge={false}
disabled={false}
expand={false}
href=""
index={null}
isButtonGroup={false}
label=""
large={false}
loading={false}
onClick={null}
removeStyle={false}
size={44}
style={Object {}}
tag="button"
type="button"
>
<Icon
append={false}
Expand All @@ -86,7 +67,7 @@ ShallowWrapper {
title=""
type=""
/>
</Button>
</ForwardRef(ContextTransform(Button))>
</div>,
],
"className": "md-alert md-alert--info",
Expand Down Expand Up @@ -157,28 +138,9 @@ ShallowWrapper {
"key": undefined,
"nodeType": "host",
"props": Object {
"children": <Button
active={false}
ariaLabel=""
ariaLabelledBy=""
"children": <ForwardRef(ContextTransform(Button))
circle={true}
className=""
color=""
containerLarge={false}
disabled={false}
expand={false}
href=""
index={null}
isButtonGroup={false}
label=""
large={false}
loading={false}
onClick={null}
removeStyle={false}
size={44}
style={Object {}}
tag="button"
type="button"
>
<Icon
append={false}
Expand All @@ -197,18 +159,15 @@ ShallowWrapper {
title=""
type=""
/>
</Button>,
</ForwardRef(ContextTransform(Button))>,
"className": "md-alert__button",
},
"ref": null,
"rendered": Object {
"instance": null,
"key": undefined,
"nodeType": "class",
"nodeType": "function",
"props": Object {
"active": false,
"ariaLabel": "",
"ariaLabelledBy": "",
"children": <Icon
append={false}
ariaLabel={null}
Expand All @@ -227,23 +186,7 @@ ShallowWrapper {
type=""
/>,
"circle": true,
"className": "",
"color": "",
"containerLarge": false,
"disabled": false,
"expand": false,
"href": "",
"index": null,
"isButtonGroup": false,
"label": "",
"large": false,
"loading": false,
"onClick": null,
"removeStyle": false,
"size": 44,
"style": Object {},
"tag": "button",
"type": "button",
},
"ref": null,
"rendered": Object {
Expand Down Expand Up @@ -271,7 +214,12 @@ ShallowWrapper {
"rendered": null,
"type": [Function],
},
"type": [Function],
"type": Object {
"$$typeof": Symbol(react.forward_ref),
"defaultProps": undefined,
"propTypes": undefined,
"render": [Function],
},
},
"type": "div",
},
Expand Down Expand Up @@ -305,28 +253,9 @@ ShallowWrapper {
<div
className="md-alert__button"
>
<Button
active={false}
ariaLabel=""
ariaLabelledBy=""
<ForwardRef(ContextTransform(Button))
circle={true}
className=""
color=""
containerLarge={false}
disabled={false}
expand={false}
href=""
index={null}
isButtonGroup={false}
label=""
large={false}
loading={false}
onClick={null}
removeStyle={false}
size={44}
style={Object {}}
tag="button"
type="button"
>
<Icon
append={false}
Expand All @@ -345,7 +274,7 @@ ShallowWrapper {
title=""
type=""
/>
</Button>
</ForwardRef(ContextTransform(Button))>
</div>,
],
"className": "md-alert md-alert--info",
Expand Down Expand Up @@ -416,28 +345,9 @@ ShallowWrapper {
"key": undefined,
"nodeType": "host",
"props": Object {
"children": <Button
active={false}
ariaLabel=""
ariaLabelledBy=""
"children": <ForwardRef(ContextTransform(Button))
circle={true}
className=""
color=""
containerLarge={false}
disabled={false}
expand={false}
href=""
index={null}
isButtonGroup={false}
label=""
large={false}
loading={false}
onClick={null}
removeStyle={false}
size={44}
style={Object {}}
tag="button"
type="button"
>
<Icon
append={false}
Expand All @@ -456,18 +366,15 @@ ShallowWrapper {
title=""
type=""
/>
</Button>,
</ForwardRef(ContextTransform(Button))>,
"className": "md-alert__button",
},
"ref": null,
"rendered": Object {
"instance": null,
"key": undefined,
"nodeType": "class",
"nodeType": "function",
"props": Object {
"active": false,
"ariaLabel": "",
"ariaLabelledBy": "",
"children": <Icon
append={false}
ariaLabel={null}
Expand All @@ -486,23 +393,7 @@ ShallowWrapper {
type=""
/>,
"circle": true,
"className": "",
"color": "",
"containerLarge": false,
"disabled": false,
"expand": false,
"href": "",
"index": null,
"isButtonGroup": false,
"label": "",
"large": false,
"loading": false,
"onClick": null,
"removeStyle": false,
"size": 44,
"style": Object {},
"tag": "button",
"type": "button",
},
"ref": null,
"rendered": Object {
Expand Down Expand Up @@ -530,7 +421,12 @@ ShallowWrapper {
"rendered": null,
"type": [Function],
},
"type": [Function],
"type": Object {
"$$typeof": Symbol(react.forward_ref),
"defaultProps": undefined,
"propTypes": undefined,
"render": [Function],
},
},
"type": "div",
},
Expand Down
Loading

0 comments on commit 47bbc4b

Please sign in to comment.