mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Add assert-equal-jsx (#15884)
This commit is contained in:
parent
c59b52e585
commit
a15b6bf327
16
types/assert-equal-jsx/assert-equal-jsx-tests.tsx
Normal file
16
types/assert-equal-jsx/assert-equal-jsx-tests.tsx
Normal file
@ -0,0 +1,16 @@
|
||||
import * as React from 'react';
|
||||
import assertEqualJSX = require('assert-equal-jsx');
|
||||
|
||||
function sanitizeId(str: string): string {
|
||||
return str.replace(/my-component-id-(\d+)/ig, 'my-component-id-0');
|
||||
}
|
||||
|
||||
assertEqualJSX(
|
||||
<div id='my-component-id-314159265' />,
|
||||
// should equal:
|
||||
<div id='my-component-id-0' />,
|
||||
// with sanitization:
|
||||
{
|
||||
sanitize: sanitizeId
|
||||
}
|
||||
);
|
||||
17
types/assert-equal-jsx/index.d.ts
vendored
Normal file
17
types/assert-equal-jsx/index.d.ts
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
// Type definitions for assert-equal-jsx 1.0
|
||||
// Project: https://github.com/thejameskyle/assert-equal-jsx
|
||||
// Definitions by: Josh Toft <https://github.com/seryl>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
import * as React from 'react';
|
||||
|
||||
declare namespace assertEqualJSX {
|
||||
interface AsssertOptions {
|
||||
sanitize?(str: string): string;
|
||||
}
|
||||
}
|
||||
|
||||
declare function assertEqualJSX(actual: JSX.Element, expected: JSX.Element, opts?: assertEqualJSX.AsssertOptions): void;
|
||||
|
||||
export = assertEqualJSX;
|
||||
24
types/assert-equal-jsx/tsconfig.json
Normal file
24
types/assert-equal-jsx/tsconfig.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"jsx": "react",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"assert-equal-jsx-tests.tsx"
|
||||
]
|
||||
}
|
||||
1
types/assert-equal-jsx/tslint.json
Normal file
1
types/assert-equal-jsx/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user