Skip to content

Commit

Permalink
chore(worflow): add test workflow (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
JAdshead authored Aug 23, 2023
1 parent 0ab9c76 commit ba94b90
Show file tree
Hide file tree
Showing 10 changed files with 4,215 additions and 1,663 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CI

on:
push:
branches:
- main
pull_request:

jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
node: ['12.x']
name: Node ${{ matrix.node }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
persist-credentials: false
ref: ${{ github.event.pull_request.head.sha }}
- run: |
git remote set-branches --add origin main
git fetch
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- name: Install Dependencies
run: yarn
env:
NODE_ENV: development
- name: Run Tests
run: yarn run test
2 changes: 1 addition & 1 deletion examples/add-progress-bar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const AddProgressBar = () => (
render={({ step, steps }) => (
<div>
<Line
percent={(steps.indexOf(step) + 1) / steps.length * 100}
percent={((steps.indexOf(step) + 1) / steps.length) * 100}
className="pad-b"
/>
<TransitionGroup>
Expand Down
2 changes: 1 addition & 1 deletion examples/skip-a-step/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const SkipAStep = () => (
render={({ step, steps }) => (
<div>
<Line
percent={(steps.indexOf(step) + 1) / steps.length * 100}
percent={((steps.indexOf(step) + 1) / steps.length) * 100}
className="pad-b"
/>
<TransitionGroup>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@
"jest": "^21.2.1",
"node-sass": "^4.5.0",
"prettier": "^1.6.1",
"rc-progress": "^2.2.5",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"react-router-dom": "^4.0.0",
"react-test-renderer": "^16.0.0",
"react-transition-group": "^2.2.1",
"rc-progress": "^2.2.5",
"rimraf": "^2.5.2",
"sass-loader": "^6.0.2",
"style-loader": "^0.13.2",
Expand Down
2 changes: 2 additions & 0 deletions src/components/Steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ Steps.defaultProps = {
};

Steps.contextTypes = {
// disabling due to lost context
// eslint-disable-next-line react/forbid-prop-types
wizard: PropTypes.object,
};

Expand Down
12 changes: 10 additions & 2 deletions src/components/Wizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import PropTypes from 'prop-types';
import { createMemoryHistory } from 'history';
import renderCallback from '../utils/renderCallback';

// TODO: fix below
/* eslint-disable no-undef */
class Wizard extends Component {
state = {
step: {
Expand Down Expand Up @@ -77,8 +79,8 @@ class Wizard extends Component {

pathToStep = pathname => {
const id = pathname.replace(this.basename, '');
const [step] = this.state.steps.filter(
s => (this.props.exactMatch ? s.id === id : id.startsWith(s.id))
const [step] = this.state.steps.filter(s =>
this.props.exactMatch ? s.id === id : id.startsWith(s.id)
);

return step || this.state.step;
Expand Down Expand Up @@ -121,10 +123,14 @@ class Wizard extends Component {
Wizard.propTypes = {
basename: PropTypes.string,
history: PropTypes.shape({
// disabling due to lost context
// eslint-disable-next-line react/forbid-prop-types
entries: PropTypes.array,
go: PropTypes.func,
goBack: PropTypes.func,
listen: PropTypes.func,
// disabling due to lost context
// eslint-disable-next-line react/forbid-prop-types
location: PropTypes.object,
push: PropTypes.func,
replace: PropTypes.func,
Expand All @@ -142,6 +148,8 @@ Wizard.defaultProps = {
};

Wizard.childContextTypes = {
// disabling due to lost context
// eslint-disable-next-line react/forbid-prop-types
wizard: PropTypes.object,
};

Expand Down
2 changes: 2 additions & 0 deletions src/components/createWizardComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ const createWizardComponent = name => {
const WizardComponent = (props, { wizard: { init, ...wizard } }) => renderCallback(props, wizard);

WizardComponent.contextTypes = {
// disabling due to lost context
// eslint-disable-next-line react/forbid-prop-types
wizard: PropTypes.object,
};

Expand Down
2 changes: 2 additions & 0 deletions src/withWizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ const withWizard = Component => {
});

WithWizard.contextTypes = {
// disabling due to lost context
// eslint-disable-next-line react/forbid-prop-types
wizard: PropTypes.object,
};

Expand Down
2 changes: 2 additions & 0 deletions src/wizardShape.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import PropTypes from 'prop-types';
export default PropTypes.shape({
go: PropTypes.func.isRequired,
set: PropTypes.func.isRequired,
// disabling due to lost context
// eslint-disable-next-line react/forbid-prop-types
history: PropTypes.object.isRequired,
next: PropTypes.func.isRequired,
previous: PropTypes.func.isRequired,
Expand Down
Loading

0 comments on commit ba94b90

Please sign in to comment.