Skip to content

Commit dea27a2

Browse files
author
Lionel Bijaoui
committed
test: progress on noUiSlider
1 parent 42c9ea9 commit dea27a2

File tree

1 file changed

+55
-11
lines changed

1 file changed

+55
-11
lines changed

test/unit/specs/fields/fieldNoUiSlider.spec.js

+55-11
Original file line numberDiff line numberDiff line change
@@ -36,27 +36,71 @@ describe("fieldNoUiSlider.vue", () => {
3636
expect(field.$el).to.be.exist;
3737

3838
expect(input).to.be.defined;
39-
expect(input.classList.contains("slider")).to.be.true;
39+
expect(input.classList.contains("slider")).to.be.true;
40+
expect(input.disabled).to.be.undefined;
4041
});
4142

4243
before( () => {
43-
vm.$appendTo(document.body);
44+
vm.$appendTo(document.body);
4445
});
4546

46-
it("should only test in the correct environment", (done) => {
47+
it("should contain an handle element", (done) => {
4748
if (window.noUiSlider) {
48-
// make assertions
49-
it("should contain a complex div element", (done) => {
50-
vm.$nextTick( () => {
51-
expect(input).to.be.defined;
52-
expect(input.classList.contains("noui-target")).to.be.true;
53-
done();
54-
});
49+
vm.$nextTick( () => {
50+
let handle = input.querySelectorAll(".noUi-handle");
51+
expect(handle.length).to.be.equal(1);
52+
expect(handle[0]).to.be.defined;
53+
// expect(input.classList.contains("noui-target")).to.be.true;
54+
done();
5555
});
56-
5756
} else {
5857
this.skip();
5958
}
6059
});
60+
61+
it.skip("should contain the value", (done) => {
62+
vm.$nextTick( () => {
63+
let origin = input.querySelectorAll(".noUi-origin")[0];
64+
expect(origin.style.left).to.be.within("70%", "90%");
65+
done();
66+
});
67+
});
68+
69+
before( () => {
70+
vm.model = { rating: 10 };
71+
});
72+
73+
it("handle value should be the model value after changed", (done) => {
74+
vm.$nextTick( () => {
75+
let origin = input.querySelectorAll(".noUi-origin")[0];
76+
expect(origin.style.left).to.be.equal("100%");
77+
done();
78+
});
79+
});
80+
81+
// before( (done) => {
82+
// input.querySelectorAll(".noUi-origin")[0].style.left = "0%";
83+
// vm.$nextTick( () => {
84+
// done();
85+
// });
86+
// });
87+
88+
it.skip("model value should be the handle value after changed", (done) => {
89+
vm.$nextTick( () => {
90+
expect(vm.model.rating).to.be.equal("0");
91+
done();
92+
});
93+
});
94+
95+
it.skip("should set disabled", (done) => {
96+
console.log(field.disabled);
97+
console.log(input);
98+
vm.schema.disabled = true;
99+
vm.$nextTick( () => {
100+
console.log(input);
101+
expect(input.disabled).to.be.true;
102+
done();
103+
});
104+
});
61105
});
62106
});

0 commit comments

Comments
 (0)