From f5790919f261a4e812e3754d78946d666346afb9 Mon Sep 17 00:00:00 2001 From: Carlo Cancellieri Date: Thu, 7 Jul 2016 10:36:54 +0200 Subject: [PATCH] fix spacing (4 spaces). Implement the test. Add reference to react.d.ts --- react-redux/react-redux-2.1.2-tests.tsx | 1 - react-user-tour/react-user-tour-tests.ts | 6 -- react-user-tour/react-user-tour-tests.tsx | 57 +++++++++++++++++++ .../react-user-tour-tests.tsx.tscparams | 1 + react-user-tour/react-user-tour.d.ts | 42 +++++++------- 5 files changed, 80 insertions(+), 27 deletions(-) delete mode 100644 react-user-tour/react-user-tour-tests.ts create mode 100644 react-user-tour/react-user-tour-tests.tsx create mode 100644 react-user-tour/react-user-tour-tests.tsx.tscparams diff --git a/react-redux/react-redux-2.1.2-tests.tsx b/react-redux/react-redux-2.1.2-tests.tsx index ab32609c01..7ead497767 100644 --- a/react-redux/react-redux-2.1.2-tests.tsx +++ b/react-redux/react-redux-2.1.2-tests.tsx @@ -277,4 +277,3 @@ class SomeClass extends Component { public bar: number; } let bar: number = new (connect()(SomeClass))("foo").bar; - diff --git a/react-user-tour/react-user-tour-tests.ts b/react-user-tour/react-user-tour-tests.ts deleted file mode 100644 index 229ae0f049..0000000000 --- a/react-user-tour/react-user-tour-tests.ts +++ /dev/null @@ -1,6 +0,0 @@ -// Tests for type definitions for react-user-tour -// Project: https://github.com/socialtables/react-user-tour -// Definitions by: Carlo Cancellieri -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// diff --git a/react-user-tour/react-user-tour-tests.tsx b/react-user-tour/react-user-tour-tests.tsx new file mode 100644 index 0000000000..5dc8df9f68 --- /dev/null +++ b/react-user-tour/react-user-tour-tests.tsx @@ -0,0 +1,57 @@ +// Tests for type definitions for react-user-tour +// Project: https://github.com/socialtables/react-user-tour +// Definitions by: Carlo Cancellieri +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// +/// + +import React = require("react"); +import ReactDOM = require("react-dom"); + +import ReactUserTour from "react-user-tour"; + +interface State { + tourStep:number + isTourActive:boolean +} + +class TestApp extends React.Component<{}, State> { + + constructor(p:any){ + super(p) + + this.setState({ + isTourActive:true, + tourStep:1 + }) + } + + render() { + + const Tour = this.setState({tourStep: step, isTourActive: true})} + onBack={(step:number) => this.setState({tourStep: step, isTourActive: true})} + onCancel={() => this.setState({tourStep: this.state.tourStep, isTourActive: false})} + steps={[ + { + step: 1, + selector: ".MyClass", + title:
React User Tour
, + body:
Provide a simple guided tour around a website utilizing css selectors.
, + position: "bottom" + } + ]} + /> + + + + return
+ {Tour} +
+ } +} + +ReactDOM.render(React.createElement(TestApp, {}), document.getElementById("test-app")); diff --git a/react-user-tour/react-user-tour-tests.tsx.tscparams b/react-user-tour/react-user-tour-tests.tsx.tscparams new file mode 100644 index 0000000000..b238f4f2a8 --- /dev/null +++ b/react-user-tour/react-user-tour-tests.tsx.tscparams @@ -0,0 +1 @@ +--noImplicitAny --jsx react diff --git a/react-user-tour/react-user-tour.d.ts b/react-user-tour/react-user-tour.d.ts index bfdeac4bde..aef4a4000e 100644 --- a/react-user-tour/react-user-tour.d.ts +++ b/react-user-tour/react-user-tour.d.ts @@ -3,28 +3,30 @@ // Definitions by: Carlo Cancellieri // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/// + declare module "react-user-tour" { - // Import React - import { HTMLAttributes, ComponentClass } from 'react'; - - interface TourStep { - step: number - selector: string - title: string - body: string - position?: string - } + // Import React + import { HTMLAttributes, ComponentClass } from 'react'; - interface TourProps extends HTMLAttributes { - steps:TourStep[] - active:boolean - step:number - onNext:any - onBack:any - onCancel:any - } + interface TourStep { + step: number + selector: string + title: string + body: string + position?: string + } - var ReactUserTour: ComponentClass; - export default ReactUserTour + interface TourProps extends HTMLAttributes { + steps:TourStep[] + active:boolean + step:number + onNext:any + onBack:any + onCancel:any + } + + var ReactUserTour: ComponentClass; + export default ReactUserTour }