-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
566a0f4
commit 5b19a30
Showing
15 changed files
with
848 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
106 changes: 106 additions & 0 deletions
106
src/components/mbx-button/__tests__/__snapshots__/mbx-button.test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`AppPrimary renders as expected 1`] = ` | ||
<button | ||
className="btn btn--gray round h24 px6 py3 txt-xs" | ||
onClick={[MockFunction]} | ||
type="button" | ||
> | ||
AppPrimary | ||
</button> | ||
`; | ||
|
||
exports[`AppSecondary renders as expected 1`] = ` | ||
<button | ||
className="btn btn--gray btn--stroke round h24 px6 py3 txt-xs" | ||
onClick={[MockFunction]} | ||
type="button" | ||
> | ||
AppSecondary | ||
</button> | ||
`; | ||
|
||
exports[`Destructive renders as expected 1`] = ` | ||
<button | ||
className="btn btn--red round-full py12 px24 txt-s" | ||
onClick={[MockFunction]} | ||
type="button" | ||
> | ||
Destructive | ||
</button> | ||
`; | ||
|
||
exports[`Disabled renders as expected 1`] = ` | ||
<button | ||
className="btn btn--blue round-full py12 px24 txt-s" | ||
disabled={true} | ||
type="button" | ||
> | ||
Oops | ||
</button> | ||
`; | ||
|
||
exports[`Discouraging renders as expected 1`] = ` | ||
<button | ||
className="btn btn--gray btn--stroke btn--stroke--2 round-full py12 px24 txt-s" | ||
onClick={[MockFunction]} | ||
type="button" | ||
> | ||
Discouraging | ||
</button> | ||
`; | ||
|
||
exports[`Div styled like a medium destructive button with some extended props and transformed classes renders as expected 1`] = ` | ||
<div | ||
className="btn btn--red round-full py6 px24 txt-s shadow-darken75 unselectable cursor-pointer" | ||
data-test="foo" | ||
onClick={[MockFunction]} | ||
role="button" | ||
> | ||
Save | ||
</div> | ||
`; | ||
|
||
exports[`Full width, alternate color renders as expected 1`] = ` | ||
<button | ||
className="btn btn--purple round-full py12 w-full block txt-s" | ||
type="button" | ||
> | ||
Here we are | ||
</button> | ||
`; | ||
|
||
exports[`Link with outline and icon text, extra padding renders as expected 1`] = ` | ||
<a | ||
className="btn btn--blue btn--stroke btn--stroke--2 round-full py12 px36 txt-s" | ||
href="#" | ||
onClick={[MockFunction]} | ||
> | ||
<MbxIconText | ||
iconBefore="bug" | ||
spacing="small" | ||
> | ||
Go do things | ||
</MbxIconText> | ||
</a> | ||
`; | ||
|
||
exports[`Primary renders as expected 1`] = ` | ||
<button | ||
className="btn btn--blue round-full py12 px24 txt-s" | ||
onClick={[MockFunction]} | ||
type="button" | ||
> | ||
Primary | ||
</button> | ||
`; | ||
|
||
exports[`Secondary renders as expected 1`] = ` | ||
<button | ||
className="btn btn--blue btn--stroke btn--stroke--2 round-full py12 px24 txt-s" | ||
onClick={[MockFunction]} | ||
type="button" | ||
> | ||
Secondary | ||
</button> | ||
`; |
139 changes: 139 additions & 0 deletions
139
src/components/mbx-button/__tests__/mbx-button-test-cases.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
import React from 'react'; | ||
import safeSpy from '../../../test-utils/safe-spy'; | ||
import MbxButton from '../mbx-button'; | ||
import MbxIconText from '../../mbx-icon-text'; | ||
|
||
const testCases = {}; | ||
|
||
testCases.primary = { | ||
description: 'Primary', | ||
component: MbxButton, | ||
props: { | ||
children: 'Primary', | ||
onClick: safeSpy() | ||
} | ||
}; | ||
|
||
testCases.secondary = { | ||
description: 'Secondary', | ||
component: MbxButton, | ||
props: { | ||
children: 'Secondary', | ||
variant: 'secondary', | ||
onClick: safeSpy() | ||
} | ||
}; | ||
|
||
testCases.discouraging = { | ||
description: 'Discouraging', | ||
component: MbxButton, | ||
props: { | ||
children: 'Discouraging', | ||
variant: 'discouraging', | ||
onClick: safeSpy() | ||
} | ||
}; | ||
|
||
testCases.destructive = { | ||
description: 'Destructive', | ||
component: MbxButton, | ||
props: { | ||
children: 'Destructive', | ||
variant: 'destructive', | ||
onClick: safeSpy() | ||
} | ||
}; | ||
|
||
testCases.appPrimary = { | ||
description: 'AppPrimary', | ||
component: MbxButton, | ||
props: { | ||
children: 'AppPrimary', | ||
variant: 'appPrimary', | ||
onClick: safeSpy() | ||
} | ||
}; | ||
|
||
testCases.appSecondary = { | ||
description: 'AppSecondary', | ||
component: MbxButton, | ||
props: { | ||
children: 'AppSecondary', | ||
variant: 'appSecondary', | ||
onClick: safeSpy() | ||
} | ||
}; | ||
|
||
testCases.linkOutlinePadding = { | ||
description: 'Link with outline and icon text, extra padding', | ||
component: MbxButton, | ||
props: { | ||
children: <MbxIconText iconBefore="bug">Go do things</MbxIconText>, | ||
href: '#', | ||
onClick: safeSpy(), | ||
outline: true, | ||
width: 'large' | ||
} | ||
}; | ||
|
||
testCases.fullWidthPurple = { | ||
description: 'Full width, alternate color', | ||
component: MbxButton, | ||
props: { | ||
children: 'Here we are', | ||
color: 'purple', | ||
width: 'full' | ||
} | ||
}; | ||
|
||
testCases.weird = { | ||
description: | ||
'Div styled like a medium destructive button with some extended props and transformed classes', | ||
component: MbxButton, | ||
props: { | ||
children: 'Save', | ||
size: 'medium', | ||
variant: 'destructive', | ||
onClick: safeSpy(), | ||
transformClasses: classes => { | ||
return classes + ' shadow-darken75 unselectable cursor-pointer'; | ||
}, | ||
component: 'div', | ||
role: 'button', | ||
'data-test': 'foo' | ||
} | ||
}; | ||
|
||
testCases.disabled = { | ||
description: 'Disabled', | ||
component: MbxButton, | ||
props: { | ||
children: 'Oops', | ||
disabled: true | ||
} | ||
}; | ||
|
||
testCases.disabledSecondary = { | ||
description: 'Disabled secondary', | ||
component: MbxButton, | ||
props: { | ||
children: 'Oops', | ||
disabled: true, | ||
variant: 'secondary', | ||
onClick: safeSpy() | ||
} | ||
}; | ||
|
||
testCases.disabledSpecial = { | ||
description: 'Disabled appPrimary with color', | ||
component: MbxButton, | ||
props: { | ||
children: 'Oops', | ||
variant: 'appPrimary', | ||
onClick: safeSpy(), | ||
disabled: true, | ||
color: 'gray' | ||
} | ||
}; | ||
|
||
export { testCases }; |
Oops, something went wrong.