-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(Jest integration test): Improve quality of jest integration test (…
…#1260) Improve quality of jest integration test. Before now, we only had 1 test without assertions running as integration. It is better than nothing, but far from ideal. I now grabbed some tests from reactstrap. I think this will help build confidence when improving the jest runner.
- Loading branch information
Showing
25 changed files
with
1,236 additions
and
111 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"presets": [ | ||
["es2015", {"modules": false}], | ||
"react" | ||
], | ||
"plugins": [ | ||
"transform-object-rest-spread" | ||
], | ||
"env": { | ||
"lib-dir": { | ||
"plugins": ["transform-es2015-modules-commonjs"] | ||
}, | ||
"webpack": { | ||
"plugins": ["transform-es2015-modules-commonjs"] | ||
}, | ||
"test": { | ||
"plugins": ["transform-es2015-modules-commonjs"] | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,21 +1,9 @@ | ||
# See https://help.github.com/ignore-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
|
||
# testing | ||
/coverage | ||
|
||
# production | ||
node_modules | ||
/dist | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
/lib | ||
.idea | ||
.history | ||
npm-debug.log | ||
package-lock.json |
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,3 @@ | ||
# Reactstrap sample | ||
|
||
Grabbed from: https://reactstrap.github.io |
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,17 @@ | ||
import React from 'react'; | ||
|
||
export function Manager({ tag: Tag = 'div', ...props }) { | ||
return <Tag {...props} />; | ||
} | ||
|
||
export function Popper({ component: Tag = 'div', ...props }) { | ||
return <Tag {...props} />; | ||
} | ||
|
||
export function Arrow({ component: Tag = 'div', ...props }) { | ||
return <Tag {...props} />; | ||
} | ||
|
||
export function Target({ component: Tag = 'div', ...props }) { | ||
return <Tag {...props} />; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import classNames from 'classnames'; | ||
import { mapToCssModules } from './utils'; | ||
import Fade from './Fade'; | ||
|
||
const propTypes = { | ||
children: PropTypes.node, | ||
className: PropTypes.string, | ||
closeClassName: PropTypes.string, | ||
closeAriaLabel: PropTypes.string, | ||
cssModule: PropTypes.object, | ||
color: PropTypes.string, | ||
fade: PropTypes.bool, | ||
isOpen: PropTypes.bool, | ||
toggle: PropTypes.func, | ||
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]), | ||
transition: PropTypes.shape(Fade.propTypes), | ||
innerRef: PropTypes.oneOfType([ | ||
PropTypes.object, | ||
PropTypes.string, | ||
PropTypes.func, | ||
]), | ||
}; | ||
|
||
const defaultProps = { | ||
color: 'success', | ||
isOpen: true, | ||
tag: 'div', | ||
closeAriaLabel: 'Close', | ||
fade: true, | ||
transition: { | ||
...Fade.defaultProps, | ||
unmountOnExit: true, | ||
}, | ||
}; | ||
|
||
function Alert(props) { | ||
const { | ||
className, | ||
closeClassName, | ||
closeAriaLabel, | ||
cssModule, | ||
tag: Tag, | ||
color, | ||
isOpen, | ||
toggle, | ||
children, | ||
transition, | ||
fade, | ||
innerRef, | ||
...attributes | ||
} = props; | ||
|
||
const classes = mapToCssModules(classNames( | ||
className, | ||
'alert', | ||
`alert-${color}`, | ||
{ 'alert-dismissible': toggle } | ||
), cssModule); | ||
|
||
const closeClasses = mapToCssModules(classNames('close', closeClassName), cssModule); | ||
|
||
const alertTransition = { | ||
...Fade.defaultProps, | ||
...transition, | ||
baseClass: fade ? transition.baseClass : '', | ||
timeout: fade ? transition.timeout : 0, | ||
}; | ||
|
||
return ( | ||
<Fade {...attributes} {...alertTransition} tag={Tag} className={classes} in={isOpen} role="alert" innerRef={innerRef}> | ||
{toggle ? | ||
<button type="button" className={closeClasses} aria-label={closeAriaLabel} onClick={toggle}> | ||
<span aria-hidden="true">×</span> | ||
</button> | ||
: null} | ||
{children} | ||
</Fade> | ||
); | ||
} | ||
|
||
Alert.propTypes = propTypes; | ||
Alert.defaultProps = defaultProps; | ||
|
||
export default Alert; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import classNames from 'classnames'; | ||
import { mapToCssModules } from './utils'; | ||
|
||
const propTypes = { | ||
color: PropTypes.string, | ||
pill: PropTypes.bool, | ||
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]), | ||
innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func, PropTypes.string]), | ||
children: PropTypes.node, | ||
className: PropTypes.string, | ||
cssModule: PropTypes.object, | ||
}; | ||
|
||
const defaultProps = { | ||
color: 'secondary', | ||
pill: false, | ||
tag: 'span' | ||
}; | ||
|
||
const Badge = (props) => { | ||
let { | ||
className, | ||
cssModule, | ||
color, | ||
innerRef, | ||
pill, | ||
tag: Tag, | ||
...attributes | ||
} = props; | ||
|
||
const classes = mapToCssModules(classNames( | ||
className, | ||
'badge', | ||
'badge-' + color, | ||
pill ? 'badge-pill' : false | ||
), cssModule); | ||
|
||
if (attributes.href && Tag === 'span') { | ||
Tag = 'a'; | ||
} | ||
|
||
return ( | ||
<Tag {...attributes} className={classes} ref={innerRef} /> | ||
); | ||
}; | ||
|
||
Badge.propTypes = propTypes; | ||
Badge.defaultProps = defaultProps; | ||
|
||
export default Badge; |
Oops, something went wrong.