Skip to content

Commit

Permalink
test: improve testing of VueMultiSelect
Browse files Browse the repository at this point in the history
  • Loading branch information
Lionel Bijaoui committed Aug 24, 2016
1 parent 4c7c717 commit 09a41f0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/unit/specs/fields/fieldVueMultiSelect.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ describe("fieldVueMultiSelect.vue", () => {
});

it("should contain option elements", () => {
let options = input.querySelectorAll("li.multiselect__option");
console.log(options);
let options = input.querySelectorAll("li.multiselect__option");
expect(options.length).to.be.equal(schema.values.length);
expect(options[1].querySelector("span").textContent).to.be.equal("Paris");
expect(options[1].classList.contains("multiselect__option--selected")).to.be.true;
Expand All @@ -68,6 +67,7 @@ describe("fieldVueMultiSelect.vue", () => {
it("input value should be the model value after changed", (done) => {
model.city = "Rome";
vm.$nextTick( () => {
expect(input.querySelectorAll("li.multiselect__option--selected").length).to.be.equal(1);
let options = input.querySelectorAll("li.multiselect__option");
expect(options[2].querySelector("span").textContent).to.be.equal("Rome");
expect(options[2].classList.contains("multiselect__option--selected")).to.be.true;
Expand All @@ -78,6 +78,7 @@ describe("fieldVueMultiSelect.vue", () => {
it("input value should be the model value after changed (multiselection)", (done) => {
model.city = ["Paris","Rome"];
vm.$nextTick( () => {
expect(input.querySelectorAll("li.multiselect__option--selected").length).to.be.equal(2);
let options = input.querySelectorAll("li.multiselect__option");
expect(options[1].querySelector("span").textContent).to.be.equal("Paris");
expect(options[1].classList.contains("multiselect__option--selected")).to.be.true;
Expand All @@ -92,6 +93,7 @@ describe("fieldVueMultiSelect.vue", () => {
trigger(options[2], "mousedown");

vm.$nextTick( () => {
expect(model.city.length).to.be.equal(1);
expect(model.city[0]).to.be.equal("Paris");
done();
});
Expand Down

0 comments on commit 09a41f0

Please sign in to comment.