Skip to content

Commit

Permalink
add step attribute to number field #92
Browse files Browse the repository at this point in the history
  • Loading branch information
icebob committed Nov 3, 2016
1 parent 475eb91 commit ce64c4e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/fields/fieldNumber.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template lang="jade">
input.form-control(type="number", v-model="value", number, :autocomplete="schema.autocomplete", :disabled="disabled", :max="schema.max", :min="schema.min", :placeholder="schema.placeholder", :readonly="schema.readonly", :name="schema.inputName")
input.form-control(type="number", v-model="value", number, :autocomplete="schema.autocomplete", :disabled="disabled", :max="schema.max", :min="schema.min", :step="schema.step", :placeholder="schema.placeholder", :readonly="schema.readonly", :name="schema.inputName")
</template>

<script>
Expand Down
10 changes: 10 additions & 0 deletions test/unit/specs/fields/fieldNumber.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ describe("fieldNumber.vue", function() {
});
});

it("check step attribute", (done) => {
vm.$set("schema.step", 0.1);
vm.$nextTick(() => {
expect(input.step).to.be.equal("0.1");
vm.$set("schema.step", null);
done();
});
});

it("input value should be the model value after changed", (done) => {
model.age = 35;
vm.$nextTick( () => {
Expand All @@ -75,6 +84,7 @@ describe("fieldNumber.vue", function() {

vm.$nextTick( () => {
expect(model.age).to.be.equal(50);
expect(model.age).to.be.a("number");
done();
});

Expand Down

0 comments on commit ce64c4e

Please sign in to comment.