Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@featherds/autocomplete

Package Overview
Dependencies
Maintainers
4
Versions
72
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@featherds/autocomplete - npm Package Compare versions

Comparing version 0.12.14 to 0.12.15

20

package.json
{
"name": "@featherds/autocomplete",
"version": "0.12.14",
"version": "0.12.15",
"publishConfig": {

@@ -14,10 +14,10 @@ "access": "public"

"dependencies": {
"@featherds/chips": "^0.12.14",
"@featherds/composables": "^0.12.14",
"@featherds/icon": "^0.12.14",
"@featherds/input-helper": "^0.12.14",
"@featherds/list": "^0.12.14",
"@featherds/menu": "^0.12.14",
"@featherds/styles": "^0.12.14",
"@featherds/utils": "^0.12.14",
"@featherds/chips": "^0.12.15",
"@featherds/composables": "^0.12.15",
"@featherds/icon": "^0.12.15",
"@featherds/input-helper": "^0.12.15",
"@featherds/list": "^0.12.15",
"@featherds/menu": "^0.12.15",
"@featherds/styles": "^0.12.15",
"@featherds/utils": "^0.12.15",
"vue": "^3.1.0-0"

@@ -30,3 +30,3 @@ },

"types": "./src/index.d.ts",
"gitHead": "713f26fd0f1d7a56ef93d1edd8ecf9cc163f81d4"
"gitHead": "f8ababb5d518d4e057b65f64f2c879dc5500ee98"
}
/// <reference types="webdriverio/async" />
declare class BaseAutocomplete {
protected selector: string;
get input(): import("webdriverio").ChainablePromiseElement<WebdriverIO.Element>;
get clear(): import("webdriverio").ChainablePromiseElement<WebdriverIO.Element>;
constructor(_selector: string);
protected input(): import("webdriverio").ChainablePromiseElement<WebdriverIO.Element>;
protected clear(): import("webdriverio").ChainablePromiseElement<WebdriverIO.Element>;
protected clickElement(el: WebdriverIO.Element): Promise<void>;
selectByText(text: string): Promise<string>;

@@ -15,4 +16,4 @@ selectByIndex(index: number): Promise<string>;

export declare class AutocompleteMulti extends BaseAutocomplete {
get chips(): import("webdriverio").ChainablePromiseArray<import("webdriverio").ElementArray>;
get chipsDelete(): import("webdriverio").ChainablePromiseArray<import("webdriverio").ElementArray>;
private chips;
private chipsDelete;
getValue(): Promise<string[]>;

@@ -19,0 +20,0 @@ clearChip(txt: string): Promise<void>;

@@ -6,3 +6,3 @@ "use strict";

const INPUT = "[data-ref-id='feather-autocomplete-input']";
const CLEAR = "[data-ref-id='feather-form-element-clear'] svg";
const CLEAR = "[data-ref-id='feather-form-element-clear']";
const CHIP = "[data-ref-id='feather-chip-label']";

@@ -12,18 +12,24 @@ const CHIPDELETE = "[data-ref-id='feather-autocomplete-chip-delete']";

selector;
get input() {
constructor(_selector) {
this.selector = _selector;
}
input() {
return $(this.selector).$(INPUT);
}
get clear() {
clear() {
return $(this.selector).$(CLEAR);
}
constructor(_selector) {
this.selector = _selector;
}
async selectByText(text) {
clickElement(el) {
const runInBrowser = function (argument) {
argument.click();
};
const select = await this.input;
await browser.execute(runInBrowser, select);
await $(OPTION).waitForDisplayed({ timeout: 60000 });
return browser.execute(runInBrowser, el);
}
async selectByText(text) {
const menuVisible = await $(OPTION).isDisplayed();
if (!menuVisible) {
const select = await this.input();
await this.clickElement(select);
await $(OPTION).waitForDisplayed({ timeout: 60000 });
}
const items = await $$(OPTION);

@@ -34,3 +40,3 @@ const textArray = await Promise.all(items.map((item) => item.getText()));

const result = await items[itemIndex].getText();
await items[itemIndex].click();
await this.clickElement(items[itemIndex]);
return result.trim();

@@ -45,12 +51,12 @@ }

async selectByIndex(index) {
const runInBrowser = function (argument) {
argument.click();
};
const select = await this.input;
await browser.execute(runInBrowser, select);
await $(OPTION).waitForDisplayed({ timeout: 60000 });
const menuVisible = await $(OPTION).isDisplayed();
if (!menuVisible) {
const select = await this.input();
await this.clickElement(select);
await $(OPTION).waitForDisplayed({ timeout: 60000 });
}
const item = await $$(OPTION)[index];
if (item) {
const result = await item.getText();
await item.click();
await this.clickElement(item);
return result.trim();

@@ -65,3 +71,4 @@ }

async clearValue() {
await this.clear.click();
const clearIcon = await this.clear();
return this.clickElement(clearIcon);
}

@@ -71,3 +78,3 @@ }

async getValue() {
const input = await this.input;
const input = await this.input();
return input.getValue();

@@ -78,18 +85,18 @@ }

class AutocompleteMulti extends BaseAutocomplete {
get chips() {
chips() {
return $(this.selector).$$(CHIP);
}
get chipsDelete() {
chipsDelete() {
return $(this.selector).$$(CHIPDELETE);
}
async getValue() {
const chips = await this.chips;
const chips = await this.chips();
return Promise.all(chips.map((c) => c.getText()));
}
async clearChip(txt) {
const chipsDelete = await this.chipsDelete;
const chipsDelete = await this.chipsDelete();
const values = await this.getValue();
const index = values.indexOf(txt);
if (index > -1) {
await chipsDelete[index].click();
await this.clickElement(chipsDelete[index]);
return;

@@ -96,0 +103,0 @@ }

const OPTION = ".result-item";
const INPUT = "[data-ref-id='feather-autocomplete-input']";
const CLEAR = "[data-ref-id='feather-form-element-clear'] svg";
const CLEAR = "[data-ref-id='feather-form-element-clear']";
const CHIP = "[data-ref-id='feather-chip-label']";

@@ -8,20 +8,26 @@ const CHIPDELETE = "[data-ref-id='feather-autocomplete-chip-delete']";

protected selector: string;
get input() {
constructor(_selector: string) {
this.selector = _selector;
}
protected input() {
return $(this.selector).$(INPUT);
}
get clear() {
protected clear() {
return $(this.selector).$(CLEAR);
}
constructor(_selector: string) {
this.selector = _selector;
}
async selectByText(text: string) {
protected clickElement(el: WebdriverIO.Element) {
const runInBrowser = function (argument: WebdriverIO.Element) {
argument.click();
};
const select = await this.input;
await browser.execute(runInBrowser, select);
return browser.execute(runInBrowser, el);
}
async selectByText(text: string) {
const menuVisible = await $(OPTION).isDisplayed();
if (!menuVisible) {
const select = await this.input();
await this.clickElement(select);
await $(OPTION).waitForDisplayed({ timeout: 60000 });
await $(OPTION).waitForDisplayed({ timeout: 60000 });
}

@@ -33,3 +39,3 @@ const items = await $$(OPTION);

const result = await items[itemIndex].getText();
await items[itemIndex].click();
await this.clickElement(items[itemIndex]);
return result.trim();

@@ -48,12 +54,14 @@ }

async selectByIndex(index: number) {
const runInBrowser = function (argument: WebdriverIO.Element) {
argument.click();
};
const select = await this.input;
await browser.execute(runInBrowser, select);
await $(OPTION).waitForDisplayed({ timeout: 60000 });
const menuVisible = await $(OPTION).isDisplayed();
if (!menuVisible) {
const select = await this.input();
await this.clickElement(select);
await $(OPTION).waitForDisplayed({ timeout: 60000 });
}
const item = await $$(OPTION)[index];
if (item) {
const result = await item.getText();
await item.click();
await this.clickElement(item);
return result.trim();

@@ -70,3 +78,4 @@ }

async clearValue() {
await this.clear.click();
const clearIcon = await this.clear();
return this.clickElement(clearIcon);
}

@@ -77,3 +86,3 @@ }

async getValue() {
const input = await this.input;
const input = await this.input();
return input.getValue();

@@ -84,18 +93,18 @@ }

export class AutocompleteMulti extends BaseAutocomplete {
get chips() {
private chips() {
return $(this.selector).$$(CHIP);
}
get chipsDelete() {
private chipsDelete() {
return $(this.selector).$$(CHIPDELETE);
}
async getValue() {
const chips = await this.chips;
const chips = await this.chips();
return Promise.all(chips.map((c) => c.getText()));
}
async clearChip(txt: string) {
const chipsDelete = await this.chipsDelete;
const chipsDelete = await this.chipsDelete();
const values = await this.getValue();
const index = values.indexOf(txt);
if (index > -1) {
await chipsDelete[index].click();
await this.clickElement(chipsDelete[index]);
return;

@@ -102,0 +111,0 @@ }

@@ -21,4 +21,6 @@ import { expect } from "chai";

await page.selectByIndex(0);
let val = await page.getValue();
expect(val.length).to.be.greaterThan(0);
await page.clearValue();
const val = await page.getValue();
val = await page.getValue();
expect(val.length).to.eq(0);

@@ -25,0 +27,0 @@ });

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc