Skip to content

Commit

Permalink
Update tests for v0.14 and refactor how addons expose interfaces.
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrantly committed Nov 5, 2015
1 parent bf06164 commit 6190332
Show file tree
Hide file tree
Showing 11 changed files with 345 additions and 607 deletions.
22 changes: 12 additions & 10 deletions react/react-addons-css-transition-group.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,22 @@
/// <reference path="react-addons-transition-group.d.ts" />

declare namespace __React {
interface CSSTransitionGroupProps extends TransitionGroupProps {
transitionName: string;
transitionAppear?: boolean;
transitionEnter?: boolean;
transitionLeave?: boolean;
}

type CSSTransitionGroup = ComponentClass<CSSTransitionGroupProps>;

namespace __Addons {
interface CSSTransitionGroupProps extends TransitionGroupProps {
transitionName: string;
transitionAppear?: boolean;
transitionEnter?: boolean;
transitionLeave?: boolean;
}

type CSSTransitionGroup = ComponentClass<CSSTransitionGroupProps>;
export var CSSTransitionGroup: __React.CSSTransitionGroup;
}
}

declare module "react-addons-css-transition-group" {
var CSSTransitionGroup: __React.__Addons.CSSTransitionGroup;
type CSSTransitionGroup = __React.__Addons.CSSTransitionGroup;
var CSSTransitionGroup: __React.CSSTransitionGroup;
type CSSTransitionGroup = __React.CSSTransitionGroup;
export = CSSTransitionGroup;
}
22 changes: 12 additions & 10 deletions react/react-addons-linked-state-mixin.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,22 @@
/// <reference path="react.d.ts" />

declare namespace __React {
namespace __Addons {
interface ReactLink<T> {
value: T;
requestChange(newValue: T): void;
}
interface ReactLink<T> {
value: T;
requestChange(newValue: T): void;
}

interface LinkedStateMixin extends Mixin<any, any> {
linkState<T>(key: string): ReactLink<T>;
}

interface LinkedStateMixin extends Mixin<any, any> {
linkState<T>(key: string): ReactLink<T>;
}
namespace __Addons {
export var LinkedStateMixin: LinkedStateMixin;
}
}

declare module "react-addons-linked-state-mixin" {
var LinkedStateMixin: __React.__Addons.LinkedStateMixin;
type LinkedStateMixin = __React.__Addons.LinkedStateMixin;
var LinkedStateMixin: __React.LinkedStateMixin;
type LinkedStateMixin = __React.LinkedStateMixin;
export = LinkedStateMixin;
}
42 changes: 21 additions & 21 deletions react/react-addons-perf.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,28 @@
/// <reference path="react.d.ts" />

declare namespace __React {
namespace __Addons {
interface ComponentPerfContext {
current: string;
owner: string;
}

interface NumericPerfContext {
[key: string]: number;
}
interface ComponentPerfContext {
current: string;
owner: string;
}

interface NumericPerfContext {
[key: string]: number;
}

interface Measurements {
exclusive: NumericPerfContext;
inclusive: NumericPerfContext;
render: NumericPerfContext;
counts: NumericPerfContext;
writes: NumericPerfContext;
displayNames: {
[key: string]: ComponentPerfContext;
};
totalTime: number;
}

interface Measurements {
exclusive: NumericPerfContext;
inclusive: NumericPerfContext;
render: NumericPerfContext;
counts: NumericPerfContext;
writes: NumericPerfContext;
displayNames: {
[key: string]: ComponentPerfContext;
};
totalTime: number;
}

namespace __Addons {
namespace Perf {
export function start(): void;
export function stop(): void;
Expand Down
8 changes: 5 additions & 3 deletions react/react-addons-pure-render-mixin.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
/// <reference path="react.d.ts" />

declare namespace __React {
interface PureRenderMixin extends Mixin<any, any> {}

namespace __Addons {
interface PureRenderMixin extends Mixin<any, any> {}
export var PureRenderMixin: PureRenderMixin;
}
}

declare module "react-addons-pure-render-mixin" {
var PureRenderMixin: __React.__Addons.PureRenderMixin;
type PureRenderMixin = __React.__Addons.PureRenderMixin;
var PureRenderMixin: __React.PureRenderMixin;
type PureRenderMixin = __React.PureRenderMixin;
export = PureRenderMixin;
}
98 changes: 49 additions & 49 deletions react/react-addons-test-utils.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,57 +6,57 @@
/// <reference path="react.d.ts" />

declare namespace __React {
namespace __Addons {
interface SyntheticEventData {
altKey?: boolean;
button?: number;
buttons?: number;
clientX?: number;
clientY?: number;
changedTouches?: TouchList;
charCode?: boolean;
clipboardData?: DataTransfer;
ctrlKey?: boolean;
deltaMode?: number;
deltaX?: number;
deltaY?: number;
deltaZ?: number;
detail?: number;
getModifierState?(key: string): boolean;
key?: string;
keyCode?: number;
locale?: string;
location?: number;
metaKey?: boolean;
pageX?: number;
pageY?: number;
relatedTarget?: EventTarget;
repeat?: boolean;
screenX?: number;
screenY?: number;
shiftKey?: boolean;
targetTouches?: TouchList;
touches?: TouchList;
view?: AbstractView;
which?: number;
}
interface SyntheticEventData {
altKey?: boolean;
button?: number;
buttons?: number;
clientX?: number;
clientY?: number;
changedTouches?: TouchList;
charCode?: boolean;
clipboardData?: DataTransfer;
ctrlKey?: boolean;
deltaMode?: number;
deltaX?: number;
deltaY?: number;
deltaZ?: number;
detail?: number;
getModifierState?(key: string): boolean;
key?: string;
keyCode?: number;
locale?: string;
location?: number;
metaKey?: boolean;
pageX?: number;
pageY?: number;
relatedTarget?: EventTarget;
repeat?: boolean;
screenX?: number;
screenY?: number;
shiftKey?: boolean;
targetTouches?: TouchList;
touches?: TouchList;
view?: AbstractView;
which?: number;
}

interface EventSimulator {
(element: Element, eventData?: SyntheticEventData): void;
(component: Component<any, any>, eventData?: SyntheticEventData): void;
}

interface EventSimulator {
(element: Element, eventData?: SyntheticEventData): void;
(component: Component<any, any>, eventData?: SyntheticEventData): void;
}

interface MockedComponentClass {
new(): any;
}

class ShallowRenderer {
getRenderOutput<E extends ReactElement<any>>(): E;
getRenderOutput(): ReactElement<any>;
render(element: ReactElement<any>, context?: any): void;
unmount(): void;
}
interface MockedComponentClass {
new(): any;
}

class ShallowRenderer {
getRenderOutput<E extends ReactElement<any>>(): E;
getRenderOutput(): ReactElement<any>;
render(element: ReactElement<any>, context?: any): void;
unmount(): void;
}

namespace __Addons {
namespace TestUtils {
namespace Simulate {
export var blur: EventSimulator;
Expand Down
Loading

0 comments on commit 6190332

Please sign in to comment.