test-drive
Advanced tools
Comparing version 0.5.5 to 0.6.0
@@ -13,3 +13,4 @@ "use strict"; | ||
var is_present_1 = require("./is-present"); | ||
var chaiAsPromised = require("chai-as-promised-compat"); | ||
var chaiAsPromised = require("chai-as-promised"); | ||
var chaiStyle = require("chai-style"); | ||
var sinonChai = require("sinon-chai"); | ||
@@ -24,2 +25,3 @@ var layout_1 = require("./layout"); | ||
chai.use(chaiDom); | ||
chai.use(chaiStyle); | ||
} | ||
@@ -26,0 +28,0 @@ var expect = Object.assign(chai.expect.bind(chai), chai.expect); |
@@ -0,6 +1,8 @@ | ||
export declare function eventSimple(target: Element, type: string, eventInitDict?: EventInit): void; | ||
export declare function eventCompat(target: Element, type: string, eventInitDict?: EventInit): void; | ||
export declare const event: typeof eventSimple; | ||
export declare function change(target: Element | null, newValue: string): void; | ||
export declare function event(target: Element, type: string, payload: any): void; | ||
export declare const trigger: { | ||
event: (target: Element, type: string, payload: any) => void; | ||
event: (target: Element, type: string, eventInitDict?: EventInit | undefined) => void; | ||
change: (target: Element | null, newValue: string) => void; | ||
}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var helpers_1 = require("./helpers"); | ||
function eventSimple(target, type, eventInitDict) { | ||
var event = new Event(type, eventInitDict); | ||
target.dispatchEvent(event); | ||
} | ||
exports.eventSimple = eventSimple; | ||
// for browsers without event constructors (IE11) | ||
function eventCompat(target, type, eventInitDict) { | ||
var event = document.createEvent('Event'); | ||
var _a = eventInitDict || {}, _b = _a.bubbles, bubbles = _b === void 0 ? true : _b, _c = _a.cancelable, cancelable = _c === void 0 ? true : _c; | ||
event.initEvent(type, bubbles, cancelable); | ||
target.dispatchEvent(event); | ||
} | ||
exports.eventCompat = eventCompat; | ||
exports.event = typeof Event === 'function' ? eventSimple : eventCompat; | ||
function change(target, newValue) { | ||
@@ -8,3 +22,3 @@ if (target) { | ||
target.focus(); | ||
event(target, 'focus', { | ||
exports.event(target, 'focus', { | ||
bubbles: false, | ||
@@ -14,7 +28,7 @@ cancelable: true | ||
target.value = newValue; | ||
event(target, 'input', { | ||
exports.event(target, 'input', { | ||
bubbles: false, | ||
cancelable: true | ||
}); | ||
event(target, 'change', { | ||
exports.event(target, 'change', { | ||
bubbles: false, | ||
@@ -33,11 +47,6 @@ cancelable: true | ||
exports.change = change; | ||
function event(target, type, payload) { | ||
var event = new Event(type, payload); | ||
target.dispatchEvent(event); | ||
} | ||
exports.event = event; | ||
exports.trigger = { | ||
event: event, | ||
event: exports.event, | ||
change: change | ||
}; | ||
//# sourceMappingURL=trigger.js.map |
@@ -5,2 +5,1 @@ export declare type StateAssertionFunction = () => void; | ||
export declare function waitForDom(domRoot: Element, assertion: DomStateAssertionFunction, timeout?: number): Promise<{}>; | ||
export declare function isPromise(object: any): boolean; |
@@ -18,4 +18,4 @@ "use strict"; | ||
var returnValue = assertion(); | ||
if (isPromise(returnValue)) { | ||
throw new Error('Promises shouldn\'t be returned from within waitFor/waitForDom! Please refer to the docs for a more detailed explanation of usage'); | ||
if (returnValue instanceof Promise) { | ||
return new Error('Promises shouldn\'t be returned from within waitFor/waitForDom! Please refer to the docs for a more detailed explanation of usage'); | ||
} | ||
@@ -61,4 +61,4 @@ } | ||
var returnValue = assertion(domRoot); | ||
if (isPromise(returnValue)) { | ||
throw new Error('Promises shouldn\'t be returned from within waitFor/waitForDom! Please refer to the docs for a more detailed explanation of usage'); | ||
if (returnValue instanceof Promise) { | ||
return new Error('Promises shouldn\'t be returned from within waitFor/waitForDom! Please refer to the docs for a more detailed explanation of usage'); | ||
} | ||
@@ -105,6 +105,2 @@ } | ||
exports.waitForDom = waitForDom; | ||
function isPromise(object) { | ||
return typeof object === 'object' && 'then' in object && typeof object.then === 'function'; | ||
} | ||
exports.isPromise = isPromise; | ||
//# sourceMappingURL=wait-for.js.map |
@@ -37,3 +37,6 @@ type VerticalAlignment = 'top' | 'center' | 'bottom'; | ||
above(value: number | Element): Assertion; | ||
// chai-style | ||
style(styleName: string, styleValue?: string): Assertion; | ||
} | ||
} |
{ | ||
"name": "test-drive", | ||
"version": "0.5.5", | ||
"version": "0.6.0", | ||
"description": "Opinionated library for writing web component tests", | ||
@@ -12,3 +12,3 @@ "main": "./dist/src/index.js", | ||
"test": "npm run test:node && npm run test:browser", | ||
"test:node": "mocha --compilers ts:ts-node/register,tsx:ts-node/register ./test/index.node.ts", | ||
"test:node": "mocha --require ts-node/register ./test/index.node.ts --watch-extensions ts", | ||
"test:browser": "karma start --single-run", | ||
@@ -18,34 +18,34 @@ "start": "webpack-dev-server --progress" | ||
"dependencies": { | ||
"@types/chai": "^4.0.1", | ||
"@types/chai-as-promised": "^0.0.31", | ||
"@types/chai": "^4.0.4", | ||
"@types/chai-as-promised": "^7.1.0", | ||
"@types/chai-dom": "^0.0.5", | ||
"@types/sinon": "^2.3.3", | ||
"@types/sinon-chai": "^2.7.28", | ||
"chai": "^4.1.0", | ||
"chai-as-promised-compat": "^7.0.3", | ||
"chai-dom": "^1.5.0", | ||
"@types/sinon": "^4.0.0", | ||
"@types/sinon-chai": "^2.7.29", | ||
"chai": "^4.1.2", | ||
"chai-as-promised": "^7.1.1", | ||
"chai-dom": "^1.6.0", | ||
"chai-style": "^1.0.2", | ||
"dom-matches": "^2.0.0", | ||
"sinon": "^2.4.1", | ||
"sinon-chai": "^2.12.0" | ||
"sinon": "^4.1.2", | ||
"sinon-chai": "^2.14.0" | ||
}, | ||
"devDependencies": { | ||
"@types/mocha": "^2.2.41", | ||
"core-js": "^2.4.1", | ||
"karma": "^1.7.0", | ||
"@types/mocha": "^2.2.44", | ||
"core-js": "^2.5.1", | ||
"karma": "^1.7.1", | ||
"karma-chrome-launcher": "^2.2.0", | ||
"karma-firefox-launcher": "^1.0.1", | ||
"karma-mocha": "^1.3.0", | ||
"karma-sauce-launcher": "^1.1.0", | ||
"karma-webpack": "^2.0.4", | ||
"mocha": "^3.4.2", | ||
"karma-webpack": "^2.0.6", | ||
"mocha": "^4.0.1", | ||
"mocha-loader": "^1.1.1", | ||
"rimraf": "^2.6.1", | ||
"ts-loader": "^2.3.2", | ||
"rimraf": "^2.6.2", | ||
"ts-loader": "^3.1.1", | ||
"ts-node": "^3.3.0", | ||
"typescript": "^2.4.2", | ||
"webpack": "^3.4.1", | ||
"webpack-dev-server": "^2.6.1" | ||
"typescript": "~2.6.1", | ||
"webpack": "^3.8.1", | ||
"webpack-dev-server": "^2.9.4" | ||
}, | ||
"files": [ | ||
"dist/src", | ||
"src", | ||
"helpers", | ||
@@ -52,0 +52,0 @@ "matchers.d.ts" |
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
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
70004
12
27
530
+ Addedchai-as-promised@^7.1.1
+ Addedchai-style@^1.0.2
+ Added@sinonjs/commons@1.8.6(transitive)
+ Added@sinonjs/formatio@2.0.03.2.2(transitive)
+ Added@sinonjs/samsam@3.3.3(transitive)
+ Added@sinonjs/text-encoding@0.7.3(transitive)
+ Added@types/chai-as-promised@7.1.8(transitive)
+ Added@types/sinon@4.3.3(transitive)
+ Addedarray-from@2.1.1(transitive)
+ Addedchai-as-promised@7.1.2(transitive)
+ Addedchai-style@1.0.3(transitive)
+ Addedhas-flag@3.0.0(transitive)
+ Addedjust-extend@4.2.1(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedlodash.get@4.4.2(transitive)
+ Addedlolex@2.7.55.1.2(transitive)
+ Addednise@1.5.3(transitive)
+ Addedsinon@4.5.0(transitive)
+ Addedsupports-color@5.5.0(transitive)
+ Addedtype-detect@4.0.8(transitive)
- Removedchai-as-promised-compat@^7.0.3
- Removed@types/chai-as-promised@0.0.31(transitive)
- Removed@types/sinon@2.3.7(transitive)
- Removedchai-as-promised-compat@7.0.3(transitive)
- Removedformatio@1.2.0(transitive)
- Removedlolex@1.6.0(transitive)
- Removednative-promise-only@0.8.1(transitive)
- Removedsinon@2.4.1(transitive)
- Removedtext-encoding@0.6.4(transitive)
Updated@types/chai@^4.0.4
Updated@types/sinon@^4.0.0
Updated@types/sinon-chai@^2.7.29
Updatedchai@^4.1.2
Updatedchai-dom@^1.6.0
Updatedsinon@^4.1.2
Updatedsinon-chai@^2.14.0