Skip to content

Commit

Permalink
🐛 fix: Fixed #75
Browse files Browse the repository at this point in the history
  • Loading branch information
icebob committed Sep 27, 2016
1 parent 7298080 commit f8db7b0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
3 changes: 1 addition & 2 deletions src/fields/abstractField.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export default {
},

set(newValue) {

if (isFunction(this.formatValueToModel))
newValue = this.formatValueToModel(newValue);

Expand All @@ -40,7 +39,7 @@ export default {

watch: {
value: function(newVal, oldVal) {
//console.log("Changed", newVal, oldVal);
// console.log("Changed", newVal, oldVal);
if (isFunction(this.schema.onChanged)) {
this.schema.onChanged(this.model, newVal, oldVal, this.schema);
}
Expand Down
3 changes: 1 addition & 2 deletions src/fields/fieldNoUiSlider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@
this.slider.noUiSlider.set(value);
}
},
formatValueToModel() {
formatValueToModel(val) {
if(typeof this.slider.noUiSlider !== "undefined"){
let val = this.slider.noUiSlider.get();
if (val instanceof Array) {
return [Number(val[0]), Number(val[1])];
}else{
Expand Down
12 changes: 5 additions & 7 deletions test/unit/specs/fields/fieldNoUiSlider.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,12 @@ describe("fieldNoUiSlider.vue", function() {
}
});

// FIXME: Not working in PhantomJS Left is 0%
it.skip("should contain the value", (done) => {
vm.$nextTick( () => {
it("should contain the value", (done) => {
setTimeout( () => {
let origin = input.querySelector(".noUi-origin");
expect(origin.style.left).to.be.within("70%", "90%");
done();
});
}, 100);
});

it("handle value should be the model value after changed", (done) => {
Expand All @@ -72,11 +71,10 @@ describe("fieldNoUiSlider.vue", function() {
}, 100);
});

it.skip("model value should be the handle value after changed", (done) => {
// `field.slider.noUiSlider.set(3);` - It doesn't fired the onChange event
it("model value should be the handle value after changed", (done) => {
field.onChange(3);
setTimeout( () => {
expect(vm.model.rating).to.be.equal(3);
expect(field.model.rating).to.be.equal(3);
done();
}, 100);
});
Expand Down
2 changes: 1 addition & 1 deletion test/unit/webpack.test.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var webpack = require("webpack");
var sourceDir = path.resolve(__dirname, "../../src");

module.exports = {
devtool: "#inline-source-map",
devtool: "eval-source-map",

module: {
preLoaders: [
Expand Down

0 comments on commit f8db7b0

Please sign in to comment.