@helpscout/cyan
Advanced tools
Comparing version 0.5.0 to 0.6.0
@@ -14,2 +14,4 @@ "use strict"; | ||
var _cleanUp = _interopRequireDefault(require("./cleanUp")); | ||
var _debug = _interopRequireDefault(require("./debug")); | ||
@@ -48,2 +50,3 @@ | ||
type: _keyEvent.typeCommand, | ||
cleanUp: _cleanUp.default, | ||
debug: _debug.default, | ||
@@ -50,0 +53,0 @@ delay: _delay.default, |
@@ -15,10 +15,2 @@ "use strict"; | ||
var root = (0, _render.getRootNode)(); | ||
var other = Array.from(document.body.children).filter(function (node) { | ||
return node !== root; | ||
}); | ||
var html = root.innerHTML + other.map(function (node) { | ||
return node.outerHTML; | ||
}).join(''); | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
@@ -28,3 +20,3 @@ args[_key] = arguments[_key]; | ||
(_console = console).log.apply(_console, [(0, _pretty.pretty)(html)].concat(args)); | ||
(_console = console).log.apply(_console, [(0, _pretty.pretty)((0, _render.getDocumentHTML)())].concat(args)); | ||
}; | ||
@@ -31,0 +23,0 @@ |
import Cyan, { Selector, CySelector } from './Cyan.types'; | ||
import RenderWrapper from './RenderWrapper.types'; | ||
export declare type Cy = { | ||
@@ -31,2 +32,19 @@ /** | ||
/** | ||
* Renders the Component into the DOM. | ||
* | ||
* @param {any} Component The Component to render. | ||
* @returns {RenderWrapper} The RenderWrapper instance. | ||
* | ||
* @example | ||
* cy.render(<div>Hello</div>) | ||
*/ | ||
render(component: any): RenderWrapper; | ||
/** | ||
* Unmounts the rendered React component and resets the document.body. | ||
* | ||
* @example | ||
* cy.cleanUp() | ||
*/ | ||
cleanUp(): void; | ||
/** | ||
* Logs the html of document.body. | ||
@@ -46,11 +64,2 @@ * | ||
/** | ||
* Renders a React component into the DOM. | ||
* | ||
* @param {ReactComponent} component The component to render into the document. | ||
* | ||
* @example | ||
* cy.render(<div />) | ||
*/ | ||
render(component: any): void; | ||
/** | ||
* Types characters/commands into the document. | ||
@@ -57,0 +66,0 @@ * |
export declare const ROOT_ID = "__CYAN_ROOT_NODE__"; | ||
export declare const createRootNode: () => HTMLElement; | ||
export declare const getRootNode: () => Element | null; | ||
export declare const getDocumentHTML: () => string; |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.getRootNode = exports.createRootNode = exports.ROOT_ID = void 0; | ||
exports.getDocumentHTML = exports.getRootNode = exports.createRootNode = exports.ROOT_ID = void 0; | ||
var ROOT_ID = '__CYAN_ROOT_NODE__'; | ||
@@ -23,2 +23,14 @@ exports.ROOT_ID = ROOT_ID; | ||
exports.getRootNode = getRootNode; | ||
exports.getRootNode = getRootNode; | ||
var getDocumentHTML = function () { | ||
var root = getRootNode(); | ||
var other = Array.from(document.body.children).filter(function (node) { | ||
return node !== root; | ||
}); | ||
return root.innerHTML + other.map(function (node) { | ||
return node.outerHTML; | ||
}).join(''); | ||
}; | ||
exports.getDocumentHTML = getDocumentHTML; |
{ | ||
"name": "@helpscout/cyan", | ||
"version": "0.5.0", | ||
"version": "0.6.0", | ||
"description": "Cypress-like Testing for React + JSDOM", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
134370
79
3263