mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Update tests for dependencies of React to work with v0.14
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
///<reference path="./fixed-data-table.d.ts"" />
|
||||
/// <reference path="../react/react.d.ts"/>
|
||||
/// <reference path="../react/react-dom.d.ts"/>
|
||||
|
||||
import * as React from "react";
|
||||
import * as ReactDOM from "react-dom";
|
||||
import * as FixedDataTable from "fixed-data-table";
|
||||
|
||||
var rows = [
|
||||
@@ -34,4 +36,4 @@ function rowGetter(rowIndex: number) {
|
||||
/>
|
||||
</FixedDataTable.Table>
|
||||
|
||||
React.render(table, document.body);
|
||||
ReactDOM.render(table, document.body);
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
///<reference path='../../react/react.d.ts' />
|
||||
///<reference path='../../react/react-addons-linked-state-mixin.d.ts' />
|
||||
///<reference path='material-ui-0.11.1.d.ts' />
|
||||
|
||||
import * as React from "react/addons";
|
||||
import * as React from "react";
|
||||
import * as LinkedStateMixin from "react-addons-linked-state-mixin";
|
||||
import mui = require("material-ui");
|
||||
import Colors = require("material-ui/lib/styles/colors");
|
||||
import AppBar = require("material-ui/lib/app-bar");
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
///<reference path='../react/react.d.ts' />
|
||||
///<reference path='../react/react-addons-linked-state-mixin.d.ts' />
|
||||
///<reference path='material-ui.d.ts' />
|
||||
|
||||
import * as React from "react/addons";
|
||||
import * as React from "react";
|
||||
import * as LinkedStateMixin from "react-addons-linked-state-mixin";
|
||||
import Checkbox = require("material-ui/lib/checkbox");
|
||||
import Colors = require("material-ui/lib/styles/colors");
|
||||
import AppBar = require("material-ui/lib/app-bar");
|
||||
|
||||
@@ -17,7 +17,7 @@ import {reactiveComponent} from 'mobservable-react';
|
||||
}));
|
||||
|
||||
let c1Factory = React.createFactory(c1);
|
||||
React.render(c1Factory({
|
||||
ReactDOM.render(c1Factory({
|
||||
test: "hello"
|
||||
}), null);
|
||||
}
|
||||
@@ -31,7 +31,7 @@ class TestComponent extends React.Component<{ test: string },{}> {
|
||||
|
||||
{
|
||||
let c2Factory = React.createFactory(TestComponent);
|
||||
React.render(c2Factory({
|
||||
ReactDOM.render(c2Factory({
|
||||
test: "hello"
|
||||
}) , null);
|
||||
}
|
||||
@@ -39,7 +39,7 @@ class TestComponent extends React.Component<{ test: string },{}> {
|
||||
{
|
||||
var c3 = reactiveComponent((props: { test: string }) => React.createElement("div"));
|
||||
var c3Factory = React.createFactory(c3); //without JSX
|
||||
React.render(c3Factory({
|
||||
ReactDOM.render(c3Factory({
|
||||
test: "hello"
|
||||
}), null);
|
||||
}
|
||||
@@ -55,7 +55,7 @@ class TestComponent2 extends React.Component<{ test: string },{}> {
|
||||
// Argument of type 'typeof TestComponent2 | void' is not assignable to parameter of type 'ComponentClass<{ test: string; }>'.
|
||||
// Type 'void' is not assignable to type 'ComponentClass<{ test: string; }>'.
|
||||
let c4Factory = React.createFactory(<React.ClassicComponentClass<{test:string}>><any> reactiveComponent(TestComponent2));
|
||||
React.render(c4Factory({
|
||||
ReactDOM.render(c4Factory({
|
||||
test: "hello"
|
||||
}) , null);
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
/// <reference path="./react-input-calendar.d.ts"/>
|
||||
/// <reference path="../react/react.d.ts"/>
|
||||
/// <reference path="../react/react-dom.d.ts"/>
|
||||
|
||||
import * as ReactInputCalendar from 'react-input-calendar';
|
||||
import * as React from 'react';
|
||||
React.render(<ReactInputCalendar />, document.body);
|
||||
import * as ReactDOM from 'react-dom';
|
||||
ReactDOM.render(<ReactInputCalendar />, document.body);
|
||||
|
||||
Vendored
+2
-12
@@ -2274,8 +2274,8 @@ declare namespace ReactNative {
|
||||
|
||||
export interface DOMElement<P> extends React.DOMElement<P> {}
|
||||
|
||||
export type HTMLElement =React.HTMLElement;
|
||||
export type SVGElement = React.SVGElement;
|
||||
export type HTMLElement =React.ReactHTMLElement;
|
||||
export type SVGElement = React.ReactSVGElement;
|
||||
|
||||
//
|
||||
// Factories
|
||||
@@ -2289,7 +2289,6 @@ declare namespace ReactNative {
|
||||
|
||||
export type HTMLFactory = React.HTMLFactory;
|
||||
export type SVGFactory = React.SVGFactory;
|
||||
export type SVGElementFactory = React.SVGElementFactory;
|
||||
|
||||
//
|
||||
// React Nodes
|
||||
@@ -2352,9 +2351,6 @@ declare namespace ReactNative {
|
||||
tagName: string;
|
||||
}
|
||||
|
||||
export type HTMLComponent = React.HTMLComponent;
|
||||
export type SVGComponent = React.SVGComponent
|
||||
|
||||
export interface ChildContextProvider<CC> extends React.ChildContextProvider<CC> {}
|
||||
|
||||
//
|
||||
@@ -2422,20 +2418,14 @@ declare namespace ReactNative {
|
||||
|
||||
export interface Props<T> extends React.Props<T> {}
|
||||
|
||||
export interface DOMAttributesBase<T> extends React.DOMAttributesBase<T> {}
|
||||
|
||||
export interface DOMAttributes extends React.DOMAttributes {}
|
||||
|
||||
// This interface is not complete. Only properties accepting
|
||||
// unitless numbers are listed here (see CSSProperty.js in React)
|
||||
export interface CSSProperties extends React.CSSProperties {}
|
||||
|
||||
export interface HTMLAttributesBase<T> extends React.HTMLAttributesBase<T> {}
|
||||
|
||||
export interface HTMLAttributes extends React.HTMLAttributes {}
|
||||
|
||||
export interface SVGElementAttributes extends React.SVGElementAttributes {}
|
||||
|
||||
export interface SVGAttributes extends React.SVGAttributes {}
|
||||
|
||||
//
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
/// <reference path="react-redux.d.ts" />
|
||||
/// <reference path="../react/react.d.ts"/>
|
||||
/// <reference path="../react/react-dom.d.ts"/>
|
||||
/// <reference path="../redux/redux.d.ts" />
|
||||
/// <reference path="../react-router/react-router.d.ts" />
|
||||
/// <reference path="../object-assign/object-assign.d.ts" />
|
||||
|
||||
import { Component, ReactElement } from 'react';
|
||||
import * as React from 'react';
|
||||
import * as ReactDOM from 'react-dom';
|
||||
import * as Router from 'react-router';
|
||||
import { Route, RouterState } from 'react-router';
|
||||
import { Store, Dispatch, bindActionCreators } from 'redux';
|
||||
@@ -65,7 +67,7 @@ class App extends Component<any, any> {
|
||||
|
||||
const targetEl = document.getElementById('root');
|
||||
|
||||
React.render((
|
||||
ReactDOM.render((
|
||||
<Provider store={store}>
|
||||
{() => <App />}
|
||||
</Provider>
|
||||
@@ -100,7 +102,7 @@ declare var addTodo: () => { type: string; };
|
||||
declare var todoActionCreators: { [type: string]: (...args: any[]) => any; };
|
||||
declare var counterActionCreators: { [type: string]: (...args: any[]) => any; };
|
||||
|
||||
React.render(
|
||||
ReactDOM.render(
|
||||
<Provider store={store}>
|
||||
{() => <MyRootComponent />}
|
||||
</Provider>,
|
||||
@@ -108,7 +110,7 @@ React.render(
|
||||
);
|
||||
|
||||
Router.run(routes, Router.HistoryLocation, (Handler, routerState) => { // note "routerState" here
|
||||
React.render(
|
||||
ReactDOM.render(
|
||||
<Provider store={store}>
|
||||
{/*
|
||||
//TODO: error TS2339: Property 'routerState' does not exist on type 'RouteProp'.
|
||||
@@ -121,7 +123,7 @@ Router.run(routes, Router.HistoryLocation, (Handler, routerState) => { // note "
|
||||
|
||||
//TODO: for React Router 1.0
|
||||
//TODO: error TS2604: JSX element type 'Router' does not have any construct or call signatures.
|
||||
//React.render(
|
||||
//ReactDOM.render(
|
||||
// <Provider store={store}>
|
||||
// {() => <Router history={history}>...</Router>}
|
||||
// </Provider>,
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
///<reference path="react-router.d.ts" />
|
||||
///<reference path='../react/react-dom.d.ts' />
|
||||
"use strict";
|
||||
|
||||
import React = require('react');
|
||||
import ReactAddons = require('react/addons');
|
||||
import ReactDOM = require('react-dom');
|
||||
import Router = require('react-router');
|
||||
|
||||
// Mixin
|
||||
@@ -129,9 +130,6 @@ class DefaultRouteTest {
|
||||
var Handler: React.ComponentClass<any>;
|
||||
React.createElement(Router.DefaultRoute, null);
|
||||
React.createElement(Router.DefaultRoute, {name: 'name', handler: Handler});
|
||||
|
||||
ReactAddons.createElement(Router.DefaultRoute, null);
|
||||
ReactAddons.createElement(Router.DefaultRoute, {name: 'name', handler: Handler});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,16 +167,6 @@ class LinkTest {
|
||||
query: {},
|
||||
onClick: () => console.log(1)
|
||||
});
|
||||
|
||||
ReactAddons.createElement(Router.Link, null);
|
||||
ReactAddons.createElement(Router.Link, {to: 'home'});
|
||||
ReactAddons.createElement(Router.Link, {
|
||||
activeClassName: 'name',
|
||||
to: 'home',
|
||||
params: {},
|
||||
query: {},
|
||||
onClick: () => console.log(1)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,10 +183,6 @@ class NotFoundRouteTest {
|
||||
React.createElement(Router.NotFoundRoute, null);
|
||||
React.createElement(Router.NotFoundRoute, {handler: Handler});
|
||||
React.createElement(Router.NotFoundRoute, {handler: Handler, name: "home"});
|
||||
|
||||
ReactAddons.createElement(Router.NotFoundRoute, null);
|
||||
ReactAddons.createElement(Router.NotFoundRoute, {handler: Handler});
|
||||
ReactAddons.createElement(Router.NotFoundRoute, {handler: Handler, name: "home"});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,10 +199,6 @@ class RedirectTest {
|
||||
React.createElement(Router.Redirect, null);
|
||||
React.createElement(Router.Redirect, {});
|
||||
React.createElement(Router.Redirect, {path: 'a', from: 'a', to: 'b'});
|
||||
|
||||
ReactAddons.createElement(Router.Redirect, null);
|
||||
ReactAddons.createElement(Router.Redirect, {});
|
||||
ReactAddons.createElement(Router.Redirect, {path: 'a', from: 'a', to: 'b'});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -237,10 +217,6 @@ class RouteTest {
|
||||
React.createElement(Router.Route, null);
|
||||
React.createElement(Router.Route, {});
|
||||
React.createElement(Router.Route, {name: "home", path: "/", handler: Handler, ignoreScrollBehavior: true});
|
||||
|
||||
ReactAddons.createElement(Router.Route, null);
|
||||
ReactAddons.createElement(Router.Route, {});
|
||||
ReactAddons.createElement(Router.Route, {name: "home", path: "/", handler: Handler, ignoreScrollBehavior: true});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,9 +226,6 @@ class RouteHandlerTest {
|
||||
createElement() {
|
||||
React.createElement(Router.RouteHandler, null);
|
||||
React.createElement(Router.RouteHandler, {});
|
||||
|
||||
ReactAddons.createElement(Router.RouteHandler, null);
|
||||
ReactAddons.createElement(Router.RouteHandler, {});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -307,24 +280,24 @@ class RunTest {
|
||||
constructor() {
|
||||
// React.createElement() version
|
||||
var v1: Router.Router = Router.run(React.createElement(Router.Route, null), (Handler) => {
|
||||
React.render(React.createElement(Handler, null), document.body);
|
||||
ReactDOM.render(React.createElement(Handler, null), document.body);
|
||||
});
|
||||
var v2: Router.Router = Router.run(React.createElement(Router.Route, null), Router.HistoryLocation, (Handler, state) => {
|
||||
React.render(React.createElement(Handler, null), document.body);
|
||||
ReactDOM.render(React.createElement(Handler, null), document.body);
|
||||
});
|
||||
var v3: Router.Router = Router.run(React.createElement(Router.Route, null), '/foo/bar', (Handler, state) => {
|
||||
React.render(React.createElement(Handler, null), document.body);
|
||||
ReactDOM.render(React.createElement(Handler, null), document.body);
|
||||
});
|
||||
|
||||
// React.createFactory() version
|
||||
var v4: Router.Router = Router.run(React.createFactory(Router.Route)(), (Handler) => {
|
||||
React.render(React.createElement(Handler, null), document.body);
|
||||
ReactDOM.render(React.createElement(Handler, null), document.body);
|
||||
});
|
||||
var v5: Router.Router = Router.run(React.createFactory(Router.Route)(), Router.HistoryLocation, (Handler, state) => {
|
||||
React.render(React.createElement(Handler, null), document.body);
|
||||
ReactDOM.render(React.createElement(Handler, null), document.body);
|
||||
});
|
||||
var v6: Router.Router = Router.run(React.createFactory(Router.Route)(), '/foo/bar', (Handler, state) => {
|
||||
React.render(React.createElement(Handler, null), document.body);
|
||||
ReactDOM.render(React.createElement(Handler, null), document.body);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user