From 45c9e35734741b19e89bb3f098f6673019a3504f Mon Sep 17 00:00:00 2001 From: Jeff Date: Fri, 25 Oct 2019 12:40:56 -0700 Subject: [PATCH] =?UTF-8?q?add=20`this`=20to=20all=20events=20except=20inp?= =?UTF-8?q?ut=20event=20=E2=80=93=20still=20need=20a=20solution=20for=20em?= =?UTF-8?q?itting=20input=20event?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Select.vue | 6 +++--- tests/unit/Dropdown.spec.js | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/Select.vue b/src/components/Select.vue index a80efdd..cce7374 100644 --- a/src/components/Select.vue +++ b/src/components/Select.vue @@ -390,7 +390,7 @@ newOption = {[this.label]: newOption} } - this.$emit('option:created', newOption) + this.$emit('option:created', newOption, this) return newOption } }, @@ -701,7 +701,7 @@ */ closeSearchOptions(){ this.open = false - this.$emit('search:blur') + this.$emit('search:blur', this) }, /** @@ -802,7 +802,7 @@ */ onSearchFocus() { this.open = true - this.$emit('search:focus') + this.$emit('search:focus', this) }, /** diff --git a/tests/unit/Dropdown.spec.js b/tests/unit/Dropdown.spec.js index 58b01e2..8b55562 100755 --- a/tests/unit/Dropdown.spec.js +++ b/tests/unit/Dropdown.spec.js @@ -86,7 +86,7 @@ describe("Toggling Dropdown", () => { Select.vm.onSearchBlur(); expect(Select.vm.open).toEqual(false); - expect(spy).toHaveBeenCalledWith("search:blur"); + expect(spy).toHaveBeenCalledWith("search:blur", Select.vm); }); it("will open the dropdown and emit the search:focus event from onSearchFocus", () => { @@ -96,7 +96,7 @@ describe("Toggling Dropdown", () => { Select.vm.onSearchFocus(); expect(Select.vm.open).toEqual(true); - expect(spy).toHaveBeenCalledWith("search:focus"); + expect(spy).toHaveBeenCalledWith("search:focus", Select.vm); }); it("will close the dropdown on escape, if search is empty", () => {