Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@quilted/react-testing

Package Overview
Dependencies
Maintainers
1
Versions
161
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@quilted/react-testing - npm Package Compare versions

Comparing version 0.0.0-preview-20230819015815 to 0.0.0-preview-20231002043134

6

build/typescript/implementations/preact.d.ts
import type { VNode, Component } from 'preact';
import { isNode } from '../environment.tsx';
import type { CustomRender, CustomRenderResult, CustomRenderOptions, CustomRenderExtendOptions, HookRunner, Environment, EnvironmentOptions, ContextOption, RenderOption, ActionsOption } from '../environment.tsx';
import type { Node, NodeApi, Root, RootApi, HtmlNodeExtensions } from '../types.ts';
import type { Node, NodeApi, Root, RootApi, HTMLNodeExtensions } from '../types.ts';
export { isNode };
export type { Node, NodeApi, Root, RootApi, HtmlNodeExtensions, CustomRender, CustomRenderResult, CustomRenderOptions, CustomRenderExtendOptions, HookRunner, Environment, EnvironmentOptions, ContextOption, RenderOption, ActionsOption, };
declare const render: CustomRender<import("../types.ts").EmptyObject, import("../types.ts").EmptyObject, import("../types.ts").EmptyObject, HtmlNodeExtensions, false>, createRender: <RenderOptions extends import("../types.ts").PlainObject = import("../types.ts").EmptyObject, Context_1 extends import("../types.ts").PlainObject = import("../types.ts").EmptyObject, Actions extends import("../types.ts").PlainObject = import("../types.ts").EmptyObject, Async extends boolean = false>(options: CustomRenderOptions<RenderOptions, Context_1, Context_1, Actions, Actions, HtmlNodeExtensions, Async>) => CustomRender<RenderOptions, Context_1, Actions, HtmlNodeExtensions, Async>, rendered: Set<Root<any, any, any, HtmlNodeExtensions>>, destroyAll: () => void;
export type { Node, NodeApi, Root, RootApi, HTMLNodeExtensions, CustomRender, CustomRenderResult, CustomRenderOptions, CustomRenderExtendOptions, HookRunner, Environment, EnvironmentOptions, ContextOption, RenderOption, ActionsOption, };
declare const render: CustomRender<import("../types.ts").EmptyObject, import("../types.ts").EmptyObject, import("../types.ts").EmptyObject, HTMLNodeExtensions, false>, createRender: <RenderOptions extends import("../types.ts").PlainObject = import("../types.ts").EmptyObject, Context_1 extends import("../types.ts").PlainObject = import("../types.ts").EmptyObject, Actions extends import("../types.ts").PlainObject = import("../types.ts").EmptyObject, Async extends boolean = false>(options: CustomRenderOptions<RenderOptions, Context_1, Context_1, Actions, Actions, HTMLNodeExtensions, Async>) => CustomRender<RenderOptions, Context_1, Actions, HTMLNodeExtensions, Async>, rendered: Set<Root<any, any, any, HTMLNodeExtensions>>, destroyAll: () => void;
export { render, createRender, rendered, destroyAll };

