@cepharum/contextual-gherkin 1.2.5 → 1.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.js +2 -2
- package/index.js +0 -1
- package/lib/api.js +1 -1
- package/lib/context.js +10 -12
- package/package.json +4 -4
- package/steps/global-action.js +3 -3
package/cli.js
CHANGED
|
@@ -23,7 +23,7 @@ const isWindows = os.platform() === "win32";
|
|
|
23
23
|
|
|
24
24
|
// display some basic stats
|
|
25
25
|
const cg = require( Path.resolve( cgFolder, "package.json" ) );
|
|
26
|
-
console.log( `@cepharum/contextual-gherkin ${cg.version}` );
|
|
26
|
+
console.log( `@cepharum/contextual-gherkin ${cg.version}` ); // eslint-disable-line no-console
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
// make sure all peer dependencies of contextual-gherkin have been installed
|
|
@@ -272,7 +272,7 @@ const isWindows = os.platform() === "win32";
|
|
|
272
272
|
child.once( "exit", process.exit );
|
|
273
273
|
} )();
|
|
274
274
|
|
|
275
|
-
async function stat( path ) { // eslint-disable-line require-jsdoc
|
|
275
|
+
async function stat( path ) { // eslint-disable-line jsdoc/require-jsdoc
|
|
276
276
|
try {
|
|
277
277
|
return await File.promises.stat( path );
|
|
278
278
|
} catch ( cause ) {
|
package/index.js
CHANGED
package/lib/api.js
CHANGED
|
@@ -269,7 +269,7 @@ class Api {
|
|
|
269
269
|
const lookup = this.normalizeName( singularName );
|
|
270
270
|
|
|
271
271
|
const populate = ( pool, alias ) => {
|
|
272
|
-
pool[alias] = true;
|
|
272
|
+
pool[alias] = true;
|
|
273
273
|
|
|
274
274
|
for ( const candidate of Object.keys( defined ) ) {
|
|
275
275
|
if ( defined[candidate].includes( alias ) && !pool[candidate] ) {
|
package/lib/context.js
CHANGED
|
@@ -9,11 +9,10 @@ const pluralize = require( "pluralize" );
|
|
|
9
9
|
* @returns {number} id of element
|
|
10
10
|
*/
|
|
11
11
|
const getID = ClientFunction( () => {
|
|
12
|
-
// eslint-disable-next-line no-undef
|
|
13
12
|
const el = selector();
|
|
14
13
|
|
|
15
14
|
if ( !el ) {
|
|
16
|
-
console.warn( `lost track of matching element #${index}/${numMatches} of type ${typeOfElement} prior to detaching it`, String( selector ) );
|
|
15
|
+
console.warn( `lost track of matching element #${index}/${numMatches} of type ${typeOfElement} prior to detaching it`, String( selector ) );
|
|
17
16
|
return null;
|
|
18
17
|
}
|
|
19
18
|
|
|
@@ -21,7 +20,6 @@ const getID = ClientFunction( () => {
|
|
|
21
20
|
return el.dataset.contextualGherkinId;
|
|
22
21
|
}
|
|
23
22
|
|
|
24
|
-
// eslint-disable-next-line no-undef
|
|
25
23
|
const data = document.documentElement.dataset;
|
|
26
24
|
const nextId = Number( data.contextualGherkinLastId || 0 ) + 1;
|
|
27
25
|
|
|
@@ -165,7 +163,7 @@ class Context {
|
|
|
165
163
|
* Limits current set of matches to those picked by a given callback
|
|
166
164
|
* function invoked in browser.
|
|
167
165
|
*
|
|
168
|
-
* @param {
|
|
166
|
+
* @param {(node:Element, index:number) => boolean} fn callback invoked in context of browser
|
|
169
167
|
* @param {Object<string,any>} dependencies serializable data exposed in browser for use in callback
|
|
170
168
|
* @returns {Promise<Context>} node describing matches of filtering and their processing context
|
|
171
169
|
*/
|
|
@@ -192,7 +190,7 @@ class Context {
|
|
|
192
190
|
*
|
|
193
191
|
* @param {string} typeOfSub names type of elements to focus on
|
|
194
192
|
* @param {SimpleSelector} defaultSelector selector to use as fallback on searching sub-elements as candidates
|
|
195
|
-
* @param {
|
|
193
|
+
* @param {(node: Element, index: number) => boolean} fn callback invoked in context of browser
|
|
196
194
|
* @param {Object<string,any>} context serializable data provided as context (via `this`) of invoked callback
|
|
197
195
|
* @returns {Promise<Context>} node describing matches of filtering and their processing context
|
|
198
196
|
*/
|
|
@@ -217,7 +215,7 @@ class Context {
|
|
|
217
215
|
}
|
|
218
216
|
|
|
219
217
|
for ( let i = 0, count = subs.length; i < count; i++ ) {
|
|
220
|
-
if ( fn( subs[i], index ) ) {
|
|
218
|
+
if ( fn( subs[i], index ) ) {
|
|
221
219
|
return true;
|
|
222
220
|
}
|
|
223
221
|
}
|
|
@@ -405,7 +403,7 @@ class Context {
|
|
|
405
403
|
async checkFilteredInContext( filteredContext, contextualWord, requireAll = true, track = true ) {
|
|
406
404
|
let iter;
|
|
407
405
|
|
|
408
|
-
for ( iter = filteredContext; iter && iter !== this; iter = iter.parent ) {}
|
|
406
|
+
for ( iter = filteredContext; iter && iter !== this; iter = iter.parent ) {}
|
|
409
407
|
|
|
410
408
|
if ( !iter ) {
|
|
411
409
|
throw new TypeError( "provided context has not been derived from current one" );
|
|
@@ -456,7 +454,7 @@ class Context {
|
|
|
456
454
|
} ) ) )
|
|
457
455
|
.filter( ( id, index ) => {
|
|
458
456
|
if ( !( id > 0 ) ) {
|
|
459
|
-
console.warn( `lost track of matching element #${index}/${numMatches} of type ${this.type} prior to detaching it`, String( selector ) );
|
|
457
|
+
console.warn( `lost track of matching element #${index}/${numMatches} of type ${this.type} prior to detaching it`, String( selector ) );
|
|
460
458
|
}
|
|
461
459
|
|
|
462
460
|
return id > 0;
|
|
@@ -515,9 +513,9 @@ class Context {
|
|
|
515
513
|
|
|
516
514
|
// log in browser for debugging purposes
|
|
517
515
|
await ClientFunction( () => {
|
|
518
|
-
console.debug(
|
|
519
|
-
`[contextual-gherkin] tracked ${cardinality ?? ""} ${typeOfElement} as ${alias}:`,
|
|
520
|
-
document.querySelectorAll( ids
|
|
516
|
+
console.debug( // eslint-disable-line no-console
|
|
517
|
+
`[contextual-gherkin] tracked ${cardinality ?? ""} ${typeOfElement} as ${alias}:`,
|
|
518
|
+
document.querySelectorAll( ids
|
|
521
519
|
.map( id => `[data-contextual-gherkin-id="${id}"]` )
|
|
522
520
|
.join( "," )
|
|
523
521
|
)
|
|
@@ -548,7 +546,7 @@ class Context {
|
|
|
548
546
|
const aliases = api.getAliases( normalizedSingularTypeName );
|
|
549
547
|
const pools = [];
|
|
550
548
|
|
|
551
|
-
for ( let level = this; level; level = level.parent ) {
|
|
549
|
+
for ( let level = this; level; level = level.parent ) {
|
|
552
550
|
if ( level.selectors && level.selectors !== api.config.selectors ) {
|
|
553
551
|
pools.push( level.selectors );
|
|
554
552
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cepharum/contextual-gherkin",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.7",
|
|
4
4
|
"description": "flexible step definitions for Gherkin",
|
|
5
5
|
"author": "cepharum GmbH <thomas.urban@cepharum.de>",
|
|
6
6
|
"homepage": "https://cepharum-foss.gitlab.io/contextual-gherkin/",
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@cepharum/quoting-db": "^1.2.0",
|
|
16
16
|
"pluralize": "^8.0.0",
|
|
17
|
-
"semver": "^7.
|
|
17
|
+
"semver": "^7.7.2"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"@cucumber/cucumber": "^10.9.0",
|
|
21
21
|
"@cucumber/cucumber-expressions": "^17.1.0",
|
|
22
|
-
"gherkin-testcafe": "^7.
|
|
23
|
-
"testcafe": "~3.
|
|
22
|
+
"gherkin-testcafe": "^7.4.0",
|
|
23
|
+
"testcafe": "~3.7.2"
|
|
24
24
|
}
|
|
25
25
|
}
|
package/steps/global-action.js
CHANGED
|
@@ -97,7 +97,7 @@ async function globalActionByClass( testController, cardinal, className, action,
|
|
|
97
97
|
const matches = await Api.access( testController ).find( cardinal.word );
|
|
98
98
|
|
|
99
99
|
if ( cardinal.cardinality !== "singular" ) {
|
|
100
|
-
await testController.expect( false ).eql( true, `selector is not addressing a single ${cardinal.word} ${negated ? "not " : ""}marked as ${className} to ${input == null ? action : `enter '${input}' into`}` );
|
|
100
|
+
await testController.expect( false ).eql( true, `selector is not addressing a single ${cardinal.word} ${negated ? "not " : ""}marked as ${className} to ${input == null ? action : `enter '${input}' into`}` );
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
const { query: property } = matches.getSelector( "#classList", "classList" );
|
|
@@ -183,7 +183,7 @@ async function globalActionByLabel( testController, cardinal, label, partially,
|
|
|
183
183
|
const matches = await Api.access( testController ).find( cardinal.word );
|
|
184
184
|
|
|
185
185
|
if ( cardinal.cardinality !== "singular" ) {
|
|
186
|
-
await testController.expect( false ).eql( true, `selector is not addressing a single ${cardinal.word} with ${partially ? "partial " : ""}label "${label}" to ${input == null ? action : `enter '${input}' into`}` );
|
|
186
|
+
await testController.expect( false ).eql( true, `selector is not addressing a single ${cardinal.word} with ${partially ? "partial " : ""}label "${label}" to ${input == null ? action : `enter '${input}' into`}` );
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
const refined = await matches.filterBySubsWithText( "$label", "label", label, partially );
|
|
@@ -230,7 +230,7 @@ async function globalActionByTextContent( testController, cardinal, text, partia
|
|
|
230
230
|
const matches = await Api.access( testController ).find( cardinal.word );
|
|
231
231
|
|
|
232
232
|
if ( cardinal.cardinality !== "singular" ) {
|
|
233
|
-
await testController.expect( false ).eql( true, `selector is not addressing a single ${cardinal.word} ${partially ? "partially " : ""}reading "${text}" to ${input == null ? action : `enter '${input}' into`}` );
|
|
233
|
+
await testController.expect( false ).eql( true, `selector is not addressing a single ${cardinal.word} ${partially ? "partially " : ""}reading "${text}" to ${input == null ? action : `enter '${input}' into`}` );
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
const refined = await matches.filterBySubsWithText( "$text", false, text, partially );
|