overhauling steps 4-6, part 1

This commit is contained in:
Ken
2019-03-02 20:57:25 -08:00
parent 8fc928ea8d
commit b91914e1d8
21 changed files with 296 additions and 221 deletions

View File

@@ -1,11 +0,0 @@
import React from 'react';
import { mount } from 'enzyme';
import { TestMe } from './TestMe';
describe('TestMe Component', () => {
it('should have a non-clickable component when the original InnerMe is clicked', () => {
const wrapper = mount(<TestMe name="world" />);
wrapper.find('#innerMe').simulate('click');
expect(wrapper.find('#innerMe').text()).toBe('Clicked');
});
});

View File

@@ -1,37 +0,0 @@
import React from 'react';
export interface TestMeProps {
name: string;
}
export interface TestMeState {
clicked: boolean;
}
export const TestMe = (props: TestMeProps) => {
return (
<div id="testMe">
<InnerMe name={props.name} />
</div>
);
};
export class InnerMe extends React.Component<TestMeProps, TestMeState> {
state = {
clicked: false
};
onClick = () => {
this.setState({ clicked: true });
};
render() {
return !this.state.clicked ? (
<div onClick={this.onClick} id="innerMe">
Hello {this.props.name}, Click Me
</div>
) : (
<div id="innerMe">Clicked</div>
);
}
}

View File

@@ -1,7 +0,0 @@
import React from 'react';
import { mount } from 'enzyme';
describe('index', () => {
it('placeholder', () => {
});
});

View File

@@ -1,19 +0,0 @@
import { multiply } from './multiply';
let counter = 0;
export function getCount() {
return counter;
}
export function increment() {
return ++counter;
}
export function decrement() {
return --counter;
}
export function square(x: number) {
return multiply(x, x);
}

View File

@@ -1,3 +0,0 @@
export function multiply(x: number, y: number) {
return x * y;
}