@featherds/autocomplete
Advanced tools
Comparing version 0.12.16 to 0.12.17
{ | ||
"name": "@featherds/autocomplete", | ||
"version": "0.12.16", | ||
"version": "0.12.17", | ||
"publishConfig": { | ||
@@ -14,10 +14,10 @@ "access": "public" | ||
"dependencies": { | ||
"@featherds/chips": "^0.12.16", | ||
"@featherds/composables": "^0.12.16", | ||
"@featherds/icon": "^0.12.16", | ||
"@featherds/input-helper": "^0.12.16", | ||
"@featherds/list": "^0.12.16", | ||
"@featherds/menu": "^0.12.16", | ||
"@featherds/styles": "^0.12.16", | ||
"@featherds/utils": "^0.12.16", | ||
"@featherds/chips": "^0.12.17", | ||
"@featherds/composables": "^0.12.17", | ||
"@featherds/icon": "^0.12.17", | ||
"@featherds/input-helper": "^0.12.17", | ||
"@featherds/list": "^0.12.17", | ||
"@featherds/menu": "^0.12.17", | ||
"@featherds/styles": "^0.12.17", | ||
"@featherds/utils": "^0.12.17", | ||
"vue": "^3.1.0-0" | ||
@@ -30,3 +30,3 @@ }, | ||
"types": "./src/index.d.ts", | ||
"gitHead": "9e47b2cea0394edefb66b61103b83c6394270a4f" | ||
"gitHead": "5671341daf41160b80b4a54dc4162c17342bc8c8" | ||
} |
@@ -896,2 +896,32 @@ import FeatherAutocomplete from "./FeatherAutocomplete.vue"; | ||
}); | ||
it("should fire single update:modelValue when clicked", async () => { | ||
const results = getResults(); | ||
const wrapper = getFullWrapper(); | ||
await wrapper | ||
.find<HTMLInputElement>(".feather-autocomplete-input") | ||
.trigger("focus"); | ||
await wrapper.setProps({ | ||
results, | ||
}); | ||
// search | ||
const query = "item"; | ||
wrapper.vm.query = query; | ||
// click the 2nd result | ||
await wrapper | ||
.findComponent({ ref: "results" }) | ||
.findAll(".result-item")[1] | ||
.trigger("click"); | ||
await wrapper.find(".feather-autocomplete-input").trigger("blur"); | ||
await wrapper.vm.$nextTick(); | ||
const events = getCalls<[IAutocompleteItemType[]]>( | ||
wrapper, | ||
"update:modelValue" | ||
); | ||
expect(events.length).toBe(1); | ||
}); | ||
it("should display the current selected value if no new selection is made", async () => { | ||
@@ -898,0 +928,0 @@ vi.useFakeTimers({ |
@@ -106,3 +106,8 @@ import { Ref } from "vue"; | ||
}, | ||
handleInputBlur() { | ||
handleInputBlur(e: FocusEvent) { | ||
const userClickedLI = !!( | ||
e.relatedTarget && | ||
(e.relatedTarget as HTMLElement).classList.contains("feather-list-item") | ||
); | ||
//select active index | ||
@@ -113,2 +118,5 @@ if (resultsRender.active.row > -1) { | ||
emit("new", item._new as string); | ||
} else if (type === "single" && userClickedLI) { | ||
// user clicked with mouse; prevent selection on blur | ||
e.preventDefault(); | ||
} else { | ||
@@ -115,0 +123,0 @@ emit("update:modelValue", item); |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
415670
4410
Updated@featherds/chips@^0.12.17
Updated@featherds/icon@^0.12.17
Updated@featherds/list@^0.12.17
Updated@featherds/menu@^0.12.17
Updated@featherds/styles@^0.12.17
Updated@featherds/utils@^0.12.17