@helpscout/cyan
Advanced tools
Comparing version 0.0.14 to 0.0.15
@@ -32,3 +32,3 @@ "use strict"; | ||
expect(_index.cy.getByCy('hello').hasTagName('aside')).toBe(true); | ||
expect(_index.cy.getByCy('hello').isTagName('aside')).toBe(true); | ||
}); | ||
@@ -40,3 +40,3 @@ test('Can get an DOM Node by data-cy by chaining', function () { | ||
expect(_index.cy.get('main').getByCy('hello').hasTagName('aside')).toBe(true); | ||
expect(_index.cy.get('main').getByCy('hello').isTagName('aside')).toBe(true); | ||
}); | ||
@@ -43,0 +43,0 @@ }); |
@@ -93,3 +93,3 @@ "use strict"; | ||
}); | ||
describe('hasTagName', function () { | ||
describe('isTagName', function () { | ||
test('Can check tagName for node', function () { | ||
@@ -102,6 +102,6 @@ _index.cy.render(_react.default.createElement("div", { | ||
expect(assert.hasTagName('div')).toBe(true); | ||
expect(assert.hasTagName('DIV')).toBe(true); | ||
expect(assert.isTagName('div')).toBe(true); | ||
expect(assert.isTagName('DIV')).toBe(true); | ||
}); | ||
test('Can check tagName for node, with hasTag', function () { | ||
test('Can check tagName for node, with isTagName', function () { | ||
_index.cy.render(_react.default.createElement("div", { | ||
@@ -113,4 +113,4 @@ className: "one two three" | ||
expect(assert.hasTag('div')).toBe(true); | ||
expect(assert.hasTag('DIV')).toBe(true); | ||
expect(assert.isTagName('div')).toBe(true); | ||
expect(assert.isTagName('DIV')).toBe(true); | ||
}); | ||
@@ -117,0 +117,0 @@ }); |
@@ -44,3 +44,3 @@ "use strict"; | ||
function hasTagName(tagName) { | ||
function isTagName(tagName) { | ||
var _this4 = this; | ||
@@ -94,4 +94,4 @@ | ||
hasClass: hasClassName, | ||
hasTagName: hasTagName, | ||
hasTag: hasTagName, | ||
isTagName: isTagName, | ||
isTag: isTagName, | ||
isChecked: isChecked, | ||
@@ -98,0 +98,0 @@ isDisabled: isDisabled, |
{ | ||
"name": "@helpscout/cyan", | ||
"version": "0.0.14", | ||
"version": "0.0.15", | ||
"description": "Cypress-like Testing for React + JSDOM", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -0,7 +1,18 @@ | ||
import { | ||
ReactInstance, | ||
Component, | ||
ComponentState, | ||
ReactElement, | ||
SFCElement, | ||
CElement, | ||
DOMAttributes, | ||
DOMElement, | ||
} from 'react' | ||
import Cyan from './Cyan' | ||
export type Selector = any | ||
export type CySelector = string | ||
export type ReactComponent = ReactElement | Component | ||
export interface Cyan {} | ||
declare const cy: { | ||
export const cy: { | ||
/** | ||
@@ -36,4 +47,102 @@ * Get the DOM elements with a selector. | ||
getByText(text: string): Cyan | ||
/** | ||
* Logs the html of document.body. | ||
* | ||
* @example | ||
* cy.debug() | ||
*/ | ||
debug(): void | ||
/** | ||
* Renders a React component into the DOM. | ||
* | ||
* @param {ReactComponent} component The component to render into the document. | ||
* | ||
* @example | ||
* cy.render(<div />) | ||
*/ | ||
render(component: ReactComponent): void | ||
/** | ||
* Types characters/commands into the document. | ||
* | ||
* @param {string} value The characters/commands to type. | ||
* | ||
* @example | ||
* cy.type('{esc}') | ||
*/ | ||
type(command: string): void | ||
/** | ||
* (Async) Wait for a specified time. | ||
* | ||
* @param {number} time Amount of time (ms) to wait. | ||
* | ||
* @example | ||
* cy.wait(1000) | ||
*/ | ||
wait(time: number): void | ||
/** | ||
* Use fake timers with Jest. Allows for cy actions to automatically increment timers when fired. | ||
* Add this to the beginning of your test file. | ||
* | ||
* @example | ||
* cy.useFakeTimers() | ||
*/ | ||
useFakeTimers(): void | ||
} | ||
export const cy | ||
////////////////////////////////////////////////////////////////////////////// | ||
// Configuration | ||
////////////////////////////////////////////////////////////////////////////// | ||
/** | ||
* Sets the state for Cyan's configuration. | ||
* @param {any} state The state for the configuration. | ||
* @param {Function<any>} callback Callback after the configuration state has been set. | ||
*/ | ||
export function setConfigState( | ||
state: any, | ||
callback?: (state: any) => void, | ||
): void | ||
/** | ||
* Resets the state for the configuration. Useful for clean up. | ||
*/ | ||
export function resetConfig(): void | ||
////////////////////////////////////////////////////////////////////////////// | ||
// Store | ||
////////////////////////////////////////////////////////////////////////////// | ||
/** | ||
* Sets a (Redux) store for components that render. | ||
* @param {any} reduxStore The Redux store to set. | ||
*/ | ||
export function setStore(reduxStore: any): void | ||
/** | ||
* Sets a (Redux) reducer for the store used to render. | ||
* @param {Object | Function} reducer The reducer for the store. | ||
*/ | ||
export function setStoreReducer(reducer: Object | Function): void | ||
/** | ||
* Sets the initialState for the store used to render. | ||
* @param {any} state The initial state for the store. | ||
*/ | ||
export function setInitialState(state: any): void | ||
/** | ||
* Sets the state for the store used to render. | ||
* @param {any} state The state for the store. | ||
* @param {Function<any>} callback Callback after the store state has been set. | ||
*/ | ||
export function setStoreState(state: any, callback?: (state: any) => void): void | ||
/** | ||
* Resets the state for the store. Useful for clean up. | ||
*/ | ||
export function resetStore(): void |
105431
56
2766