Skip to content

Commit

Permalink
change input event to change on checlist field
Browse files Browse the repository at this point in the history
  • Loading branch information
icebob committed Mar 23, 2017
1 parent 01f0554 commit e6a2b9a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/fields/core/fieldChecklist.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
.listbox.form-control(v-if="schema.listBox", :disabled="disabled")
.list-row(v-for="item in items", :class="{'is-checked': isItemChecked(item)}")
label
input(type="checkbox", :checked="isItemChecked(item)", :disabled="disabled", @input="onChanged($event, item)")
input(type="checkbox", :checked="isItemChecked(item)", :disabled="disabled", @change="onChanged($event, item)")
| {{ getItemName(item) }}

.combobox.form-control(v-if="!schema.listBox", :disabled="disabled")
Expand All @@ -14,7 +14,7 @@
.dropList
.list-row(v-if="comboExpanded", v-for="item in items", :class="{'is-checked': isItemChecked(item)}")
label
input(type="checkbox", :checked="isItemChecked(item)", :disabled="disabled", @input="onChanged($event, item)")
input(type="checkbox", :checked="isItemChecked(item)", :disabled="disabled", @change="onChanged($event, item)")
| {{ getItemName(item) }}
</template>

Expand Down
24 changes: 12 additions & 12 deletions test/unit/specs/fields/fieldChecklist.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ describe("fieldChecklist.vue", function() {

it("model value should be the listbox value if changed", (done) => {
checkboxes[0].checked = true;
trigger(checkboxes[0], "input");
trigger(checkboxes[0], "change");

vm.$nextTick( () => {
expect(model.skills).to.be.deep.equal(["ReactJS", "HTML5"]);
Expand Down Expand Up @@ -122,7 +122,7 @@ describe("fieldChecklist.vue", function() {

it(".list-row with checked input should have a 'is-checked' class after listbox value is changed", (done) => {
checkboxes[0].checked = true;
trigger(checkboxes[0], "input");
trigger(checkboxes[0], "change");

vm.$nextTick( () => {
expect(listRowList[0].classList.contains("is-checked")).to.be.true;
Expand Down Expand Up @@ -206,7 +206,7 @@ describe("fieldChecklist.vue", function() {

it("model value should be the listbox value if changed", (done) => {
checkboxes[0].checked = true;
trigger(checkboxes[0], "input");
trigger(checkboxes[0], "change");

vm.$nextTick( () => {
expect(model.skills).to.be.deep.equal([3, 1]);
Expand Down Expand Up @@ -246,7 +246,7 @@ describe("fieldChecklist.vue", function() {

it(".list-row with checked input should have a 'is-checked' class after listbox value is changed", (done) => {
checkboxes[0].checked = true;
trigger(checkboxes[0], "input");
trigger(checkboxes[0], "change");

vm.$nextTick( () => {
expect(listRowList[0].classList.contains("is-checked")).to.be.true;
Expand Down Expand Up @@ -334,7 +334,7 @@ describe("fieldChecklist.vue", function() {

it("model value should be the listbox value if changed", (done) => {
checkboxes[0].checked = true;
trigger(checkboxes[0], "input");
trigger(checkboxes[0], "change");

vm.$nextTick( () => {
expect(model.skills).to.be.deep.equal([3, 1]);
Expand Down Expand Up @@ -374,7 +374,7 @@ describe("fieldChecklist.vue", function() {

it(".list-row with checked input should have a 'is-checked' class after listbox value is changed", (done) => {
checkboxes[0].checked = true;
trigger(checkboxes[0], "input");
trigger(checkboxes[0], "change");

vm.$nextTick( () => {
expect(listRowList[0].classList.contains("is-checked")).to.be.true;
Expand Down Expand Up @@ -456,7 +456,7 @@ describe("fieldChecklist.vue", function() {

it("model value should be the listbox value if changed", (done) => {
checkboxes[0].checked = true;
trigger(checkboxes[0], "input");
trigger(checkboxes[0], "change");

vm.$nextTick( () => {
expect(model.skills).to.be.deep.equal([3, 1]);
Expand Down Expand Up @@ -496,7 +496,7 @@ describe("fieldChecklist.vue", function() {

it(".list-row with checked input should have a 'is-checked' class after listbox value is changed", (done) => {
checkboxes[0].checked = true;
trigger(checkboxes[0], "input");
trigger(checkboxes[0], "change");

vm.$nextTick( () => {
expect(listRowList[0].classList.contains("is-checked")).to.be.true;
Expand Down Expand Up @@ -606,7 +606,7 @@ describe("fieldChecklist.vue", function() {

it("model value should be the dropList value if changed (add)", (done) => {
checkboxes[0].checked = true;
trigger(checkboxes[0], "input");
trigger(checkboxes[0], "change");

vm.$nextTick( () => {
expect(model.skills).to.be.deep.equal(["ReactJS", "HTML5"]);
Expand All @@ -617,7 +617,7 @@ describe("fieldChecklist.vue", function() {

it("model value should be the checklist value if changed (remove)", (done) => {
checkboxes[0].checked = false;
trigger(checkboxes[0], "input");
trigger(checkboxes[0], "change");

vm.$nextTick( () => {
expect(model.skills).to.be.deep.equal(["ReactJS"]);
Expand All @@ -629,7 +629,7 @@ describe("fieldChecklist.vue", function() {
it("model value should be the dropList value if changed (null)", (done) => {
model.skills = null;
checkboxes[0].checked = true;
trigger(checkboxes[0], "input");
trigger(checkboxes[0], "change");

vm.$nextTick( () => {
expect(model.skills).to.be.deep.equal(["HTML5"]);
Expand Down Expand Up @@ -672,7 +672,7 @@ describe("fieldChecklist.vue", function() {

it(".list-row with checked input should have a 'is-checked' class after listbox value is changed", (done) => {
checkboxes[0].checked = true;
trigger(checkboxes[0], "input");
trigger(checkboxes[0], "change");

vm.$nextTick( () => {
listRowList = dropList.querySelectorAll(".list-row");
Expand Down

0 comments on commit e6a2b9a

Please sign in to comment.