Fix broken tests

This commit is contained in:
Joffrey JAFFEUX
2017-10-19 14:32:37 -07:00
committed by GitHub
parent aad5118aa9
commit d77ef05ee1
6 changed files with 80 additions and 72 deletions

View File

@@ -10,8 +10,8 @@ export default NotificationOptionsComponent.extend({
actions: {
onSelect(value) {
value = this.defaultOnSelect(value);
this.get("category").setNotification(value);
this.blur();
}
}
});

View File

@@ -220,13 +220,13 @@ export default Ember.Component.extend(UtilsMixin, DomHelpersMixin, KeyboardMixin
@on("willDestroyElement")
_cleanHandlers() {
$(window).off(`resize.${this.elementId}`);
$(window).off("resize.select-box-kit");
this._removeFixedPosition();
},
@on("didInsertElement")
_setupResizeListener() {
$(window).on(`resize.${this.elementId}`, () => this.set("isExpanded", false) );
$(window).on("resize.select-box-kit", () => this.set("isExpanded", false) );
},
@observes("filter", "filteredContent.[]", "shouldDisplayCreateRow")
@@ -344,7 +344,7 @@ export default Ember.Component.extend(UtilsMixin, DomHelpersMixin, KeyboardMixin
const bodyHeight = this.$body().outerHeight(false);
const windowWidth = $(window).width();
const windowHeight = $(window).height();
const boundingRect = this.$()[0].getBoundingClientRect();
const boundingRect = this.get("element").getBoundingClientRect();
const offsetTop = boundingRect.top;
if (this.get("fullWidthOnMobile") && windowWidth <= 420) {

View File

@@ -10,6 +10,7 @@ export default NotificationOptionsComponent.extend({
onSelect(value) {
value = this.defaultOnSelect(value);
this.sendAction("action", value);
this.blur();
}
}
});

View File

@@ -27,40 +27,47 @@ export default Ember.Mixin.create({
willDestroyElement() {
this._super();
$(document).off(
"click.select-box-kit mousedown.select-box-kit touchstart.select-box-kit"
);
$(document)
.off("mousedown.select-box-kit")
.off("touchstart.select-box-kit");
this.$offscreenInput()
.off("focus.select-box-kit focusin.select-box-kit blur.select-box-kit keydown.select-box-kit");
.off("focus.select-box-kit")
.off("focusin.select-box-kit")
.off("blur.select-box-kit")
.off("keydown.select-box-kit");
this.$filterInput().off(`keydown.select-box-kit`);
this.$filterInput().off("keydown.select-box-kit");
},
didInsertElement() {
this._super();
$(document).on(
"click.select-box-kit mousedown.select-box-kit touchstart.select-box-kit", event => {
if (this.$()[0].contains(event.target)) { return; }
$(document)
.on("mousedown.select-box-kit, touchstart.select-box-kit", event => {
if (Ember.isNone(this.get("element"))) {
return;
}
if (this.get("element").contains(event.target)) { return; }
this.clickOutside(event);
});
this.$offscreenInput()
.on(`blur.select-box-kit`, () => {
.on("blur.select-box-kit", () => {
if (this.get("isExpanded") === false && this.get("isFocused") === true) {
this.close();
}
})
.on(`focus.select-box-kit`, (event) => {
.on("focus.select-box-kit", (event) => {
this.set("isFocused", true);
this._killEvent(event);
})
.on(`focusin.select-box-kit`, (event) => {
.on("focusin.select-box-kit", (event) => {
this.set("isFocused", true);
this._killEvent(event);
})
.on(`keydown.select-box-kit`, (event) => {
.on("keydown.select-box-kit", (event) => {
const keyCode = event.keyCode || event.which;
switch (keyCode) {
@@ -191,6 +198,6 @@ export default Ember.Mixin.create({
},
_isSpecialKey(keyCode) {
return Object.values(this.keys).includes(keyCode);
return _.values(this.keys).includes(keyCode);
},
});