From a05d5003534f826a821d28708978dedf3b88f289 Mon Sep 17 00:00:00 2001 From: Jason Byrne Date: Tue, 23 Nov 2021 17:41:04 -0500 Subject: [PATCH] merge in approved PRs, add rename field, comment out as (pending removal) --- package.json | 2 +- src/assertioncontext.ts | 1 + src/interfaces.ts | 3 ++- src/value.ts | 9 +++++++++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index d4874bd2..3f939b68 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "flagpole", - "version": "2.6.19", + "version": "2.6.20", "description": "Simple and fast DOM integration, headless or headful browser, and REST API testing framework.", "files": [ "dist/", diff --git a/src/assertioncontext.ts b/src/assertioncontext.ts index 780f96d8..ec707722 100644 --- a/src/assertioncontext.ts +++ b/src/assertioncontext.ts @@ -604,6 +604,7 @@ export class AssertionContext implements iAssertionContext { public set(aliasName: string, value: any): iAssertionContext { this._scenario.set(aliasName, value); + return this; } diff --git a/src/interfaces.ts b/src/interfaces.ts index 0eeb4a91..9504f123 100644 --- a/src/interfaces.ts +++ b/src/interfaces.ts @@ -226,7 +226,8 @@ export interface iValue { col(key: string): iValue; groupBy(key: string): iValue; unique(): iValue; - as(aliasName: string): iValue; + //as(aliasName: string): iValue; + rename(newName: string): iValue; echo(callback: (str: string) => void): iValue; echo(): iValue; // DOM Elements only diff --git a/src/value.ts b/src/value.ts index d299c774..54c1f756 100644 --- a/src/value.ts +++ b/src/value.ts @@ -209,6 +209,13 @@ export class Value implements iValue { this._highlight = highlight; } + public rename(newName: string): iValue { + const oldName = this.name; + this._name = newName; + this._completedAction("RENAME", `${oldName} to ${newName}`); + return this; + } + public toArray(): any[] { return this.isArray() ? this._input : [this._input]; } @@ -341,10 +348,12 @@ export class Value implements iValue { return value == thisValue.$; } + /* public as(aliasName: string): iValue { this._context.scenario.set(aliasName, this); return this; } + */ public async getProperty(key: string): Promise { return this._wrapAsValue(