FIX: make sure the element exists before calling `off`

This commit fixes an issue happening only when running tests under `/qunit` and not with `rake qunit:test`
This commit is contained in:
Joffrey JAFFEUX 2017-11-21 19:08:59 +01:00 committed by GitHub
parent 7533e5b541
commit 12beb77afa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 11 deletions

View File

@ -19,18 +19,22 @@ export default Ember.Mixin.create({
.off("mousedown.select-kit")
.off("touchstart.select-kit");
if (this.$header()) {
this.$header()
.off("focus.select-kit")
.off("blur.select-kit")
.off("keypress.select-kit")
.off("keydown.select-kit");
}
if (this.$filterInput()) {
this.$filterInput()
.off("change.select-kit")
.off("keydown.select-kit")
.off("keypress.select-kit")
.off("focus.select-kit")
.off("focusin.select-kit");
}
},
didInsertElement() {