Skip to content

Commit

Permalink
Replace setValue and nextTick with initialValue
Browse files Browse the repository at this point in the history
  • Loading branch information
DannyFeliz committed Jan 18, 2020
1 parent 3bdd3b2 commit 11bdf1a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions tests/unit/email-dropdown.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,26 +97,24 @@ describe("EmailDropdown.vue", () => {
});

it("clears the email field when the x is clicked", async () => {
propsData.initialValue = "hello";
propsData.clearable = true;
const wrapper = shallowMount(EmailDropdown, {
propsData
});

wrapper.find("input").setValue("hello");
await Vue.nextTick();
wrapper.find("button").trigger("click");
await Vue.nextTick();
expect(wrapper.vm.$data.email).to.be.empty;
});

it("hides the x if the input not clearable", async () => {
propsData.initialValue = "hello";
propsData.clearable = false;
const wrapper = shallowMount(EmailDropdown, {
propsData
});

wrapper.find("input").setValue("hello");
await Vue.nextTick();
expect(wrapper.find("button").exists()).to.be.false;
});

Expand Down

0 comments on commit 11bdf1a

Please sign in to comment.