Skip to content

Commit

Permalink
test: basic unit testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Lionel Bijaoui committed Aug 8, 2016
1 parent dba3ed7 commit f870dae
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions test/unit/specs/fields/fieldVueMultiSelect.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { expect } from "chai";
import { createVueField } from "../util";

import Vue from "vue";
import fieldVueMultiSelect from "src/fields/fieldVueMultiSelect.vue";

Vue.component("fieldVueMultiSelect", fieldVueMultiSelect);

// eslint-disable-next-line
let el, vm, field;

function createField(schema = {}, model = null, disabled = false, options) {
[ el, vm, field ] = createVueField("fieldVueMultiSelect", schema, model, disabled, options);
}

describe("fieldVueMultiSelect.vue", () => {

describe("check template", () => {
let schema = {
type: "vueMultiSelect",
label: "Cities",
model: "city",
multiSelect: false,
required: false,
values: [
"London",
"Paris",
"Rome",
"Berlin"
]
};
let model = { city: "Paris" };
let input;

before( () => {
createField(schema, model, false);
input = el.getElementsByTagName("select")[0];
});

it("should contain a select element", () => {
expect(field).to.be.exist;
expect(field.$el).to.be.exist;

expect(input).to.be.defined;
// expect(input.classList.contains("form-control")).to.be.false;
// expect(input.disabled).to.be.false;
});
});
});

0 comments on commit f870dae

Please sign in to comment.