mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 04:50:18 +00:00
Add assert-equal-jsx (#15884)
This commit is contained in:
@@ -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
|
||||
}
|
||||
);
|
||||
Vendored
+17
@@ -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;
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user