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
import * as React from "react"; | |
import {shallow, mount} from "enzyme"; | |
import configureStore from "redux-mock-store"; | |
import withPersonalization from "./withPersonalization2"; | |
import {IWithPersonalizationProps} from "./withPersonalization2"; | |
import {Provider} from "react-redux"; | |
// test helpers | |
const middlewares = []; | |
const mockStore = configureStore(middlewares); |
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
import * as React from "react"; | |
import * as ReactRedux from "react-redux"; | |
export interface IWithPersonalizationProps { | |
name: string; | |
} | |
type HOC<PWrapped, PHoc> = React.ComponentClass<PWrapped & PHoc> | React.SFC<PWrapped & PHoc>; | |
export function withPersonalization<P, S>(Component: HOC<P, IWithPersonalizationProps>): React.ComponentClass<P> { |
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
import * as React from "react"; | |
import {IWithPersonalizationProps, withPersonalization} from "./withPersonalization"; | |
interface IWelcomeOwnProps { | |
onClick: () => void; | |
} | |
export class Welcome extends React.Component<IWelcomeOwnProps & IWithPersonalizationProps, {}> { | |
constructor(props: IWelcomeOwnProps & IWithPersonalizationProps) { |
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
import * as React from "react"; | |
export interface IWithPersonalizationProps { | |
name: string; | |
} | |
type HOCWrapped<P, PHoc> = React.ComponentClass<P & PHoc> | React.SFC<P & PHoc>; | |
export function withPersonalization<P, S>(Component: HOCWrapped<P, IWithPersonalizationProps>): React.ComponentClass<P> { |
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
import * as React from "react"; | |
import {Welcome} from "./welcome"; | |
import {shallow} from "enzyme"; | |
const name = "Tester; | |
describe("<Welcome />", () => { | |
it("renders a greeting from the name", () => { | |
const wrapper = shallow(<Welcome name={name} onClick={() => null} />); |
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
import * as React from "react"; | |
interface IWelcomeProps { | |
name: string; | |
onClick: () => void; | |
} | |
export class Welcome extends React.Component<IWelcomeProps, {}> { | |
constructor(props: IWelcomeProps) { |
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
import * as React from "react"; | |
import { | |
AnotherSimpleStatelessComponent, | |
SimpleStatelessComponent, | |
TerseStatelessComponent, | |
VerboseStatelessComponent, | |
ReallyVerboseStatelessComponent} from "./stateless"; | |
import {shallow} from "enzyme"; | |
describe("Stateless Examples", () => { |
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
import * as React from "react"; | |
import * as PropTypes from "prop-types"; | |
interface IExampleComponentProps { | |
text?: string; | |
onCounterIncrease: (count: number) => void; | |
} | |
interface IExampleComponentState { | |
clicks: number; |
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
Show hidden characters
{ | |
"extends": ["tslint-react"], | |
"rules": { | |
"align": [ | |
true, | |
"parameters", | |
"arguments", | |
"statements" | |
], | |
"ban": false, |