@@ -9,0 +9,0 @@ /**

import { isNode } from '../environment.tsx';
import type { CustomRender, CustomRenderResult, CustomRenderOptions, CustomRenderExtendOptions, HookRunner, Environment, EnvironmentOptions, ContextOption, RenderOption, ActionsOption } from '../environment.tsx';
import type { Node, NodeApi, Root, RootApi, HtmlNodeExtensions } from '../types.ts';
import type { Node, NodeApi, Root, RootApi, HTMLNodeExtensions } from '../types.ts';
export { isNode };
export type { Node, NodeApi, Root, RootApi, HtmlNodeExtensions, CustomRender, CustomRenderResult, CustomRenderOptions, CustomRenderExtendOptions, HookRunner, Environment, EnvironmentOptions, ContextOption, RenderOption, ActionsOption, };
declare const render: CustomRender<import("../types.ts").EmptyObject, import("../types.ts").EmptyObject, import("../types.ts").EmptyObject, HtmlNodeExtensions, false>, createRender: <RenderOptions extends import("../types.ts").PlainObject = import("../types.ts").EmptyObject, Context_1 extends import("../types.ts").PlainObject = import("../types.ts").EmptyObject, Actions extends import("../types.ts").PlainObject = import("../types.ts").EmptyObject, Async extends boolean = false>(options: CustomRenderOptions<RenderOptions, Context_1, Context_1, Actions, Actions, HtmlNodeExtensions, Async>) => CustomRender<RenderOptions, Context_1, Actions, HtmlNodeExtensions, Async>, rendered: Set<Root<any, any, any, HtmlNodeExtensions>>, destroyAll: () => void;
export type { Node, NodeApi, Root, RootApi, HTMLNodeExtensions, CustomRender, CustomRenderResult, CustomRenderOptions, CustomRenderExtendOptions, HookRunner, Environment, EnvironmentOptions, ContextOption, RenderOption, ActionsOption, };
declare const render: CustomRender<import("../types.ts").EmptyObject, import("../types.ts").EmptyObject, import("../types.ts").EmptyObject, HTMLNodeExtensions, false>, createRender: <RenderOptions extends import("../types.ts").PlainObject = import("../types.ts").EmptyObject, Context_1 extends import("../types.ts").PlainObject = import("../types.ts").EmptyObject, Actions extends import("../types.ts").PlainObject = import("../types.ts").EmptyObject, Async extends boolean = false>(options: CustomRenderOptions<RenderOptions, Context_1, Context_1, Actions, Actions, HTMLNodeExtensions, Async>) => CustomRender<RenderOptions, Context_1, Actions, HTMLNodeExtensions, Async>, rendered: Set<Root<any, any, any, HTMLNodeExtensions>>, destroyAll: () => void;
export { render, createRender, rendered, destroyAll };
type Create = Parameters<EnvironmentOptions<any, HtmlNodeExtensions>['update']>[1];
type Create = Parameters<EnvironmentOptions<any, HTMLNodeExtensions>['update']>[1];
type Child = ReturnType<Create> | string;
export declare function createNodeFromFiber(element: any, create: Create): Child;
//# sourceMappingURL=react-dom.d.ts.map
import type { MatcherState } from 'expect';
import type { Node, HtmlNodeExtensions } from '../types.ts';
import type { Node, HTMLNodeExtensions } from '../types.ts';
declare global {
namespace jest {
interface Matchers<R, T = {}> {
toContainReactHtml(text: string): void;
toContainReactHTML(text: string): void;
toHaveReactDataProps(data: {

@@ -13,3 +13,3 @@ [key: string]: string;

}
export declare function toContainReactHtml<Props>(this: MatcherState, node: Node<Props, HtmlNodeExtensions>, text: string): {
export declare function toContainReactHTML<Props>(this: MatcherState, node: Node<Props, HTMLNodeExtensions>, text: string): {
pass: boolean;

@@ -16,0 +16,0 @@ message: () => string;

@@ -52,3 +52,3 @@ import type { ComponentType, ComponentPropsWithoutRef, HTMLAttributes, Context } from 'react';

}
export interface HtmlNodeExtensions {
export interface HTMLNodeExtensions {
readonly isDom: boolean;

@@ -55,0 +55,0 @@ readonly domNodes: HTMLElement[];

# @quilted/react-testing
## 0.0.0-preview-20230819015815
## 0.0.0-preview-20231002043134
### Patch Changes
### Minor Changes
- Update Preact dependency
- Simplify app template APIs
## 0.6.0
### Minor Changes
- [#612](https://github.com/lemonmade/quilt/pull/612) [`bc849bc7`](https://github.com/lemonmade/quilt/commit/bc849bc740318936656162fde851b784ed6ef78f) Thanks [@lemonmade](https://github.com/lemonmade)! - Simplify app template APIs
## 0.5.31

@@ -10,0 +16,0 @@

{
"name": "@quilted/react-testing",
"type": "module",
"version": "0.0.0-preview-20230819015815",
"version": "0.0.0-preview-20231002043134",
"repository": {

@@ -6,0 +6,0 @@ "type": "git",

@@ -29,3 +29,3 @@ # `@quilted/react-testing`

- ['toContainReactText()'](#toContainReactText)
- ['toContainReactHtml()'](#toContainReactHtml)
- ['toContainReactHTML()'](#toContainReactHTML)
- [FAQ](#faq)

@@ -168,3 +168,3 @@

Additionally, this library provides DOM-specific matchers, like [`toContainReactHtml`](#toContainReactHtml), from the `@quilted/react-testing/dom-matchers` entrypoint.
Additionally, this library provides DOM-specific matchers, like [`toContainReactHTML`](#toContainReactHTML), from the `@quilted/react-testing/dom-matchers` entrypoint.

@@ -178,3 +178,3 @@ ```tsx

const button = render(<Button>Hello!</Button>);
expect(button).toContainReactHtml('<button>Hello!</button>');
expect(button).toContainReactHTML('<button>Hello!</button>');
```

@@ -740,3 +740,3 @@

#### <a name="toContainHtml"></a> `.toContainHtml(text: string)`
#### <a name="toContainReactHTML"></a> `.toContainReactHTML(text: string)`

@@ -749,3 +749,3 @@ > Only available from `@quilted/react-testing/dom-matchers`

const myComponent = render(<MyComponent />);
expect(myComponent).toContainHtml('<span>Hello world!</span>');
expect(myComponent).toContainReactHTML('<span>Hello world!</span>');
```

@@ -752,0 +752,0 @@

@@ -24,3 +24,3 @@ import {h, render as renderPreact, options} from 'preact';

RootApi,
HtmlNodeExtensions,
HTMLNodeExtensions,
} from '../types.ts';

@@ -38,3 +38,3 @@

RootApi,
HtmlNodeExtensions,
HTMLNodeExtensions,
CustomRender,

@@ -54,3 +54,3 @@ CustomRenderResult,

Context,
HtmlNodeExtensions
HTMLNodeExtensions
>({

@@ -78,3 +78,3 @@ act: act as any,

type Create = Parameters<
EnvironmentOptions<any, HtmlNodeExtensions>['update']
EnvironmentOptions<any, HTMLNodeExtensions>['update']
>[1];

@@ -160,3 +160,3 @@ type Child = ReturnType<Create> | string;

return (
this as any as NodeApi<any, HtmlNodeExtensions>
this as any as NodeApi<any, HTMLNodeExtensions>
).children.reduce<string>(

@@ -172,3 +172,3 @@ (text, child) =>

return (
this as any as NodeApi<any, HtmlNodeExtensions>
this as any as NodeApi<any, HTMLNodeExtensions>
).children.reduce<string>(

@@ -185,3 +185,3 @@ (text, child) =>

function getDomNodes(node: NodeApi<any, HtmlNodeExtensions>) {
function getDomNodes(node: NodeApi<any, HTMLNodeExtensions>) {
if (isDom) return [instance];

@@ -191,3 +191,3 @@

.filter(
(child): child is Node<unknown, HtmlNodeExtensions> =>
(child): child is Node<unknown, HTMLNodeExtensions> =>
typeof child !== 'string' && child.isDom,

@@ -194,0 +194,0 @@ )

@@ -22,3 +22,3 @@ import {createRoot, type Root as ReactDomRoot} from 'react-dom/client';

RootApi,
HtmlNodeExtensions,
HTMLNodeExtensions,
} from '../types.ts';

@@ -43,3 +43,3 @@

RootApi,
HtmlNodeExtensions,
HTMLNodeExtensions,
CustomRender,

@@ -59,3 +59,3 @@ CustomRenderResult,

Context,
HtmlNodeExtensions
HTMLNodeExtensions
>({

@@ -84,3 +84,3 @@ act,

type Create = Parameters<
EnvironmentOptions<any, HtmlNodeExtensions>['update']
EnvironmentOptions<any, HTMLNodeExtensions>['update']
>[1];

@@ -142,3 +142,3 @@ type Child = ReturnType<Create> | string;

return (
this as any as NodeApi<any, HtmlNodeExtensions>
this as any as NodeApi<any, HTMLNodeExtensions>
).children.reduce<string>(

@@ -154,3 +154,3 @@ (text, child) =>

return (
this as any as NodeApi<any, HtmlNodeExtensions>
this as any as NodeApi<any, HTMLNodeExtensions>
).children.reduce<string>(

@@ -167,3 +167,3 @@ (text, child) =>

function getDomNodes(node: NodeApi<any, HtmlNodeExtensions>) {
function getDomNodes(node: NodeApi<any, HTMLNodeExtensions>) {
if (isDom) return [instance];

@@ -173,3 +173,3 @@

.filter(
(child): child is Node<unknown, HtmlNodeExtensions> =>
(child): child is Node<unknown, HTMLNodeExtensions> =>
typeof child !== 'string' && child.isDom,

@@ -176,0 +176,0 @@ )

@@ -11,3 +11,3 @@ import type {MatcherState} from 'expect';

import type {Node, HtmlNodeExtensions} from '../types.ts';
import type {Node, HTMLNodeExtensions} from '../types.ts';

@@ -22,3 +22,3 @@ import {toHaveReactProps} from './props.ts';

interface Matchers<R, T = {}> {
toContainReactHtml(text: string): void;
toContainReactHTML(text: string): void;
toHaveReactDataProps(data: {[key: string]: string}): void;

@@ -30,18 +30,18 @@ }

expect.extend({
toContainReactHtml,
toContainReactHTML,
toHaveReactDataProps,
});
export function toContainReactHtml<Props>(
export function toContainReactHTML<Props>(
this: MatcherState,
node: Node<Props, HtmlNodeExtensions>,
node: Node<Props, HTMLNodeExtensions>,
text: string,
) {
assertIsNode(node, {
expectation: 'toContainReactHtml',
expectation: 'toContainReactHTML',
isNot: this.isNot,
});
const nodeHtml = node.html;
const matchIndex = nodeHtml.indexOf(text);
const nodeHTML = node.html;
const matchIndex = nodeHTML.indexOf(text);
const pass = matchIndex >= 0;

@@ -51,7 +51,7 @@

? () =>
`${matcherHint('.not.toContainReactHtml', node.toString())}\n\n` +
`${matcherHint('.not.toContainReactHTML', node.toString())}\n\n` +
`Expected the React element:\n ${receivedColor(node.toString())}\n` +
`Not to contain HTML:\n ${printExpected(text)}\n` +
`But it did:\n ${printReceivedWithHighlight(
nodeHtml,
nodeHTML,
matchIndex,

@@ -61,5 +61,5 @@ text.length,

: () =>
`${matcherHint('.not.toContainReactHtml', node.toString())}\n\n` +
`${matcherHint('.not.toContainReactHTML', node.toString())}\n\n` +
`Expected the React element:\n ${receivedColor(node.toString())}\n` +
`With HTML content:\n ${printReceived(nodeHtml)}\n` +
`With HTML content:\n ${printReceived(nodeHTML)}\n` +
`To contain HTML:\n ${printExpected(text)}\n`;

@@ -66,0 +66,0 @@

@@ -133,3 +133,3 @@ import type {

export interface HtmlNodeExtensions {
export interface HTMLNodeExtensions {
readonly isDom: boolean;

@@ -136,0 +136,0 @@ readonly domNodes: HTMLElement[];

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc