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", () => {