test-drive
Advanced tools
Comparing version 1.5.0 to 1.6.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isHTMLElement = exports.isElement = exports.isInputElement = exports.getGlobalsOf = void 0; | ||
exports.getGlobalsOf = getGlobalsOf; | ||
exports.isInputElement = isInputElement; | ||
exports.isElement = isElement; | ||
exports.isHTMLElement = isHTMLElement; | ||
function getGlobalsOf(element) { | ||
return element.ownerDocument?.defaultView ?? window; | ||
} | ||
exports.getGlobalsOf = getGlobalsOf; | ||
function isInputElement(element) { | ||
@@ -17,11 +19,8 @@ const globalScope = getGlobalsOf(element); | ||
} | ||
exports.isInputElement = isInputElement; | ||
function isElement(obj) { | ||
return !!obj && obj instanceof getGlobalsOf(obj)['Element']; | ||
} | ||
exports.isElement = isElement; | ||
function isHTMLElement(obj) { | ||
return !!obj && obj instanceof getGlobalsOf(obj)['HTMLElement']; | ||
} | ||
exports.isHTMLElement = isHTMLElement; | ||
//# sourceMappingURL=helpers.js.map |
@@ -1,2 +0,2 @@ | ||
/// <reference path="../matchers.d.ts" /> | ||
/// <reference path="../matchers.d.ts" preserve="true" /> | ||
import sinon from 'sinon'; | ||
@@ -3,0 +3,0 @@ import chai from 'chai'; |
"use strict"; | ||
// eslint-disable-next-line @typescript-eslint/triple-slash-reference | ||
/// <reference path="../matchers.d.ts" /> | ||
/// <reference path="../matchers.d.ts" preserve="true" /> | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
@@ -5,0 +5,0 @@ if (k2 === undefined) k2 = k; |
@@ -1,3 +0,2 @@ | ||
/// <reference types="chai" /> | ||
export default function (chai: Chai.ChaiStatic, { flag }: Chai.ChaiUtils): void; | ||
export default function (chai: Chai.ChaiStatic, utils: Chai.ChaiUtils): void; | ||
//# sourceMappingURL=is-present.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = default_1; | ||
const helpers_1 = require("./helpers"); | ||
@@ -8,13 +9,12 @@ function isPresent(element) { | ||
} | ||
function default_1(chai, { flag }) { | ||
function default_1(chai, utils) { | ||
chai.Assertion.addMethod('present', function () { | ||
const element = flag(this, 'object'); | ||
const element = utils.flag(this, 'object'); | ||
this.assert(isPresent(element), 'Element expected to be present.', 'Element expected to be absent.', true); | ||
}); | ||
chai.Assertion.addMethod('absent', function () { | ||
const element = flag(this, 'object'); | ||
const element = utils.flag(this, 'object'); | ||
this.assert(!isPresent(element), 'Element expected to be absent.', 'Element expected to be present.', true); | ||
}); | ||
} | ||
exports.default = default_1; | ||
//# sourceMappingURL=is-present.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getLayoutFixture = exports.dom = exports.generateMap = void 0; | ||
exports.generateMap = generateMap; | ||
exports.dom = dom; | ||
exports.getLayoutFixture = getLayoutFixture; | ||
function generateMap(source) { | ||
@@ -31,3 +33,2 @@ let col = 0; | ||
} | ||
exports.generateMap = generateMap; | ||
function dom(source) { | ||
@@ -53,3 +54,2 @@ const layoutMap = generateMap(source); | ||
} | ||
exports.dom = dom; | ||
function getLayoutFixture(source) { | ||
@@ -63,3 +63,2 @@ const fixture = dom(source); | ||
} | ||
exports.getLayoutFixture = getLayoutFixture; | ||
//# sourceMappingURL=layout-driver.js.map |
@@ -1,2 +0,1 @@ | ||
/// <reference types="chai" /> | ||
export declare function getBoundaries(element: Element): DOMRect; | ||
@@ -3,0 +2,0 @@ export declare function detectMisalignment(edges: number[], tolerance?: number): number[]; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.detectMisalignment = exports.getBoundaries = void 0; | ||
exports.getBoundaries = getBoundaries; | ||
exports.detectMisalignment = detectMisalignment; | ||
exports.default = use; | ||
const helpers_1 = require("./helpers"); | ||
@@ -8,3 +10,2 @@ function getBoundaries(element) { | ||
} | ||
exports.getBoundaries = getBoundaries; | ||
function isPointInside(pt, boundaries) { | ||
@@ -44,3 +45,2 @@ return pt.x >= boundaries.left && pt.x <= boundaries.right && pt.y >= boundaries.top && pt.y <= boundaries.bottom; | ||
} | ||
exports.detectMisalignment = detectMisalignment; | ||
const propsByDirection = { | ||
@@ -167,3 +167,2 @@ horizontal: ['right', 'left'], | ||
} | ||
exports.default = use; | ||
//# sourceMappingURL=layout.js.map |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.selectDom = void 0; | ||
exports.selectDom = selectDom; | ||
const dom_matches_1 = __importDefault(require("dom-matches")); | ||
@@ -37,3 +37,2 @@ function selectDom(container, attrName = 'data-automation-id') { | ||
} | ||
exports.selectDom = selectDom; | ||
//# sourceMappingURL=select-dom.js.map |
@@ -1,2 +0,2 @@ | ||
/// <reference path="../matchers.d.ts" /> | ||
/// <reference path="../matchers.d.ts" preserve="true" /> | ||
import sinon from 'sinon'; | ||
@@ -3,0 +3,0 @@ import chai from 'chai'; |
// eslint-disable-next-line @typescript-eslint/triple-slash-reference | ||
/// <reference path="../matchers.d.ts" /> | ||
/// <reference path="../matchers.d.ts" preserve="true" /> | ||
import sinon from 'sinon'; | ||
@@ -4,0 +4,0 @@ import chai from 'chai'; |
@@ -1,3 +0,2 @@ | ||
/// <reference types="chai" /> | ||
export default function (chai: Chai.ChaiStatic, { flag }: Chai.ChaiUtils): void; | ||
export default function (chai: Chai.ChaiStatic, utils: Chai.ChaiUtils): void; | ||
//# sourceMappingURL=is-present.d.ts.map |
@@ -6,9 +6,9 @@ import { isElement } from './helpers'; | ||
} | ||
export default function (chai, { flag }) { | ||
export default function (chai, utils) { | ||
chai.Assertion.addMethod('present', function () { | ||
const element = flag(this, 'object'); | ||
const element = utils.flag(this, 'object'); | ||
this.assert(isPresent(element), 'Element expected to be present.', 'Element expected to be absent.', true); | ||
}); | ||
chai.Assertion.addMethod('absent', function () { | ||
const element = flag(this, 'object'); | ||
const element = utils.flag(this, 'object'); | ||
this.assert(!isPresent(element), 'Element expected to be absent.', 'Element expected to be present.', true); | ||
@@ -15,0 +15,0 @@ }); |
@@ -1,2 +0,1 @@ | ||
/// <reference types="chai" /> | ||
export declare function getBoundaries(element: Element): DOMRect; | ||
@@ -3,0 +2,0 @@ export declare function detectMisalignment(edges: number[], tolerance?: number): number[]; |
{ | ||
"name": "test-drive", | ||
"version": "1.5.0", | ||
"version": "1.6.0", | ||
"description": "Opinionated library for writing web component tests", | ||
@@ -16,7 +16,7 @@ "main": "./cjs/index.js", | ||
"test": "mocha-web \"./test/**/*.spec.ts\"", | ||
"lint": "eslint .", | ||
"lint": "eslint", | ||
"typecheck": "tsc --noEmit" | ||
}, | ||
"dependencies": { | ||
"chai": "^4.4.1", | ||
"chai": "^4.5.0", | ||
"chai-as-promised": "^7.1.2", | ||
@@ -27,8 +27,9 @@ "chai-dom": "^1.12.0", | ||
"promise-assist": "^2.0.1", | ||
"sinon": "^18.0.0", | ||
"sinon": "^19.0.1", | ||
"sinon-chai": "^3.7.0" | ||
}, | ||
"devDependencies": { | ||
"@playwright/browser-chromium": "^1.44.0", | ||
"@types/chai": "^4.3.16", | ||
"@eslint/js": "^9.10.0", | ||
"@playwright/browser-chromium": "^1.47.0", | ||
"@types/chai": "^4.3.19", | ||
"@types/chai-as-promised": "^7.1.8", | ||
@@ -38,15 +39,15 @@ "@types/chai-dom": "^1.11.3", | ||
"@types/dom-matches": "^2.0.2", | ||
"@types/mocha": "^10.0.6", | ||
"@types/mocha": "^10.0.8", | ||
"@types/sinon": "^17.0.3", | ||
"@types/sinon-chai": "^3.2.12", | ||
"@typescript-eslint/eslint-plugin": "^7.9.0", | ||
"esbuild": "^0.21.2", | ||
"eslint": "^8.57.0", | ||
"esbuild": "^0.23.1", | ||
"eslint": "^9.10.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-plugin-no-only-tests": "^3.1.0", | ||
"mocha": "^10.4.0", | ||
"mocha-web": "^1.0.2", | ||
"prettier": "^3.2.5", | ||
"rimraf": "^5.0.7", | ||
"typescript": "~5.4.5" | ||
"eslint-plugin-no-only-tests": "^3.3.0", | ||
"mocha": "^10.7.3", | ||
"mocha-web": "^2.0.0", | ||
"prettier": "^3.3.3", | ||
"rimraf": "^6.0.1", | ||
"typescript": "~5.6.2", | ||
"typescript-eslint": "^8.5.0" | ||
}, | ||
@@ -53,0 +54,0 @@ "files": [ |
// eslint-disable-next-line @typescript-eslint/triple-slash-reference | ||
/// <reference path="../matchers.d.ts" /> | ||
/// <reference path="../matchers.d.ts" preserve="true" /> | ||
@@ -4,0 +4,0 @@ import sinon from 'sinon'; |
@@ -10,5 +10,5 @@ import { isElement } from './helpers'; | ||
export default function (chai: Chai.ChaiStatic, { flag }: Chai.ChaiUtils): void { | ||
export default function (chai: Chai.ChaiStatic, utils: Chai.ChaiUtils): void { | ||
chai.Assertion.addMethod('present', function () { | ||
const element = flag(this, 'object') as Element; | ||
const element = utils.flag(this, 'object') as Element; | ||
this.assert(isPresent(element), 'Element expected to be present.', 'Element expected to be absent.', true); | ||
@@ -18,5 +18,5 @@ }); | ||
chai.Assertion.addMethod('absent', function () { | ||
const element = flag(this, 'object') as Element; | ||
const element = utils.flag(this, 'object') as Element; | ||
this.assert(!isPresent(element), 'Element expected to be absent.', 'Element expected to be present.', true); | ||
}); | ||
} |
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
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
94210
20
1158
+ Addeddiff@7.0.0(transitive)
+ Addedsinon@19.0.2(transitive)
- Removed@sinonjs/fake-timers@11.2.2(transitive)
- Removeddiff@5.2.0(transitive)
- Removedsinon@18.0.1(transitive)
Updatedchai@^4.5.0
Updatedsinon@^19.0.1