diff --git a/demos/combo/keyboard-navigation.html b/demos/combo/keyboard-navigation.html index e2838d581..f9d209061 100644 --- a/demos/combo/keyboard-navigation.html +++ b/demos/combo/keyboard-navigation.html @@ -126,7 +126,7 @@

World's 10 Highest Mountain Peaks

$("#combo").igCombo("clearInput"); $("#combo").igCombo("closeDropDown"); $('#tooltip').tooltip('open'); - $(".ui-igcombo-field").focus(); + $(".ui-igcombo-field").trigger("focus"); } function showMessage(message) { diff --git a/demos/html-editor/api-and-events.html b/demos/html-editor/api-and-events.html index fdadc055d..b4b0715a8 100644 --- a/demos/html-editor/api-and-events.html +++ b/demos/html-editor/api-and-events.html @@ -164,13 +164,13 @@ focusAndPrintType = "object" } if (typeof document.getElementById("htmlEditor_editor").focus === focusAndPrintType) { - document.getElementById("htmlEditor_editor").focus(); + document.getElementById("htmlEditor_editor").trigger("focus"); } if (typeof document.getElementById("htmlEditor_editor").print === focusAndPrintType) { document.getElementById("htmlEditor_editor").print(); } if (typeof document.getElementById("htmlEditor_editor").contentWindow.focus === focusAndPrintType) { - document.getElementById("htmlEditor_editor").contentWindow.focus(); + document.getElementById("htmlEditor_editor").contentWindow.trigger("focus"); } if (typeof document.getElementById("htmlEditor_editor").contentWindow.print === focusAndPrintType) { document.getElementById("htmlEditor_editor").contentWindow.print(); diff --git a/demos/tree/api-and-events.html b/demos/tree/api-and-events.html index fb40e2f88..617a8b2ec 100644 --- a/demos/tree/api-and-events.html +++ b/demos/tree/api-and-events.html @@ -134,7 +134,7 @@ function focusOnMobile() { setTimeout(function () { if ($(window).width() < 600) { - $(".api-viewer").focus(); + $(".api-viewer").trigger("focus"); } }, 0); } diff --git a/demos/tree/bind-tree-with-ko.html b/demos/tree/bind-tree-with-ko.html index 124133e6b..2b380b410 100644 --- a/demos/tree/bind-tree-with-ko.html +++ b/demos/tree/bind-tree-with-ko.html @@ -101,13 +101,13 @@ viewModel.SetSelected(parentNode.data); setTimeout(function () { if ($(window).width() < 600) { - $("#productEditorsContainer").focus(); + $("#productEditorsContainer").trigger("focus"); } }, 0); } else { setTimeout(function () { if ($(window).width() < 600) { - $("#categoryEditorsContainer").focus(); + $("#categoryEditorsContainer").trigger("focus"); } }, 0); } diff --git a/src/js/modules/infragistics.datasource.js b/src/js/modules/infragistics.datasource.js index 3782fb249..a5e98b190 100644 --- a/src/js/modules/infragistics.datasource.js +++ b/src/js/modules/infragistics.datasource.js @@ -2564,7 +2564,7 @@ var i, data = ds || this._data, len = data ? data.length : 0, - search = len > 0 && $.isArray(data[ 0 ]) ? this._lookupPkIndex() : this.settings.primaryKey; + search = len > 0 && Array.isArray(data[ 0 ]) ? this._lookupPkIndex() : this.settings.primaryKey; for (i = 0; i < len; i++) { if (data[ i ][ search ] === key) { return data[ i ]; @@ -2622,7 +2622,7 @@ while (count < all.length) { data = all[ count++ ]; len = data ? data.length : 0; - search = len > 0 && $.isArray(data[ 0 ]) ? primeIdx : prime; + search = len > 0 && Array.isArray(data[ 0 ]) ? primeIdx : prime; for (i = 0; i < len; i++) { if (data[ i ] && data[ i ][ search ] === key) { //A.T. 8 March 2012 - Fix for bug #104244 @@ -9902,7 +9902,7 @@ return []; } if ($.ig.util.getType(dataRow) === "object") { - search = data && $.isArray(data[ 0 ]) ? this._lookupPkIndex() : this.settings.primaryKey; + search = data && Array.isArray(data[ 0 ]) ? this._lookupPkIndex() : this.settings.primaryKey; key = dataRow[ search ]; if (key === undefined || key === null) { return []; @@ -11437,7 +11437,7 @@ } var data = this._data, resRecord, search, key, objPath = { path: "" }, path, len = data ? data.length : 0; - search = len > 0 && $.isArray(data[ 0 ]) ? this._lookupPkIndex() : this.settings.primaryKey; + search = len > 0 && Array.isArray(data[ 0 ]) ? this._lookupPkIndex() : this.settings.primaryKey; if ($.ig.util.getType(record) !== "object") { key = record; } else { @@ -11487,7 +11487,7 @@ data = ds || this._data, len = data ? data.length : 0, dsLayoutKey = this.settings.treeDS.childDataKey, - search = len > 0 && $.isArray(data[ 0 ]) ? this._lookupPkIndex() : this.settings.primaryKey; + search = len > 0 && Array.isArray(data[ 0 ]) ? this._lookupPkIndex() : this.settings.primaryKey; objPath = objPath || { path: "", parentRows: [] }; objPath.parentRows = objPath.parentRows || []; objPath.path = objPath.path || ""; @@ -11555,12 +11555,12 @@ } }, _removeRecordInFlatDs: function (data, key, fk) { - if (!data || !$.isArray(data) || !data.length || + if (!data || !Array.isArray(data) || !data.length || (key === undefined && fk === undefined)) { return; } var i, prime = this.settings.primaryKey, tmp, - pkSearch = $.isArray(data[ 0 ]) ? this._lookupPkIndex() : prime, + pkSearch = Array.isArray(data[ 0 ]) ? this._lookupPkIndex() : prime, fkSearch = this.settings.treeDS.foreignKey; for (i = 0; i < data.length; i++) { if (data[ i ]) { @@ -11583,7 +11583,7 @@ } var i, prime = this.settings.primaryKey, len = data ? data.length : 0, - search = len > 0 && $.isArray(data[ 0 ]) ? this._lookupPkIndex() : prime, + search = len > 0 && Array.isArray(data[ 0 ]) ? this._lookupPkIndex() : prime, layoutKey = this.settings.treeDS.childDataKey, layoutData = [], found = false; diff --git a/src/js/modules/infragistics.ui.combo.js b/src/js/modules/infragistics.ui.combo.js index 797832a61..b26ea6206 100644 --- a/src/js/modules/infragistics.ui.combo.js +++ b/src/js/modules/infragistics.ui.combo.js @@ -1676,7 +1676,7 @@ lod = options.loadOnDemandSettings; if (this.options.dataSource) { - if ($.isArray(this.options.dataSource)) { + if (Array.isArray(this.options.dataSource)) { firstDataItem = this.options.dataSource[ 0 ]; } else if (this.options.dataSource && typeof this.options.dataSource._xmlToArray === "function" && @@ -2983,7 +2983,7 @@ $(input).is(":visible") && !readonly) { range = input.createTextRange(); range.collapse(false); - range.select(); + range.trigger("select"); } // Reapply readonly attribute @@ -3480,7 +3480,7 @@ selRange.collapse(true); selRange.moveStart("character", start); selRange.moveEnd("character", end); - selRange.select(); + selRange.trigger("select"); field.focus(); } else if (field.setSelectionRange) { field.focus(); @@ -4126,8 +4126,8 @@ } else { // Trigger focus handler to reset the flags - // $().focus() is not recommended when input is not focused, because it triggers focus handler twice in IE - $input.focus(); + // $().trigger("focus") is not recommended when input is not focused, because it triggers focus handler twice in IE + $input.trigger("focus"); } }, _windowResize: function () { diff --git a/src/js/modules/infragistics.ui.dialog.js b/src/js/modules/infragistics.ui.dialog.js index 92170174e..1ced69098 100644 --- a/src/js/modules/infragistics.ui.dialog.js +++ b/src/js/modules/infragistics.ui.dialog.js @@ -79,7 +79,7 @@ return elem && src && (elem.has(src).length > 0 || elem[ 0 ] === src); }, _notab = function (elem) { - return elem.attr("zIndex", -1).css("outline", 0).attr("unselectable", "on"); + return elem.attr("zIndex", -1).css("outline", "none").attr("unselectable", "on"); }, _toPx = function (elem, css) { @@ -1030,8 +1030,8 @@ elem0 = $("
"); this.element.contents().appendTo(elem0); el = elem = this.element; - elem.css({ zIndex: o.zIndex || 1000, outline: 0 }).attr("tabIndex", o.tabIndex) - .keydown(function (e) { + elem.css({ zIndex: o.zIndex || 1000, outline: "none" }).attr("tabIndex", o.tabIndex) + .on("keydown", function (e) { if (o.closeOnEscape && e.keyCode === $.ui.keyCode.ESCAPE) { self.close(e); e.preventDefault(); @@ -1103,7 +1103,7 @@ try { el.focus(); } catch (ex) { } } }) - .mousedown(function (e) { self.moveToTop(e); }); + .on("mousedown", function (e) { self.moveToTop(e); }); el.addClass(css.dialog); if (o.dialogClass) { el.addClass(o.dialogClass); @@ -1602,7 +1602,7 @@ } delete self._minHW; header = self._header = _notab($("
").addClass(css.header).css("display", "block") - .prependTo(self.element)).dblclick(function (e) { + .prependTo(self.element)).on("dblclick", function (e) { var dbl = o.enableDblclick; if (!dbl) { return; @@ -2621,7 +2621,7 @@ self._modalDiv = div = _notab($("
").css({ position: "fixed", left: 0, top: 0, bottom: 0, right: 0, zIndex: _maxZ - 1 }) - .addClass(self.css.overlay).mousedown(function (e) { + .addClass(self.css.overlay).on("mousedown", function (e) { self._setFocus(); _stopEvt(e); }) diff --git a/src/js/modules/infragistics.ui.editors.js b/src/js/modules/infragistics.ui.editors.js index f0a9de345..e5f66086b 100644 --- a/src/js/modules/infragistics.ui.editors.js +++ b/src/js/modules/infragistics.ui.editors.js @@ -1061,7 +1061,7 @@ _setBlur: function (event) { //Base Editor var newValue; if (this._cancelBlurOnInput) { - this._editorInput.focus(); + this._editorInput.trigger("focus"); delete this._cancelBlurOnInput; } else { this._triggerBlur(event); @@ -3559,7 +3559,7 @@ // Proceed with hiding // D.P. 21 Jun 2016 Bug 220712: igTextEditor - typed text is reverted to previous value in case the drop down is opened if (!this._editMode && !this.options.suppressKeyboard) { - this._editorInput.focus(); + this._editorInput.trigger("focus"); } if (this._editMode && this.options.suppressKeyboard) { this._editorInput.blur(); @@ -3640,7 +3640,7 @@ range.collapse(true); range.moveEnd("character", selectionEnd); range.moveStart("character", selectionStart); - range.select(); + range.trigger("select"); } }, _positionCursor: function (startPosition, endPosition) { @@ -3660,7 +3660,7 @@ currentValue.length); }, 100)); } else { - this._editorInput.select(); + this._editorInput.trigger("select"); } } break; @@ -3718,7 +3718,7 @@ currentValue.length); }, 100)); } else { - this._editorInput.select(); + this._editorInput.trigger("select"); } } } @@ -3727,7 +3727,7 @@ break; } } else { - this._editorInput.select(); + this._editorInput.trigger("select"); } }, _carryOverNewLine: function(value) { @@ -3758,7 +3758,7 @@ if (this._editMode) { this._editorInput.val(nextItem.text()); this._processTextChanged(); - this._editorInput.select(); + this._editorInput.trigger("select"); } else { this._processValueChanging(nextItem.text()); this._editorInput.val(this._getDisplayValue()); @@ -5828,7 +5828,7 @@ } else { this._spinUp(); if (this._focused) { - this._editorInput.select(); + this._editorInput.trigger("select"); } } }, @@ -5839,7 +5839,7 @@ } else { this._spinDown(); if (this._focused) { - this._editorInput.select(); + this._editorInput.trigger("select"); } } }, @@ -7381,7 +7381,7 @@ } if (result === false && this._editSelectAllStarted) { this._editorInput.val(this._editorValueBeforeClear); - this._editorInput.select(); + this._editorInput.trigger("select"); delete this._editSelectAllStarted; delete this._editorValueBeforeClear; } @@ -8911,7 +8911,7 @@ _setBlur: function (event) { //DateEditor var newValue, oldVal, convertedDate; if (this._cancelBlurOnInput) { - this._editorInput.focus(); + this._editorInput.trigger("focus"); delete this._cancelBlurOnInput; } else { this._triggerBlur(event); @@ -11080,7 +11080,7 @@ } else { self._focused = false; if (!self.options.suppressKeyboard) { - self._editorInput.focus(); + self._editorInput.trigger("focus"); } } }, @@ -12109,12 +12109,12 @@ if (delay) { this._timeouts.push(setTimeout(function () { self._cancelFocusTrigger = true; - self._editorContainer.focus(); + self._editorContainer.trigger("focus"); self._setFocus(); }, delay)); } else { this._cancelFocusTrigger = true; - this._editorContainer.focus(); + this._editorContainer.trigger("focus"); this._setFocus(); } }, diff --git a/src/js/modules/infragistics.ui.htmleditor.js b/src/js/modules/infragistics.ui.htmleditor.js index 24e9fac26..bf9742ab2 100644 --- a/src/js/modules/infragistics.ui.htmleditor.js +++ b/src/js/modules/infragistics.ui.htmleditor.js @@ -2379,8 +2379,8 @@ // D.A. 25th November 2013, Bug #158403 ExecuteAction method ignores the current selection. // The select() call resets the selection. - //this._selectionWrapperSaved.focus(); - //this._selectionWrapperSaved.select(); + //this._selectionWrapperSaved.trigger("focus"); + //this._selectionWrapperSaved.trigger("select"); this._selectionWrapperSaved.execCommand(actionName.toLowerCase(), args); this._onSelectionChange(); }, @@ -2761,7 +2761,7 @@ } }); this.element.on("igpopovershown", function () { - self.poContent.find("#" + self._id("_linkHref")).focus(); + self.poContent.find("#" + self._id("_linkHref")).trigger("focus"); }); }, _createForm: function () { diff --git a/src/js/modules/infragistics.ui.layoutmanager.js b/src/js/modules/infragistics.ui.layoutmanager.js index 61f74a0fd..4c68cf49f 100644 --- a/src/js/modules/infragistics.ui.layoutmanager.js +++ b/src/js/modules/infragistics.ui.layoutmanager.js @@ -1125,7 +1125,7 @@ gl.columnWidth = analyzedColumnWidth.columnWidth; gl.columnWidthRatio = analyzedColumnWidth.columnWidthRatio; gl.columnWidthHasAsterisk = analyzedColumnWidth.columnWidthHasAsterisk; - } else if ($.isArray(columnWidth)) { + } else if (Array.isArray(columnWidth)) { gl.columnWidthRatio = []; gl.columnWidthHasAsterisk = []; @@ -1190,7 +1190,7 @@ gl.columnHeight = analyzedColumnHeight.columnHeight; gl.columnHeightRatio = analyzedColumnHeight.columnHeightRatio; gl.columnHeightHasAsterisk = analyzedColumnHeight.columnHeightHasAsterisk; - } else if ($.isArray(columnHeight)) { + } else if (Array.isArray(columnHeight)) { gl.columnHeightRatio = []; gl.columnHeightHasAsterisk = []; @@ -1274,10 +1274,10 @@ itemsLength = this.options.items.length, isColumnWidthNumber = gl.columnWidth && typeof gl.columnWidth === "number" && gl.columnWidth > 0, - isColumnWidthArray = gl.columnWidth && $.isArray(gl.columnWidth), + isColumnWidthArray = gl.columnWidth && Array.isArray(gl.columnWidth), isColumnHeightNumber = gl.columnHeight && typeof gl.columnHeight === "number" && gl.columnHeight > 0, - isColumnHeightArray = gl.columnHeight && $.isArray(gl.columnHeight), + isColumnHeightArray = gl.columnHeight && Array.isArray(gl.columnHeight), colsOption = false, rowsOption = false; @@ -1337,11 +1337,11 @@ elHeight = this.element.height(), hasColumnWidth = (typeof gl.columnWidth === "number" && gl.columnWidth > 0) || (gl.columnWidth === "*") || - (gl.columnWidth && $.isArray(gl.columnWidth) && + (gl.columnWidth && Array.isArray(gl.columnWidth) && this._isColumnsWidthOrHeightValid(gl.columnWidth)), hasColumnHeight = (typeof gl.columnHeight === "number" && gl.columnHeight > 0) || (gl.columnHeight === "*") || - (gl.columnHeight && $.isArray(gl.columnHeight) && + (gl.columnHeight && Array.isArray(gl.columnHeight) && this._isColumnsWidthOrHeightValid(gl.columnHeight)); // When columnWidth is not given. Consider it is set in percent and calculate it from number of cols. @@ -1381,7 +1381,7 @@ widthForAsterisks, widthPerAsterisk, updated = false; - if ($.isArray(gl.columnWidthHasAsterisk)) { + if (Array.isArray(gl.columnWidthHasAsterisk)) { for (i = 0; i < gl.columnWidth.length; i++) { if (gl.columnWidthHasAsterisk[ i ]) { asterisksCount++; @@ -1418,7 +1418,7 @@ heightForAsterisks, heightPerAsterisk, updated = false; - if ($.isArray(gl.columnHeightHasAsterisk)) { + if (Array.isArray(gl.columnHeightHasAsterisk)) { for (i = 0; i < gl.columnHeight.length; i++) { if (gl.columnHeightHasAsterisk[ i ]) { asterisksCount++; @@ -1447,9 +1447,9 @@ _analyzeGlAutoAdjust: function (hasColsOptionInitially, hasRowsOptionInitially) { var gl = this._opt.gridLayout, hasColumnWidth = (typeof gl.columnWidth === "number" && - gl.columnWidth > 0) || ($.isArray(gl.columnWidth)), + gl.columnWidth > 0) || (Array.isArray(gl.columnWidth)), hasColumnHeight = (typeof gl.columnHeight === "number" && - gl.columnHeight > 0) || ($.isArray(gl.columnHeight)); + gl.columnHeight > 0) || (Array.isArray(gl.columnHeight)); // Adjust the columnHeight automatically based on the container's height when no options // specifying the columnHeight were provided in the configuration (as columnHeight, cols, items). @@ -1473,7 +1473,7 @@ _hasGlColumnWidthRatio: function () { var gl = this._opt.gridLayout, i; - if ($.isArray(gl.columnWidthRatio)) { + if (Array.isArray(gl.columnWidthRatio)) { for (i = 0; i < gl.columnWidthRatio.length; i++) { if (gl.columnWidthRatio[ i ]) { return true; @@ -1491,7 +1491,7 @@ _hasGlColumnHeightRatio: function () { var gl = this._opt.gridLayout, i; - if ($.isArray(gl.columnHeightRatio)) { + if (Array.isArray(gl.columnHeightRatio)) { for (i = 0; i < gl.columnHeightRatio.length; i++) { if (gl.columnHeightRatio[ i ]) { return true; @@ -1508,7 +1508,7 @@ _hasGlColumnWidthAsterisks: function () { var gl = this._opt.gridLayout, i; - if ($.isArray(gl.columnWidthHasAsterisk)) { + if (Array.isArray(gl.columnWidthHasAsterisk)) { for (i = 0; i < gl.columnWidthHasAsterisk.length; i++) { if (gl.columnWidthHasAsterisk[ i ]) { return true; @@ -1525,7 +1525,7 @@ _hasGlColumnHeightAsterisks: function () { var gl = this._opt.gridLayout, i; - if ($.isArray(gl.columnHeightHasAsterisk)) { + if (Array.isArray(gl.columnHeightHasAsterisk)) { for (i = 0; i < gl.columnHeightHasAsterisk.length; i++) { if (gl.columnHeightHasAsterisk[ i ]) { return true; @@ -1663,11 +1663,11 @@ gl = this._opt.gridLayout, ml = gl.marginLeft, mt = gl.marginTop, - colWidth = $.isArray(gl.columnWidth) ? null : gl.columnWidth, - colsWidthMatrix = $.isArray(gl.columnWidth) ? + colWidth = Array.isArray(gl.columnWidth) ? null : gl.columnWidth, + colsWidthMatrix = Array.isArray(gl.columnWidth) ? this._calculateColumnsWidthOrHeightMatrix(gl.columnWidth) : null, - colHeight = $.isArray(gl.columnHeight) ? null : gl.columnHeight, - colsHeightMatrix = $.isArray(gl.columnHeight) ? + colHeight = Array.isArray(gl.columnHeight) ? null : gl.columnHeight, + colsHeightMatrix = Array.isArray(gl.columnHeight) ? this._calculateColumnsWidthOrHeightMatrix(gl.columnHeight) : null, offset = e.igOffset(), $children = e.children(); @@ -1863,11 +1863,11 @@ mt = gl.marginTop, rows = gl.rows, cols = gl.cols, - colWidth = $.isArray(gl.columnWidth) ? null : gl.columnWidth, - colsWidthMatrix = $.isArray(gl.columnWidth) ? + colWidth = Array.isArray(gl.columnWidth) ? null : gl.columnWidth, + colsWidthMatrix = Array.isArray(gl.columnWidth) ? this._calculateColumnsWidthOrHeightMatrix(gl.columnWidth) : null, - colHeight = $.isArray(gl.columnHeight) ? null : gl.columnHeight, - colsHeightMatrix = $.isArray(gl.columnHeight) ? + colHeight = Array.isArray(gl.columnHeight) ? null : gl.columnHeight, + colsHeightMatrix = Array.isArray(gl.columnHeight) ? this._calculateColumnsWidthOrHeightMatrix(gl.columnHeight) : null, offset = e.igOffset(); @@ -1997,7 +1997,7 @@ // Reflow is needed when vertical scrollbar appeared or disappeared and columnWidth // is in percent or is fixed and enough space for new column is available. - colsCouldBeAdjusted = gl.columnWidth && !$.isArray(gl.columnWidth) && (gl.cols !== + colsCouldBeAdjusted = gl.columnWidth && !Array.isArray(gl.columnWidth) && (gl.cols !== Math.floor(newContainerWidthNoScroll / (gl.columnWidth + gl.marginLeft))); reflowNeeded = (gl.containerWidthNoScroll !== newContainerWidthNoScroll && (this._hasGlColumnWidthRatio() || this._hasGlColumnWidthAsterisks() || @@ -2082,9 +2082,9 @@ // Rearrange items if (gl.rearrangeItems || forceReflow) { if (gl.rearrangeItems) { - if (gl.columnWidthRatio && !$.isArray(gl.columnWidthRatio)) { + if (gl.columnWidthRatio && !Array.isArray(gl.columnWidthRatio)) { newColCount = Math.floor(1 / gl.columnWidthRatio); - } else if (gl.columnWidth && !$.isArray(gl.columnWidth)) { + } else if (gl.columnWidth && !Array.isArray(gl.columnWidth)) { newColCount = Math.floor(newContainerWidthNoScroll / (gl.columnWidth + ml)); @@ -2094,7 +2094,7 @@ newColCount = gl.cols; } - if (newColCount !== gl.cols && $.isArray(gl.columnHeight)) { + if (newColCount !== gl.cols && Array.isArray(gl.columnHeight)) { if (Math.ceil(items.length / newColCount) !== gl.columnHeight.length) { newColCount = gl.cols; @@ -2220,11 +2220,11 @@ // Adjust the items size and position if ((colWidthChanged || colHeightChanged || positionsChanged) || forceReflow) { - colWidth = $.isArray(gl.columnWidth) ? null : gl.columnWidth; - colsWidthMatrix = $.isArray(gl.columnWidth) ? + colWidth = Array.isArray(gl.columnWidth) ? null : gl.columnWidth; + colsWidthMatrix = Array.isArray(gl.columnWidth) ? this._calculateColumnsWidthOrHeightMatrix(gl.columnWidth) : null; - colHeight = $.isArray(gl.columnHeight) ? null : gl.columnHeight; - colsHeightMatrix = $.isArray(gl.columnHeight) ? + colHeight = Array.isArray(gl.columnHeight) ? null : gl.columnHeight; + colsHeightMatrix = Array.isArray(gl.columnHeight) ? this._calculateColumnsWidthOrHeightMatrix(gl.columnHeight) : null; gl.animating = (positionsChanged && animationDuration > 0) || gl.animating; @@ -2311,7 +2311,7 @@ columnWidthUpdated = false, i; - if ($.isArray(gl.columnWidthRatio)) { + if (Array.isArray(gl.columnWidthRatio)) { for (i = 0; i < gl.columnWidthRatio.length; i++) { if (gl.columnWidthRatio[ i ]) { gl.columnWidth[ i ] = Math.floor( @@ -2334,7 +2334,7 @@ columnHeightUpdated = false, i; - if ($.isArray(gl.columnHeightRatio)) { + if (Array.isArray(gl.columnHeightRatio)) { for (i = 0; i < gl.columnHeightRatio.length; i++) { if (gl.columnHeightRatio[ i ]) { gl.columnHeight[ i ] = Math.floor( diff --git a/src/js/modules/infragistics.ui.popover.js b/src/js/modules/infragistics.ui.popover.js index 8133900ca..4f26cf544 100644 --- a/src/js/modules/infragistics.ui.popover.js +++ b/src/js/modules/infragistics.ui.popover.js @@ -789,7 +789,7 @@ $(t).data("onFocus", false); } else { this._openPopover($(t)); - $(t).focus(); + $(t).trigger("focus"); $(t).data("onFocus", true); } }, @@ -804,7 +804,7 @@ $(t).data("onFocus", false); } }/* else { - $(t).focus(); + $(t).trigger("focus"); }*/ }, 10); }, @@ -1178,7 +1178,7 @@ }, _normalizePriority: function (priority) { var dp = [ "bottom", "top", "right", "left" ], np = [], i; - if (!$.isArray(priority)) { + if (!Array.isArray(priority)) { return dp; } for (i = 0; i < priority.length; i++) { diff --git a/src/js/modules/infragistics.ui.rating.js b/src/js/modules/infragistics.ui.rating.js index 302d6e8e1..3624c9347 100644 --- a/src/js/modules/infragistics.ui.rating.js +++ b/src/js/modules/infragistics.ui.rating.js @@ -438,7 +438,7 @@ padding: "0px", zIndex: -1, border: "0px", - outline: 0 + outline: "none" }; me._foc = $("").css(v).appendTo(cont).focus(function (evt) { if (o.disabled || me._fcs) { @@ -472,7 +472,7 @@ if (me._validator) { me._validator._validateInternal(me.element, e, true); } - }).keydown(function (evt) { + }).on("keydown", function (evt) { var old, arrow = 0, k = evt.keyCode, diff --git a/src/js/modules/infragistics.ui.shared.js b/src/js/modules/infragistics.ui.shared.js index 136b52693..0f8f2702a 100644 --- a/src/js/modules/infragistics.ui.shared.js +++ b/src/js/modules/infragistics.ui.shared.js @@ -496,7 +496,7 @@ handle.addClass("ui-state-active"); if (!$.ig.util.isOpera) { - handle.focus(); + handle.trigger("focus"); } offset = handle.offset(); diff --git a/src/js/modules/infragistics.ui.splitbutton.js b/src/js/modules/infragistics.ui.splitbutton.js index 54ddbb955..3d3473e56 100644 --- a/src/js/modules/infragistics.ui.splitbutton.js +++ b/src/js/modules/infragistics.ui.splitbutton.js @@ -283,7 +283,7 @@ // already focused and the inner span is clicked if (!_options.expandButton.is(":focus")) { if (!_options.isExpanded) { - _options.expandButton.focus(); + _options.expandButton.trigger("focus"); } return; } @@ -503,7 +503,7 @@ self._triggerExpanded(e); } else if (!expandButton.is(":focus")) { // Focus the expandButton when called as API method - expandButton.focus(); + expandButton.trigger("focus"); } }); }, diff --git a/src/js/modules/infragistics.ui.splitter.js b/src/js/modules/infragistics.ui.splitter.js index 02b876941..86f7016a1 100644 --- a/src/js/modules/infragistics.ui.splitter.js +++ b/src/js/modules/infragistics.ui.splitter.js @@ -1117,7 +1117,7 @@ return; } - splitter._splitter.bar.focus(); + splitter._splitter.bar.trigger("focus"); splitter._resizeArea = splitter._splitter; if (splitter._resizeArea !== null) { if ((splitter._resizeArea.left.options.resizable === undefined || diff --git a/src/js/modules/infragistics.ui.tilemanager.js b/src/js/modules/infragistics.ui.tilemanager.js index 52e0452d2..f369b36cd 100644 --- a/src/js/modules/infragistics.ui.tilemanager.js +++ b/src/js/modules/infragistics.ui.tilemanager.js @@ -1870,7 +1870,7 @@ if (rightPanelTilesWidth) { return rightPanelTilesWidth; - } else if ($.isArray(gl.columnWidth)) { + } else if (Array.isArray(gl.columnWidth)) { return gl.columnWidth[ gl.columnWidth.length - 1 ]; } else { return gl.columnWidth; @@ -1882,7 +1882,7 @@ if (rightPanelTilesHeight) { return rightPanelTilesHeight; - } else if ($.isArray(gl.columnHeight)) { + } else if (Array.isArray(gl.columnHeight)) { return gl.columnHeight[ gl.columnHeight.length - 1 ]; } else { return gl.columnHeight; @@ -1943,7 +1943,7 @@ var gl = this._options.gridLayout, minWidth, i; - if ($.isArray(gl.columnWidth)) { + if (Array.isArray(gl.columnWidth)) { minWidth = gl.columnWidth[ 0 ]; for (i = 0; i < gl.columnWidth.length; i++) { if (minWidth > gl.columnWidth[ i ]) { diff --git a/src/js/modules/infragistics.ui.toolbarbutton.js b/src/js/modules/infragistics.ui.toolbarbutton.js index e69155d51..6a93bcee0 100644 --- a/src/js/modules/infragistics.ui.toolbarbutton.js +++ b/src/js/modules/infragistics.ui.toolbarbutton.js @@ -230,7 +230,7 @@ return; } - this.element.mousedown(); + this.element.trigger("mousedown"); }, _triggerActivating: function (event) { var args = { diff --git a/src/js/modules/infragistics.ui.tree.js b/src/js/modules/infragistics.ui.tree.js index 526816581..474378d25 100644 --- a/src/js/modules/infragistics.ui.tree.js +++ b/src/js/modules/infragistics.ui.tree.js @@ -2518,7 +2518,7 @@ // K.D. August 16th, 2013 Bug #149438 Switching to delegated events this.element.on("mousedown", "a", function () { - $(this).focus(); + $(this).trigger("focus"); }); } else { element.draggable(dragOptions); @@ -2587,7 +2587,7 @@ if (noCancel) { self.select(target.parent(), event); if ($.ig.util.isWebKit) { - target.focus(); + target.trigger("focus"); } } else { event.preventDefault(); @@ -2900,13 +2900,13 @@ // K.D. December 14th, 2011 Bug #85068 jQuery 1.4.4 does not trigger blur when // calling focus so I'm calling it manually li.children("a").blur(); - nextLi.children("a").focus(); + nextLi.children("a").trigger("focus"); } else { // K.D. December 14th, 2011 Bug #85068 jQuery 1.4.4 does not trigger blur when // calling focus so I'm calling it manually li.children("a").blur(); - nextLi.children("a").focus(); + nextLi.children("a").trigger("focus"); this.select(nextLi, null); } event.preventDefault(); @@ -2921,13 +2921,13 @@ // K.D. December 14th, 2011 Bug #85068 jQuery 1.4.4 does not trigger blur when // calling focus so I'm calling it manually li.children("a").blur(); - nextLi.children("a").focus(); + nextLi.children("a").trigger("focus"); } else { // K.D. December 14th, 2011 Bug #85068 jQuery 1.4.4 does not trigger blur when // calling focus so I'm calling it manually li.children("a").blur(); - nextLi.children("a").focus(); + nextLi.children("a").trigger("focus"); this.select(nextLi, null); } event.preventDefault(); @@ -2944,13 +2944,13 @@ // K.D. December 14th, 2011 Bug #85068 jQuery 1.4.4 does not trigger blur when // calling focus so I'm calling it manually li.children("a").blur(); - nextLi.children("a").focus(); + nextLi.children("a").trigger("focus"); } else { // K.D. December 14th, 2011 Bug #85068 jQuery 1.4.4 does not trigger blur when // calling focus so I'm calling it manually li.children("a").blur(); - nextLi.children("a").focus(); + nextLi.children("a").trigger("focus"); this.select(nextLi, null); } } @@ -2967,13 +2967,13 @@ // K.D. December 14th, 2011 Bug #85068 jQuery 1.4.4 does not trigger blur when // calling focus so I'm calling it manually li.children("a").blur(); - nextLi.children("a").focus(); + nextLi.children("a").trigger("focus"); } else { // K.D. December 14th, 2011 Bug #85068 jQuery 1.4.4 does not trigger blur when // calling focus so I'm calling it manually li.children("a").blur(); - nextLi.children("a").focus(); + nextLi.children("a").trigger("focus"); this.select(nextLi, null); } } @@ -3004,7 +3004,7 @@ li.children("a").blur(); li = this.element.find("li:first"); if (li.length > 0) { - li.children("a").focus(); + li.children("a").trigger("focus"); this.select(li); } event.preventDefault(); @@ -3015,7 +3015,7 @@ li.children("a").blur(); li = this._lastVisibleNode(); if (li) { - li.children("a").focus(); + li.children("a").trigger("focus"); this.select(li); } event.preventDefault(); @@ -3704,7 +3704,7 @@ this._selectedNode[ 0 ] = this.nodeFromElement(element); } if (isFocused) { - element.children("a").focus(); + element.children("a").trigger("focus"); } } break; @@ -4475,7 +4475,7 @@ binding = this._retrieveCurrentDepthBinding(depth); if (this.options.checkboxMode.toLowerCase() === "tristate") { if (this.isChecked(parent)) { - this._populateCheckedStates($.isArray(node) ? node : [ node ], binding, "on"); + this._populateCheckedStates(Array.isArray(node) ? node : [ node ], binding, "on"); } } diff --git a/src/js/modules/infragistics.ui.upload.js b/src/js/modules/infragistics.ui.upload.js index 6e07f5b1a..19f914818 100644 --- a/src/js/modules/infragistics.ui.upload.js +++ b/src/js/modules/infragistics.ui.upload.js @@ -4302,7 +4302,7 @@ break; } if (icon === "" && - (arrIE[ i ].def === true || ($.isArray(arrIE[ i ].ext) && arrIE[ i ].ext.length === 0))) { + (arrIE[ i ].def === true || (Array.isArray(arrIE[ i ].ext) && arrIE[ i ].ext.length === 0))) { /* M.H. 27 Jul 2011 - fix bug 77162 - Default icon could be those which has property def true OR ext.length is 0 */ icon = arrIE[ i ].css; } diff --git a/src/js/modules/infragistics.ui.videoplayer.js b/src/js/modules/infragistics.ui.videoplayer.js index a6ddfaa26..75cd4895b 100644 --- a/src/js/modules/infragistics.ui.videoplayer.js +++ b/src/js/modules/infragistics.ui.videoplayer.js @@ -4001,11 +4001,11 @@ _handleKbNavigation: function (event) { if (event.keyCode === $.ui.keyCode.HOME) { - $(this.controlButtons[ 0 ]).focus(); + $(this.controlButtons[ 0 ]).trigger("focus"); event.stopPropagation(); event.preventDefault(); } else if (event.keyCode === $.ui.keyCode.END) { - $(this.controlButtons[ this.controlButtons.length - 1 ]).focus(); + $(this.controlButtons[ this.controlButtons.length - 1 ]).trigger("focus"); event.stopPropagation(); event.preventDefault(); } @@ -4892,7 +4892,7 @@ event.preventDefault(); event.stopPropagation(); control._transferFocusFromVolumeButtonToVolumeSlider = true; - $("#" + control._id("_ctrls_vs")).data("igSlider").handle.focus(); + $("#" + control._id("_ctrls_vs")).data("igSlider").handle.trigger("focus"); } } }); @@ -4901,7 +4901,7 @@ if (event.keyCode === $.ui.keyCode.TAB) { event.preventDefault(); event.stopPropagation(); - $("#" + control._id("_ctrls_fs_btn")).focus(); + $("#" + control._id("_ctrls_fs_btn")).trigger("focus"); } } }); diff --git a/src/js/modules/infragistics.ui.zoombar.js b/src/js/modules/infragistics.ui.zoombar.js index 0385f34d0..ad31fa5e1 100644 --- a/src/js/modules/infragistics.ui.zoombar.js +++ b/src/js/modules/infragistics.ui.zoombar.js @@ -1611,12 +1611,12 @@ } }, _copyRelevantOpts: function (opts) { - var ref = $.isArray(opts) ? [] : {}, type, self = this, props = false, cval; + var ref = Array.isArray(opts) ? [] : {}, type, self = this, props = false, cval; $.each(opts, function (key, val) { if (val === null) { return true; } - if ($.isArray(ref)) { + if (Array.isArray(ref)) { if (typeof val !== "object") { cval = val; } else { @@ -1687,7 +1687,7 @@ default: if (val !== null) { type = typeof val; - if (type === "object" || $.isArray(val)) { + if (type === "object" || Array.isArray(val)) { cval = self._copyRelevantOpts(val); if (cval !== null) { props = true; diff --git a/tests/unit/combo/api/api-test.js b/tests/unit/combo/api/api-test.js index 272e52d6e..2f8701ba2 100644 --- a/tests/unit/combo/api/api-test.js +++ b/tests/unit/combo/api/api-test.js @@ -1214,7 +1214,7 @@ QUnit.test('[ID31] Combo remove separators', function (assert) { assert.equal($combo.igCombo("text"), "John, ", "Text in input is correct"); $input.blur(); assert.equal($combo.igCombo("text"), "John", "Text in input is correct"); - $input.focus(); + $input.trigger("focus"); done(); }).catch(function (er) { assert.pushResult({ result: false, message: er.message }); @@ -1244,7 +1244,7 @@ QUnit.test('[ID32] Combo add separators', function (assert) { $combo.igCombo("select", $combo.igCombo("items")[0].element); $input = $combo.igCombo("textInput"); assert.equal($combo.igCombo("text"), "John", "Text in input is correct"); - $input.focus(); + $input.trigger("focus"); $input.click(); $.ig.TestUtil.wait(3000).then(function () { diff --git a/tests/unit/combo/filtering/filtering-test.js b/tests/unit/combo/filtering/filtering-test.js index 8a3ea7cd4..e391b1acb 100644 --- a/tests/unit/combo/filtering/filtering-test.js +++ b/tests/unit/combo/filtering/filtering-test.js @@ -398,7 +398,7 @@ QUnit.test('[ID8] When fitering is remote and multiSelection is enabled input va $combo.data().igCombo._options.$dropDownListCont.outerHeight(1000); $input = $combo.igCombo("textInput"); - $input.focus(); + $input.trigger("focus"); $.ig.TestUtil.type("v,", $input); $dropDownButton = $combo.data().igCombo._options.$dropDownBtnCont; diff --git a/tests/unit/combo/selection/selection-test.js b/tests/unit/combo/selection/selection-test.js index 29b562423..42c6df7c0 100644 --- a/tests/unit/combo/selection/selection-test.js +++ b/tests/unit/combo/selection/selection-test.js @@ -813,7 +813,7 @@ QUnit.test('[ID9] Single selection typing in input', function (assert) { assert.strictEqual($hiddenInput.val(), "Hana", 'Hidden input value is incorrect'); // 2. Type 'hn' - $input.focus().select(); + $input.trigger("focus").trigger("select"); $.ig.TestUtil.type("hn", $input); return $.ig.TestUtil.wait(100); }).then(function () { @@ -836,7 +836,7 @@ QUnit.test('[ID9] Single selection typing in input', function (assert) { assert.strictEqual($hiddenInput.val(), "", 'Hidden input value is incorrect'); // 3. Type 'm' - $input.focus().select(); + $input.trigger("focus").trigger("select"); $.ig.TestUtil.type("m", $input); return $.ig.TestUtil.wait(100); }).then(function () { @@ -905,7 +905,7 @@ QUnit.test('[ID10] Multi selection typing in input', function (assert) { assert.strictEqual($hiddenInput.val(), "", 'Hidden input value is incorrect'); // 2. Type 'a, ' - $input.focus().select(); + $input.trigger("focus").trigger("select"); $.ig.TestUtil.type("a, ", $input); return $.ig.TestUtil.wait(100); }).then(function () { @@ -922,7 +922,7 @@ QUnit.test('[ID10] Multi selection typing in input', function (assert) { assert.ok($items.eq(6).hasClass('ui-state-active'), 'Item should be selected'); // 3. Type 'Anna, h' - $input.focus().select(); + $input.trigger("focus").trigger("select"); $.ig.TestUtil.type("Anna, h", $input); return $.ig.TestUtil.wait(100); }).then(function () { @@ -1009,7 +1009,7 @@ QUnit.test('[ID11] Single selection typing in input autoSelectFirstMatch false', assert.strictEqual($hiddenInput.val(), "", 'Hidden input value is incorrect'); // 2. Type 'hana' - $input.focus().select(); + $input.trigger("focus").trigger("select"); $.ig.TestUtil.type("hana", $input); return $.ig.TestUtil.wait(100); }).then(function () { @@ -1032,7 +1032,7 @@ QUnit.test('[ID11] Single selection typing in input autoSelectFirstMatch false', assert.strictEqual($hiddenInput.val(), "Hana", 'Hidden input value is incorrect'); // 3. Type 'm' - $input.focus().select(); + $input.trigger("focus").trigger("select"); $.ig.TestUtil.type("m", $input); return $.ig.TestUtil.wait(100); }).then(function () { @@ -1095,7 +1095,7 @@ QUnit.test('[ID12] Multi selection typing in input autoSelectFirstMatch false', assert.strictEqual($input.val(), "a", 'Input value is incorrect'); assert.strictEqual($hiddenInput.val(), "", 'Hidden input value is incorrect'); - $input.focus().select(); + $input.trigger("focus").trigger("select"); $.ig.TestUtil.type("anna", $input); return $.ig.TestUtil.wait(100); }).then(function () { @@ -1104,7 +1104,7 @@ QUnit.test('[ID12] Multi selection typing in input autoSelectFirstMatch false', assert.strictEqual($input.val(), "anna", 'Input value is incorrect'); assert.strictEqual($hiddenInput.val(), "", 'Hidden input value is incorrect'); - $input.focus().select(); + $input.trigger("focus").trigger("select"); $.ig.TestUtil.type("anna, ", $input); return $.ig.TestUtil.wait(100); }).then(function () { @@ -1117,7 +1117,7 @@ QUnit.test('[ID12] Multi selection typing in input autoSelectFirstMatch false', assert.notOk($items.eq(2).hasClass('ui-state-active'), 'Item should not be selected'); assert.ok($items.eq(6).hasClass('ui-state-active'), 'Item should be selected'); - $input.focus().select(); + $input.trigger("focus").trigger("select"); $.ig.TestUtil.type("Anna, h", $input); return $.ig.TestUtil.wait(100); }).then(function () { @@ -1383,7 +1383,7 @@ QUnit.test('[ID19] Keypress empty selection dropdown combo', function (assert) { $input = $combo.data().igCombo._options.$input; - $input.focus(); + $input.trigger("focus"); $.ig.TestUtil.keyInteraction(106, $input); assert.equal($combo.igCombo('selectedItems')[0].data.Name, 'John Smith', 'Selected item matches'); $.ig.TestUtil.keyInteraction(106, $input); @@ -1409,7 +1409,7 @@ QUnit.test('[ID20] When selection is single and press enter the list should be c $listItems = $combo.igCombo("dropDown").find('.ui-igcombo-listitem'); $input = $combo.igCombo("textInput"); - $input.focus(); + $input.trigger("focus"); $.ig.TestUtil.keyInteraction(40, $input); $.ig.TestUtil.keyInteraction(40, $input); $.ig.TestUtil.keyInteraction(13, $input); @@ -1454,7 +1454,7 @@ QUnit.test('[ID21] The editor text changes even if selectionChanging event is ca $input = $combo.igCombo("textInput"); $listItems = $combo.igCombo("dropDown").find(".ui-igcombo-listitem"); - $input.focus(); + $input.trigger("focus"); $.ig.TestUtil.type('w', $input); // 'w' key $combo.igCombo("refreshValue"); diff --git a/tests/unit/combo/virtualization/virtualization-test.js b/tests/unit/combo/virtualization/virtualization-test.js index a58599c19..86f943e58 100644 --- a/tests/unit/combo/virtualization/virtualization-test.js +++ b/tests/unit/combo/virtualization/virtualization-test.js @@ -197,18 +197,18 @@ QUnit.test('[ID2] Test autocomplete functionality', function (assert) { assert.strictEqual(selectedText, 'om', 'Selected text is incorrect'); // Invalid value - $input.focus().select(); + $input.trigger("focus").trigger("select"); $.ig.TestUtil.type("Tx", $input, 'shiftKey'); assert.strictEqual($input.val(), 'Tx', 'Input value is incorrect'); // Multiple entries with same starting letter(s) - $input.focus().select(); + $input.trigger("focus").trigger("select"); $.ig.TestUtil.type("M", $input, 'shiftKey'); return $.ig.TestUtil.wait(100); }).then(function () { assert.strictEqual($input.val(), 'Mary', 'Input value is incorrect'); - $input.focus().select(); + $input.trigger("focus").trigger("select"); $.ig.TestUtil.type("Mi", $input, 'shiftKey'); return $.ig.TestUtil.wait(100); }).then(function () { @@ -217,7 +217,7 @@ QUnit.test('[ID2] Test autocomplete functionality', function (assert) { // Test right arrow $.ig.TestUtil.keyInteraction(39, $input); // right arrow assert.strictEqual($input.val(), 'Mike', 'Input value is incorrect'); - $input.focus().select(); + $input.trigger("focus").trigger("select"); $.ig.TestUtil.type('M', $input); return $.ig.TestUtil.wait(100); @@ -260,26 +260,26 @@ QUnit.test('[ID3] Autocomplete with multiple selection', function (assert) { $.ig.TestUtil.wait(100).then(function () { assert.strictEqual($input.val(), 'anna', 'Input value is incorrect'); - $input.focus().select(); + $input.trigger("focus").trigger("select"); $.ig.TestUtil.type('a,', $input); return $.ig.TestUtil.wait(100); }).then(function () { assert.strictEqual($input.val(), 'a,', 'Input value is incorrect'); - $input.focus().select(); + $input.trigger("focus").trigger("select"); $.ig.TestUtil.type('a, ', $input); return $.ig.TestUtil.wait(100); }).then(function () { isValueCorrect = $input.val() === 'Anna, ' || $input.val() === 'Anna'; assert.ok(isValueCorrect, 'Input value is incorrect'); - $input.focus().select(); + $input.trigger("focus").trigger("select"); $.ig.TestUtil.type('Anna,', $input); return $.ig.TestUtil.wait(100); }).then(function () { assert.strictEqual($input.val(), 'Anna,', 'Input value is incorrect'); - $input.focus().select(); + $input.trigger("focus").trigger("select"); $.ig.TestUtil.type('Anna, B', $input); return $.ig.TestUtil.wait(100); }).then(function () { @@ -314,13 +314,13 @@ QUnit.test('[ID4] Autocomplete with case sensitivity', function (assert) { $.ig.TestUtil.wait(100).then(function () { assert.strictEqual($input.val(), 'b', 'Input value is incorrect'); - $input.focus().select(); + $input.trigger("focus").trigger("select"); $.ig.TestUtil.type('B', $input); return $.ig.TestUtil.wait(100); }).then(function () { assert.strictEqual($input.val(), 'Bob', 'Input value is incorrect'); - $input.focus().select(); + $input.trigger("focus").trigger("select"); $.ig.TestUtil.type('BO', $input, "shiftKey"); return $.ig.TestUtil.wait(100); }).then(function () { diff --git a/tests/unit/common/test-util.js b/tests/unit/common/test-util.js index 1fb92a2c0..c4207aef5 100644 --- a/tests/unit/common/test-util.js +++ b/tests/unit/common/test-util.js @@ -103,7 +103,7 @@ var newValue = $input.val(); newValue = newValue.slice(0, startPos) + newVal + newValue.slice(startPos); if (focus) { - $input.focus(); + $input.trigger("focus"); } $input.val(newValue); $input[0].selectionStart = startPos; diff --git a/tests/unit/editors/Bugs/bugs-test.js b/tests/unit/editors/Bugs/bugs-test.js index 38aa471f8..004f9707c 100644 --- a/tests/unit/editors/Bugs/bugs-test.js +++ b/tests/unit/editors/Bugs/bugs-test.js @@ -223,11 +223,11 @@ QUnit.test('Bug 209696', function (assert) { date1 = new Date(2015, 10, 13, 00, 34), date2 = new Date(2015, 10, 13, 12, 34); - $editor1.igDateEditor("field").focus().val("13,11,2015 12:34 AM").blur(); + $editor1.igDateEditor("field").trigger("focus").val("13,11,2015 12:34 AM").blur(); assert.equal($editor1.igDateEditor("field").val(), "13,11,2015 12:34 AM", "The display value is changed to 13,11,2015 12:34 AM"); assert.equal($editor1.igDateEditor("value").getTime(), date1.getTime(), "The value is changed to" + date1); - $editor2.igDateEditor("field").focus().val("13,11,2015 12:34 PM").blur(); + $editor2.igDateEditor("field").trigger("focus").val("13,11,2015 12:34 PM").blur(); assert.equal($editor2.igDateEditor("field").val(), "13,11,2015 12:34 PM", "The display value is changed to 13,11,2015 12:34 PM"); assert.equal($editor2.igDateEditor("value").getTime(), date2.getTime(), "The value is changed to " + date2); }); @@ -238,10 +238,10 @@ QUnit.test('Bug 208809', function (assert) { var $editor = this.util.appendToFixture(this.inputTag).igPercentEditor(), field = $editor.igPercentEditor("field"); - field.focus().val("123456789").blur(); + field.trigger("focus").val("123456789").blur(); assert.equal(field.val(), "123,456,789.00%", "The value is changed to 123,456,789.00%"); - field.focus(); + field.trigger("focus"); assert.equal(field.val(), "123456789", "The value is changed to 123456789"); }); @@ -262,28 +262,28 @@ QUnit.test('Bug 208887, 216017', function (assert) { }), field = $editor1.igDateEditor("field"); - field.focus().val("30,10,2016 10:25:56 12 AM"); + field.trigger("focus").val("30,10,2016 10:25:56 12 AM"); assert.equal(field.val(), "30,10,2016 10:25:56 12 AM", "The value is changed to 30,10,2016 10:25:56 12 AM"); field.blur(); assert.equal(field.val(), "30,10,2016 10:25:56 12 AM", "The value is changed to 30,10,2016 10:25:56 12 AM"); - field.focus(); + field.trigger("focus"); assert.equal(field.val(), "30,10,2016 10:25:56 12 AM", "The value is changed to 30,10,2016 10:25:56 12 AM"); field = $editor2.igDateEditor("field") - field.focus().val("30,10,2016 10:25:56 12_ AM"); + field.trigger("focus").val("30,10,2016 10:25:56 12_ AM"); assert.equal(field.val(), "30,10,2016 10:25:56 12_ AM", "The value is changed to 30,10,2016 10:25:56 12 AM"); field.blur(); assert.equal(field.val(), "30,10,2016 10:25:56 120 AM", "The value is changed to 30,10,2016 10:25:56 12 AM"); - field.focus(); + field.trigger("focus"); assert.equal(field.val(), "30,10,2016 10:25:56 120 AM", "The value is changed to 30,10,2016 10:25:56 12 AM"); // Bug #216017 field = $editor1.igDateEditor("field"); - field.focus().val("00,00,0000 00:00:00 00 AM"); + field.trigger("focus").val("00,00,0000 00:00:00 00 AM"); field.blur(); assert.equal(field.val(), "30,10,2000 12:0:00 00 AM", "The value is changed to 30,10,2016 10:25:56 12 AM"); }); @@ -301,7 +301,7 @@ QUnit.test('Bug 209012', function (assert) { }), field = $textEditorUpper.igTextEditor("field"); - field.focus(); + field.trigger("focus"); $textEditorUpper.data("igTextEditor")._insert("NewVal1", ""); assert.equal(field.val(), "NEWVAL1", "The value is changed to NEWVAL1"); @@ -309,7 +309,7 @@ QUnit.test('Bug 209012', function (assert) { assert.equal(field.val(), "NEWVAL1", "The value is changed to NEWVAL1"); field = $textEditorLower.igTextEditor("field") - field.focus(); + field.trigger("focus"); $textEditorLower.data("igTextEditor")._insert("NewVal1", ""); assert.equal(field.val(), "newval1", "The value is changed to newval1"); @@ -333,24 +333,24 @@ QUnit.test('Bug 208350', function (assert) { field; field = $dateEditor.igDateEditor("field"); - field.focus().val("15/10/2016 10:25:56"); + field.trigger("focus").val("15/10/2016 10:25:56"); assert.equal(field.val(), "15/10/2016 10:25:56", "The text is changed to 15/10/2016 10:25:56"); field.blur(); assert.equal(field.val(), "15/10/2016 10:25:56", "The value is changed to 15/10/2016 10:25:56"); - field.focus(); + field.trigger("focus"); assert.equal($dateEditor.igDateEditor("value").getTime(), new Date(2016, 9, 15, 10, 25, 56).getTime(), "The value is changed to 15/10/2016 10:25:56"); assert.equal(field.val(), "15/10/2016 10:25:56", "The value is changed to 15/10/2016 10:25:56"); field = $datePickerEditor.igDatePicker("field"); - field.focus().val("15/10/2016 10:25:56"); + field.trigger("focus").val("15/10/2016 10:25:56"); assert.equal(field.val(), "15/10/2016 10:25:56", "The value is changed to 15/10/2016 10:25:56"); field.blur(); assert.equal(field.val(), "15/10/2016 10:25:56", "The value is changed to 15/10/2016 10:25:56"); - field.focus(); + field.trigger("focus"); assert.equal($datePickerEditor.igDatePicker("value").getTime(), new Date(2016, 9, 15, 10, 25, 56).getTime(), "The value is changed to 1476527156000"); }); @@ -374,7 +374,7 @@ QUnit.test('Bug 208448', function (assert) { }), field = $editor.igDatePicker("field"); - field.focus(); + field.trigger("focus"); assert.equal(field.val(), "25/05/2012", "The text is changed to 25/05/2012"); $editor.igDatePicker("dropDownButton").click(); @@ -394,14 +394,14 @@ QUnit.test('Bug 208264', function (assert) { }), field = $editor.igDateEditor("field"); - field.focus(); + field.trigger("focus"); $editor.data("igDateEditor")._insert("10:10:_9"); assert.equal(field.val(), "10:10:_9", "The text is changed to 10:10:9"); field.blur() assert.equal(field.val(), "10:10:09", "The value is changed to 10:10:9"); - field.focus(); + field.trigger("focus"); assert.equal(field.val(), "10:10:09", "The value is changed to 25/05/2012"); }); @@ -442,7 +442,7 @@ QUnit.test('Bug 220479', function (assert) { assert.equal($percentEditorvar.igPercentEditor("field").val(), "20.00%", "The value in the field should be 20.00%"); assert.equal($percentEditorvar.igPercentEditor("value"), "0.2", "The value in the field should be 0.2"); - field.focus(); + field.trigger("focus"); $currencyEditor1.igCurrencyEditor("insert", "20"); assert.equal(field.val(), "20", "The value in the field should be 20"); @@ -470,7 +470,7 @@ QUnit.test('Bug 220479 - 1', function (assert) { assert.equal(field.val(), "23.00%", "The text after insert should be 23.00%"); assert.strictEqual($percentEditorvar.igPercentEditor("value"), 0.23, "The value after insert should be 0.23"); - field.click().focus(); + field.click().trigger("focus"); this.util.wait(100).then(function () { $percentEditorvar.igPercentEditor("insert", "20"); assert.equal(field.val(), "20", "The value in the field should be 20. Actual - " + field.val()); @@ -598,7 +598,7 @@ QUnit.test('Bug 210990', function (assert) { $editor.igMaskEditor("value", ""); assert.equal($editor.igMaskEditor("field").val(), "", "The text is changed to an empty string"); - $editor.igMaskEditor("field").focus(); + $editor.igMaskEditor("field").trigger("focus"); assert.equal($editor.igMaskEditor("field").val(), $editor.data("igMaskEditor")._maskWithPrompts, "The text is changed to 4"); assert.equal($editor.igMaskEditor("value"), "", "The text is changed to to an empty string"); }); @@ -627,12 +627,12 @@ QUnit.test('Bug 208274', function (assert) { }), field = $editor.igDateEditor("field"); - field.focus(); + field.trigger("focus"); $editor.data("igDateEditor")._insert("20:01:05"); field.blur(); assert.equal(field.val(), "20:01:05", "The text is changed to 20:01:05"); - field.focus(); + field.trigger("focus"); assert.equal(field.val(), "20:01:05", "The value is changed to 20:01:05"); }); @@ -677,7 +677,7 @@ QUnit.test('Bug 207321', function (assert) { value: "value1" }); - $editor.igMaskEditor("field").focus(); + $editor.igMaskEditor("field").trigger("focus"); $editor.data("igMaskEditor")._handleDeleteKey(); assert.equal($editor.data("igMaskEditor")._getCursorPosition(), 10, "the cursor should be on position 10"); }); @@ -692,7 +692,7 @@ QUnit.test('Bug 211575', function (assert) { dateInputFormat: 'yyyy/MM/dd' }); - $editor.igDateEditor("field").focus(); + $editor.igDateEditor("field").trigger("focus"); $editor.data("igDateEditor")._insert("2015/10/10"); $editor.igDateEditor("field").blur() assert.equal($editor.data("igDateEditor")._valueInput.val(), "2015/10/10", "The value is changed to 2015/10/10"); @@ -713,7 +713,7 @@ QUnit.test('Bug 212596', function (assert) { field; field = $numericEditor.igNumericEditor("field"); - field.focus(); + field.trigger("focus"); $numericEditor.data("igNumericEditor")._enterEditMode(); $numericEditor.igNumericEditor("value", "1234"); assert.equal(field.val(), "1234", "The value in edit mode should be 1234. It's: " + field.val()); @@ -793,11 +793,11 @@ QUnit.test('Bug 216789', function (assert) { excludeKeys: '23' }); - $editor1.igTextEditor("field").focus(); + $editor1.igTextEditor("field").trigger("focus"); $editor1.data("igTextEditor")._insert("1a2b3c4d5e6f7g8h9i0", ""); - $editor2.igTextEditor("field").focus(); + $editor2.igTextEditor("field").trigger("focus"); $editor2.data("igTextEditor")._insert("1a2b3c4d5e6f7g8h9i0", ""); - $editor3.igTextEditor("field").focus(); + $editor3.igTextEditor("field").trigger("focus"); $editor3.data("igTextEditor")._insert("1a2b3c4d5e6f7g8h9i0", ""); //assert.ok(.hasClass("ui-igedit-dropdown-orientation-bottom"), "The dropDownContainer should be with ui-igedit-dropdown-orientation-bottom class applied"); @@ -824,7 +824,7 @@ QUnit.test('Bug 218836', function (assert) { field; field = $editor.igMaskEditor("field"); - field.focus(); + field.trigger("focus"); $editor.igMaskEditor("value", "1111111111"); assert.equal(field.val(), "(111) 111-1111", "The value in the field should be (111) 111-1111"); @@ -845,7 +845,7 @@ QUnit.test('Bug 218752', function (assert) { valueDate, field = $editor.igDateEditor("field"); - field.focus(); + field.trigger("focus"); field.val("2016/02/10"); field.blur(); assert.equal(field.val(), "2016/02/10", "The value in the field should be 2016/02/10"); @@ -866,7 +866,7 @@ QUnit.test('Bug 220712 - typed text is reverted to previous value in case the dr field = $editor.igTextEditor("field"); // focus editor and set value - field.click().focus(); + field.click().trigger("focus"); field.val("text"); //open dropdown @@ -919,7 +919,7 @@ QUnit.test('Bug 221300', function (assert) { field = $editor.igTextEditor("field"), value; - field.click().focus(); + field.click().trigger("focus"); field[0].setSelectionRange(6, 6); this.util.keyInteraction(13, field); field.blur(); @@ -927,7 +927,7 @@ QUnit.test('Bug 221300', function (assert) { assert.equal(value, "John S\nmith, with long test", "Word is not carried over the new line"); assert.equal($editor.igTextEditor("getSelectionStart"), 7, "Cursor position is wrong"); - field.click().focus(); + field.click().trigger("focus"); field[0].setSelectionRange(10, 10); this.util.keyInteraction(13, field); @@ -958,7 +958,7 @@ QUnit.test('Bug 98', function (assert) { text = field.val(); assert.equal(text, 5, "Text in editor is not set to the maxValue"); - $editor.select(); + $editor.trigger("select"); util.type("1", field); util.keyInteraction(13, field); text = field.val(); @@ -1328,7 +1328,7 @@ QUnit.test('Bug 695 - Check ', function (assert) { value: 0.029 }); - assert.equal($editor.igPercentEditor("field").focus().blur().val(), "2,90%", "value should be to 2,90%"); //fails prior fix with 2.900,00% + assert.equal($editor.igPercentEditor("field").trigger("focus").blur().val(), "2,90%", "value should be to 2,90%"); //fails prior fix with 2.900,00% assert.equal($editor.igPercentEditor("value"), 0.029, "value should be 0.029"); //fails prior fix and returns 29 instead }); @@ -1345,14 +1345,14 @@ QUnit.test('Bug 809 - Wrong value is set when we have isLimitedToListValues: tru }), input = $editor.igNumericEditor("field"); - $editor.focus(); + $editor.trigger("focus"); this.util.keyInteraction(38, input); //Arrow Up input.val(""); $editor.blur(); assert.equal($editor.igNumericEditor("value"), "", "Value should be empty string"); $editor.igNumericEditor("option", "allowNullValue", "true"); - $editor.focus(); + $editor.trigger("focus"); this.util.keyInteraction(38, input); //Arrow Up this.util.keyInteraction(13, input); @@ -1362,12 +1362,12 @@ QUnit.test('Bug 809 - Wrong value is set when we have isLimitedToListValues: tru $editor.igNumericEditor("option", "allowNullValue", "false"); $editor.igNumericEditor("option", "revertIfNotValid", "true"); - $editor.focus(); + $editor.trigger("focus"); this.util.keyInteraction(38, input); //Arrow Up $editor.blur(); assert.equal($editor.igNumericEditor("value"), 3, "Value should revert to 3 "); - $editor.focus().val(55); + $editor.trigger("focus").val(55); $editor.blur(); assert.equal($editor.igNumericEditor("value"), 3, "Value should revert to 3 "); assert.ok($editor.igNumericEditor("editorContainer").hasClass($.ui.igNotifier.prototype.css.warningState), "There should be warning notification"); @@ -1424,7 +1424,7 @@ QUnit.test('Bug 1027 Exception is thrown when typing due to incorrect value/null }); // value not matching mask (fails validation) - $editor.trigger("focus").select(); + $editor.trigger("focus").trigger("select"); try { this.util.keyInteraction(49, $editor); this.util.keyInteraction(50, $editor); @@ -1444,7 +1444,7 @@ QUnit.test('Bug 1027 Exception is thrown when typing due to incorrect value/null allowNullValue: true, nullValue: "#5a" //wrong first char }); - $editor.trigger("focus").select(); + $editor.trigger("focus").trigger("select"); try { this.util.keyInteraction(97, $editor); this.util.keyInteraction(98, $editor); @@ -1463,7 +1463,7 @@ QUnit.test('Bug 1027 Exception is thrown when typing due to incorrect value/null nullValue: 0 }); assert.equal($editor.val(), "0", "Null value not applied on Display text.") - $editor.trigger("focus").select(); + $editor.trigger("focus").trigger("select"); try { this.util.keyInteraction(49, $editor); this.util.keyInteraction(50, $editor); @@ -1521,7 +1521,7 @@ QUnit.test('Bug 1043 - maxLength not respected on Android', function (assert) { util = this.util, done = assert.async(); - $field.focus(); + $field.trigger("focus"); composition = jQuery.Event("compositionstart"); $field.trigger(composition); $field.val("12345678"); @@ -1536,8 +1536,8 @@ QUnit.test('Bug 1043 - maxLength not respected on Android', function (assert) { $field.blur(); // test case without start (Chrome Android) - $field.focus(); - $field.select(); + $field.trigger("focus"); + $field.trigger("select"); var compositionupdate = jQuery.Event("compositionupdate"); compositionupdate.originalEvent = { data: "2" }; $field.val("12"); @@ -1583,7 +1583,7 @@ QUnit.test('Bug 1205 Decimal numbers are rounded when the editor is blurred', fu allowNullValue: true, nullValue: "#5a" //wrong first char }); - $editor.trigger("focus").select(); + $editor.trigger("focus").trigger("select"); try { $.ig.TestUtil.keyInteraction(97, $editor); $.ig.TestUtil.keyInteraction(98, $editor); @@ -1602,7 +1602,7 @@ QUnit.test('Bug 1205 Decimal numbers are rounded when the editor is blurred', fu nullValue: 0 }); assert.equal($editor.val(), "0", "Null value not applied on Display text.") - $editor.trigger("focus").select(); + $editor.trigger("focus").trigger("select"); try { $.ig.TestUtil.keyInteraction(49, $editor); $.ig.TestUtil.keyInteraction(50, $editor); @@ -1683,7 +1683,7 @@ QUnit.test('Bug 256852: textChanged not fired on Safari on MacOS (Grid filtering 3. input (value assigned to input) 4. keydown 5. keyup */ - $field.focus(); + $field.trigger("focus"); $field.trigger(jQuery.Event("compositionstart")); $field.trigger(jQuery.Event("compositionupdate")); $field.val("d"); @@ -1781,8 +1781,8 @@ QUnit.test('Bug 264559: Text from Excel cannot be pasted --> Remove new line cha }); var field = newLineCharsEditor.igMaskEditor("field"); - field.focus(); - field.select(); + field.trigger("focus"); + field.trigger("select"); field.trigger(e); field.val("201906"); @@ -1791,7 +1791,7 @@ QUnit.test('Bug 264559: Text from Excel cannot be pasted --> Remove new line cha newLineText = "201511\n"; expectedText = "2015-11"; - field.select(); + field.trigger("select"); field.trigger(e); field.val("201511"); @@ -1815,8 +1815,8 @@ QUnit.test('Bug 264559: Text from Excel cannot be pasted --> Remove new line cha } }; - dpField.focus(); - dpField.select(); + dpField.trigger("focus"); + dpField.trigger("select"); dpField.trigger(event); dpField.val("20190606"); @@ -1841,14 +1841,14 @@ QUnit.test('Bug 1974: inputMask literals are visible for empty value after blur' }); var field = $editor1.igMaskEditor("field"); - field.focus(); + field.trigger("focus"); assert.equal(field.val(), "____/__", "Mask should be visible"); field.blur(); assert.equal(field.val(), "", "Editor text field should remain empty"); assert.equal($editor1.igMaskEditor("value"), "", "Value should be empty"); field = $editor2.igMaskEditor("field"); - field.focus(); + field.trigger("focus"); assert.equal(field.val(), "(___) ___-___", "Mask should be visible"); field.blur(); assert.equal(field.val(), "", "Editor text field should remain empty"); diff --git a/tests/unit/editors/DatePickerBugs/datePickerBugs-test.js b/tests/unit/editors/DatePickerBugs/datePickerBugs-test.js index a614a99b2..9dd5ad4de 100644 --- a/tests/unit/editors/DatePickerBugs/datePickerBugs-test.js +++ b/tests/unit/editors/DatePickerBugs/datePickerBugs-test.js @@ -237,7 +237,7 @@ QUnit.test('Bug 220775', function (assert) { assert.expect(1); this.editor = this.appendToFixture(this.inputTag).igDatePicker(); - this.input().click().focus(); + this.input().click().trigger("focus"); this.dropDownButton().click(); assert.equal(this.input().val(), "__/__/____", "Opening dropdown caused the entered text to be __/__/____"); }); @@ -522,7 +522,7 @@ QUnit.test("Issue 1733 - igDatePicker throws error, when selecting with displayM todayString = this.getDDmmYYYY(value, "-").split("-").reverse().join("-"); - $editor.igDatePicker("field").focus(); + $editor.igDatePicker("field").trigger("focus"); $editor.igDatePicker("showDropDown"); $.ig.TestUtil.wait(400).then(function () { diff --git a/tests/unit/editors/currencyEditor/currency-test.js b/tests/unit/editors/currencyEditor/currency-test.js index 7eea8e4b9..f28c1251e 100644 --- a/tests/unit/editors/currencyEditor/currency-test.js +++ b/tests/unit/editors/currencyEditor/currency-test.js @@ -319,7 +319,7 @@ QUnit.test("Lists testing, selection-value match", function (assert) { $currencyEditor.igCurrencyEditor("spinUp"); assert.strictEqual($currencyEditor.igCurrencyEditor("value"), 5, "Value not changed on spin method"); - $currencyEditor.focus(); + $currencyEditor.trigger("focus"); this.util.click($spinUpButton); this.util.click($spinDownButton); assert.equal($currencyEditor.igCurrencyEditor("getSelectedListItem").text(), "44.5", "Selection not changed on spin button in edit mode."); @@ -349,7 +349,7 @@ QUnit.test("Lists testing, selection-value match", function (assert) { assert.equal($currencyEditor.igCurrencyEditor("getSelectedListItem").text(), "55,47", "decimalSeparator selected item not correct."); $currencyEditor.igCurrencyEditor("value", 12045); - $currencyEditor.focus(); + $currencyEditor.trigger("focus"); $currencyEditor.blur(); assert.equal($currencyEditor.igCurrencyEditor("getSelectedListItem").text(), "12045", "decimalSeparator selected item did not remain correct."); @@ -365,7 +365,7 @@ QUnit.test("Lists testing, selection-value match", function (assert) { $currencyEditor.igCurrencyEditor("spinDown"); assert.equal($currencyEditor.igCurrencyEditor("getSelectedListItem").text(), "2413,5", "Selected item not correct after spin call"); - $currencyEditor.focus(); + $currencyEditor.trigger("focus"); $currencyEditor.igCurrencyEditor("spinDown"); assert.equal($currencyEditor.igCurrencyEditor("getSelectedListItem").text(), "2413,5", "Selected item not correct after spin call in edit mode"); }); diff --git a/tests/unit/editors/dateEditor/dateEditor-test.js b/tests/unit/editors/dateEditor/dateEditor-test.js index e24c055a7..ab7647351 100644 --- a/tests/unit/editors/dateEditor/dateEditor-test.js +++ b/tests/unit/editors/dateEditor/dateEditor-test.js @@ -197,7 +197,7 @@ QUnit.test('Set dateDisplayFormat', function (assert) { $editor.trigger("blur"); assert.equal($editor.val(), "8/30/2017 3:45 PM", "Runtime dateTime display format not applied"); - $editor.focus(); + $editor.trigger("focus"); $editor.igDateEditor("option", "dateDisplayFormat", "dateLong"); assert.equal($editor.val(), "08/30/2017", "Edit text should not change when seeting display format"); @@ -215,7 +215,7 @@ QUnit.test('Set dateDisplayFormat', function (assert) { $editor.igDateEditor("option", "dateDisplayFormat", "dd MMM yy h:mm:ss tt"); assert.equal($editor.val(), "13 Apr 17 10:12:43 AM", "Runtime dateDisplayFormat display format not applied"); - $editor.focus(); + $editor.trigger("focus"); assert.equal($editor.val(), "10:12:43 AM", "Edit text not correct"); $editor.igDateEditor("option", "dateDisplayFormat", "time"); @@ -273,7 +273,7 @@ QUnit.test('Testing date format with milliseconds ', function (assert) { done = assert.async(), util = this.util; - $dtEditor.focus(); + $dtEditor.trigger("focus"); this.util.wait(100).then(function () { util.type("30,10,2016 10:25:56 12 PM", $dtEditor.igDateEditor("field")); @@ -283,7 +283,7 @@ QUnit.test('Testing date format with milliseconds ', function (assert) { assert.equal(currValue.getTime(), testValue.getTime(), 'Value is not as expected'); assert.equal($dtEditor.igDateEditor("displayValue"), "30,10,2016 10:25:56 12 PM", 'Display text is not as expected'); - $dtEditor.focus(); + $dtEditor.trigger("focus"); return util.wait(100); }).then(function () { @@ -315,7 +315,7 @@ QUnit.test("The same as the previous, but format of the editor is with 'fff' ins done = assert.async(), util = this.util; - $dtEditor.focus(); + $dtEditor.trigger("focus"); this.util.wait(100).then(function () { util.type("30,10,2016 10:25:56 12", $dtEditor.igDateEditor("field")); $dtEditor.trigger("blur"); @@ -323,7 +323,7 @@ QUnit.test("The same as the previous, but format of the editor is with 'fff' ins assert.equal(new Date($dtEditor.igDateEditor("value")).getTime(), new Date(2016, 9, 30, 10, 25, 56, 120).getTime(), 'The initial value is not as expected1'); assert.equal($dtEditor.igDateEditor("displayValue"), "30,10,2016 10:25:56 120 AM", 'The initial value is not as expected2'); - $dtEditor.focus(); + $dtEditor.trigger("focus"); return util.wait(100); }).then(function () { util.paste($dtEditor.igDateEditor("field")[0], "30,10,2016 10:25:56 112 PM"); @@ -642,7 +642,7 @@ QUnit.test("isValid in edit mode", function (assert) { dateInputFormat: "yyyy/MM/dd" }); - $dtEditor.igDateEditor("field").focus(); + $dtEditor.igDateEditor("field").trigger("focus"); $dtEditor.data("igDateEditor")._enterEditMode(); assert.notOk($dtEditor.igDateEditor("isValid"), "Not all required fields are filled"); @@ -1731,7 +1731,7 @@ QUnit.test('Test backspace/delete while editing', function (assert) { done = assert.async(), util = this.util; - $field.focus(); + $field.trigger("focus"); this.util.wait(100).then(function () { util.keyDownChar(8, $field); @@ -4398,7 +4398,7 @@ QUnit.test('Test invalid composition value', function (assert) { util = this.util, composition, compositionupdate, compositionend; - $field.focus(); + $field.trigger("focus"); $field[0].setSelectionRange(0, 5); composition = jQuery.Event("compositionstart"); $field.trigger(composition); @@ -4530,7 +4530,7 @@ QUnit.test('Runtime changes for local and regional options', function (assert) { $dtEditor.igDateEditor("option", "regional", "ja"); assert.equal($dtEditor.val(), "13 4月 17 10:12:43 午前", "Runtime display format not applied after region change"); - $dtEditor.focus(); + $dtEditor.trigger("focus"); assert.equal($dtEditor.val(), "2017/04/13 10:12", "Edit text not correct"); $dtEditor.igDateEditor("option", "dateDisplayFormat", "dateLong"); @@ -4548,7 +4548,7 @@ QUnit.test('Test plain values that are not containing mask values', function (as }); var inp = $dtEditor.igDateEditor("field"); - inp.focus(); + inp.trigger("focus"); inp.val("010120180000"); inp.blur(); diff --git a/tests/unit/editors/datePicker/datePicker-test.js b/tests/unit/editors/datePicker/datePicker-test.js index 2491c6ba4..184087308 100644 --- a/tests/unit/editors/datePicker/datePicker-test.js +++ b/tests/unit/editors/datePicker/datePicker-test.js @@ -1138,7 +1138,7 @@ QUnit.test('Change month / year event should pass values accoridngly', function( assert.ok(testYear !== undefined && testMonth !== undefined && testDate !== undefined, "onChangeMonthYear fires correctly on init."); done = assert.async(); this.util.wait(100).then(function() { - editor.igDatePicker("field").focus().select(); + editor.igDatePicker("field").trigger("focus").trigger("select"); $("#ui-datepicker-div").find("a.ui-datepicker-next").click(); assert.equal(testYear, 2018, "The year has changed"); assert.equal(testMonth, 1, "The month has changed"); @@ -1157,7 +1157,7 @@ QUnit.test('Change month / year event should pass values accoridngly', function( } $("#ui-datepicker-div").find(".ui-datepicker-current-day").parent().prev().children().last().click(); editor.data("igDatePicker")._dropDownButton.click(); - editor.igDatePicker("field").focus().select(); + editor.igDatePicker("field").trigger("focus").trigger("select"); $("#ui-datepicker-div").find("a.ui-datepicker-prev").click(); assert.equal(testYear, 2017, "The year has changed"); assert.equal(testMonth, 11, "The month has changed"); diff --git a/tests/unit/editors/maskEditor/mask-test.js b/tests/unit/editors/maskEditor/mask-test.js index fdb15e74f..6b11e500d 100644 --- a/tests/unit/editors/maskEditor/mask-test.js +++ b/tests/unit/editors/maskEditor/mask-test.js @@ -268,7 +268,7 @@ QUnit.test('[ID7] Mask editor selection', function (assert) { listItems: [1, 2, 3] }); - editor.igMaskEditor("field").focus(); + editor.igMaskEditor("field").trigger("focus"); $.ig.TestUtil.wait(200).then(function () { var text = editor.igMaskEditor("getSelectedText"); @@ -316,7 +316,7 @@ QUnit.test('[ID8] Mask editor isValid option in edit mode', function (assert) { inputMask: "&&00" }); - editor.igMaskEditor("field").focus(); + editor.igMaskEditor("field").trigger("focus"); editor.data("igMaskEditor")._enterEditMode(); assert.notOk(editor.igMaskEditor("isValid"), "isValid option should be equal to false as none of the required fields are filled in"); editor.igMaskEditor("field").val("zz__"); @@ -544,7 +544,7 @@ QUnit.test('[ID12] Mask editor validate value against input mask', function (ass inputMask: "CCR00" }); - editor.igMaskEditor("field").focus(); + editor.igMaskEditor("field").trigger("focus"); $.ig.TestUtil.wait(100).then(function () { $.ig.TestUtil.paste(editor.igMaskEditor("field")[0], "aaR15"); @@ -552,12 +552,12 @@ QUnit.test('[ID12] Mask editor validate value against input mask', function (ass }).then(function () { assert.equal(editor.igMaskEditor("field").val(), "aaR15", "The editor value should be aaR15"); editor.igMaskEditor("field").blur(); - editor.igMaskEditor("field").focus(); + editor.igMaskEditor("field").trigger("focus"); editor.igMaskEditor("option", "revertIfNotValid", true); editor.data("igMaskEditor")._processInternalValueChanging("as;dlfkasdfl;kjasf"); assert.equal(editor.igMaskEditor("field").val(), "aaR15", "When revertIfNotValid option is set to true the editor value should be reverted to aaR15 after entering an invalid input"); editor.igMaskEditor("option", "revertIfNotValid", false); - editor.igMaskEditor("field").focus(); + editor.igMaskEditor("field").trigger("focus"); editor.data("igMaskEditor")._processInternalValueChanging("as;dlfkasdfl;kjasf"); assert.equal(editor.igMaskEditor("field").val(), "__R__", "When revertIfNotValid option is set to false the editor field should be reverted to an empty mask with prompts after entering an invalid input"); assert.equal(editor.igMaskEditor("value"), "", "When revertIfNotValid option is set to false the editor value should be reverted to an empty string after entering an invalid input"); @@ -568,7 +568,7 @@ QUnit.test('[ID12] Mask editor validate value against input mask', function (ass assert.ok(editor.data("igMaskEditor")._validateValueAgainstMask(""), "Empty string should be a valid input against editor's mask"); assert.notOk(editor.data("igMaskEditor")._validateValueAgainstMask("ffdd"), "The value ffdd should be invalid against editor's mask"); assert.ok(editor.data("igMaskEditor")._validateRequiredPrompts(""), "Empty string should be valid against editor required prompts"); - editor1.igMaskEditor("field").focus(); + editor1.igMaskEditor("field").trigger("focus"); editor1.data("igMaskEditor")._setCursorPosition(2); var evt = $.Event("keydown"); evt.keyCode = 50; @@ -591,7 +591,7 @@ QUnit.test('[ID13] Mask editor trigger keydown event', function (assert) { value: "VAL" }); - editor1.igMaskEditor("field").focus().select(); + editor1.igMaskEditor("field").trigger("focus").trigger("select"); $.ig.TestUtil.keyInteraction(8, editor1.igMaskEditor("field")); $.ig.TestUtil.keyInteraction(8, editor1.igMaskEditor("field")); assert.equal(editor1.igMaskEditor("field").val(), "___", "Pressing BACKSPACE key should set the editor field to an empty mask with prompts"); @@ -607,7 +607,7 @@ QUnit.test('[ID13] Mask editor trigger keydown event', function (assert) { value: "val" }); - editor2.igMaskEditor("field").focus().select(); + editor2.igMaskEditor("field").trigger("focus").trigger("select"); $.ig.TestUtil.keyInteraction(46, editor2.igMaskEditor("field")); $.ig.TestUtil.keyInteraction(46, editor2.igMaskEditor("field")); assert.equal(editor2.igMaskEditor("field").val(), "___", "Pressing DELETE key should set the editor field to an empty mask with prompts"); @@ -622,7 +622,7 @@ QUnit.test('[ID13] Mask editor trigger keydown event', function (assert) { inputMask: "###" }); - editor3.igMaskEditor("field").focus().select(); + editor3.igMaskEditor("field").trigger("focus").trigger("select"); $.ig.TestUtil.keyInteraction(8, editor3.igMaskEditor("field")); assert.equal(editor3.igMaskEditor("field").val(), "___", "Pressing BACKSPACE key should set the editor field to an empty mask with prompts"); @@ -765,7 +765,7 @@ QUnit.test('[ID15] Mask editor unfilled char prompts', function (assert) { }); var editorInput = editor1.igMaskEditor("field"); - editorInput.focus().select(); + editorInput.trigger("focus").trigger("select"); $.ig.TestUtil.keyInteraction(48, editorInput); assert.equal(editorInput.val(), "000-000-00", "The editor input field value before loosing focus should be 000-000-00"); editorInput.blur(); @@ -834,12 +834,12 @@ QUnit.test('[ID17] Mask editor revertIfNotValid option - digit input mask', func }); var field = editor.igMaskEditor("field"); - field.focus(); + field.trigger("focus"); editor.data("igMaskEditor")._insert("1234"); editor.blur(); assert.equal(field.val(), "1234", "Editor input field value should be 1234"); assert.ok(isTriggered, "The valueChanged event should be triggered."); - field.focus(); + field.trigger("focus"); editor.data("igMaskEditor")._insert("123_"); editor.blur(); assert.equal(field.val(), "1234", "Editor input field value should be reverted to 1234"); @@ -943,7 +943,7 @@ QUnit.test('[ID20] Mask editor show/hide dinamically clear button', function (as var field = editor.igMaskEditor("field"), clearButton = editor.igMaskEditor("clearButton"); assert.notOk(clearButton.is(":visible"), "The clear button should not be visible initilly"); - field.focus(); + field.trigger("focus"); assert.notOk(clearButton.is(":visible"), "The clear button should not be visible on focus"); field.val("someVal"); @@ -1115,7 +1115,7 @@ QUnit.test("[ID25] Unicode characters regex check", function (assert) { field = $editor.igMaskEditor("field"); function enterValue(value){ - $editor.focus()[0].setSelectionRange(0,0); + $editor.trigger("focus")[0].setSelectionRange(0,0); $.ig.TestUtil.type(value, field); } var testValues = [{ @@ -1161,13 +1161,13 @@ QUnit.test("Should properly revert to last valid value", function (assert) { dataMode: "rawText" }); var field = $editor.igMaskEditor("field"); - $editor.focus()[0].setSelectionRange(0,0); + $editor.trigger("focus")[0].setSelectionRange(0,0); $.ig.TestUtil.type("111111111", field); $editor.blur(); - $editor.focus()[0].setSelectionRange(12, 13); + $editor.trigger("focus")[0].setSelectionRange(12, 13); $editor.val("(111) 111-11_"); $editor.blur(); - $editor.focus()[0].setSelectionRange(12,13); + $editor.trigger("focus")[0].setSelectionRange(12,13); $.ig.TestUtil.type("2222", field); $editor.blur(); @@ -1184,7 +1184,7 @@ QUnit.test('Test plain values that are not containing mask values', function (as }); var inp = $editor.igMaskEditor("field"); - inp.focus(); + inp.trigger("focus"); inp.val("010120181200"); inp.blur(); diff --git a/tests/unit/editors/numericEditor/numericEditor-test.js b/tests/unit/editors/numericEditor/numericEditor-test.js index a7c183778..fd3e05d37 100644 --- a/tests/unit/editors/numericEditor/numericEditor-test.js +++ b/tests/unit/editors/numericEditor/numericEditor-test.js @@ -116,7 +116,7 @@ QUnit.test("Events testing", function (assert) { editorInput = $editor.igNumericEditor("field"); text = editorInput.val(); - editorInput.focus(); + editorInput.trigger("focus"); $editor.on("ignumericeditortextchanged", function (evt, args) { assert.equal(args.text, text, "Text changed event is not fired with correct new value"); textChanged++; @@ -210,7 +210,7 @@ QUnit.test("Spin buttons disabling when the min/max value is exceeded", function spinUpButton = $editorInDiv.igNumericEditor("spinUpButton"); spinDownButton = $editorInDiv.igNumericEditor("spinDownButton"); - $editorInDiv.focus(); + $editorInDiv.trigger("focus"); this.util.click(spinUpButton[0]); assert.ok($editorInDiv.igNumericEditor("editorContainer").data("igNotifier") && $editorInDiv.igNumericEditor("editorContainer").igNotifier("isVisible"), "No warning message shown for exceeding max value on spin"); @@ -510,7 +510,7 @@ QUnit.test("Default selectionOnFocus", function (assert) { assert.equal($editor.igNumericEditor("option", "selectionOnFocus"), "browserDefault", "The selectionOnFocus is not correct"); $editor.igNumericEditor("option", "value", "905"); - input.focus(); + input.trigger("focus"); input.blur(); assert.equal($editor.igNumericEditor("value"), "905", "The value is not correct"); }); @@ -568,7 +568,7 @@ QUnit.test("Min/Max value", function (assert) { assert.strictEqual($editor.igNumericEditor("value"), 1, "Value should be set to min"); assert.equal(input.val(), "1", "Text not updated with min value"); - $editor.focus(); + $editor.trigger("focus"); input.val("3"); $editor.igNumericEditor("option", "minValue", 2); assert.strictEqual($editor.igNumericEditor("value"), 2, "Value not set to min while editing"); @@ -861,7 +861,7 @@ QUnit.test("Group and decimal Separators", function (assert) { assert.equal($editor.igNumericEditor("value"), 1264.89, "Decimal value not parsed correctly with decimal ','"); // For 207448: exception is thrown when trying to spin the value (with modified decimalSeparator) - input.focus(); + input.trigger("focus"); this.util.keyInteraction(38, input); //arrow up input.blur(); assert.equal($editor.igNumericEditor("value"), val + $editor.igNumericEditor("option", "spinDelta"), "Decimal value is not correct after spin"); @@ -1047,7 +1047,7 @@ QUnit.test("Typing multiple exponent chars (scientific E-notation)", function (a }); $editor.trigger("focus"); - $editor[0].select(); + $editor.select(); this.util.keyInteraction(101, $editor, "shiftKey"); assert.equal($editor.val(), "1E-7", "E character should not be allowed to replace entire value"); @@ -1374,7 +1374,7 @@ QUnit.test("Lists testing P2, selection-value match", function (assert) { $editor.igNumericEditor("spinUp"); assert.strictEqual($editor.igNumericEditor("value"), 5, "Value not changed on spin method"); - $editor.focus(); + $editor.trigger("focus"); this.util.click($spinUpButton[0]); this.util.click($spinDownButton[0]); assert.equal($editor.igNumericEditor("getSelectedListItem").text(), "44.5", "Selection not changed on spin button in edit mode."); @@ -1443,7 +1443,7 @@ QUnit.test("Lists testing P2, selection-value match", function (assert) { assert.equal($editor.igNumericEditor("getSelectedListItem").text(), "55,47", "decimalSeparator selected item not correct."); $editor.igNumericEditor("value", 12045); - $editor.focus(); + $editor.trigger("focus"); $editor.blur(); assert.equal($editor.igNumericEditor("getSelectedListItem").text(), "12045", "decimalSeparator selected item did not remain correct."); @@ -1459,7 +1459,7 @@ QUnit.test("Lists testing P2, selection-value match", function (assert) { $editor.igNumericEditor("spinDown"); assert.equal($editor.igNumericEditor("getSelectedListItem").text(), "2413,5", "Selected item not correct after spin call"); - $editor.focus(); + $editor.trigger("focus"); $editor.igNumericEditor("spinDown"); assert.equal($editor.igNumericEditor("getSelectedListItem").text(), "2413,5", "Selected item not correct after spin call in edit mode"); @@ -1888,7 +1888,7 @@ QUnit.test("Clear button dynamic show/hide", function (assert) { assert.notOk(clearButton.is(":visible"), "The clear button should not be visible inst illy"); - field.focus(); + field.trigger("focus"); assert.notOk(clearButton.is(":visible"), "The clear button should not be visible on focus"); field.val("10"); @@ -2087,7 +2087,7 @@ QUnit.test("cover _handleSpinUpEvent/_handleSpinDownEvent", function (assert) { //Cover switch cases for _handleSpinUpEvent/_handleSpinDownEvent //_handleSpinUpEvent test All case $editor2.igNumericEditor("option", "selectionOnFocus", 0); - containerInput.focus(); + containerInput.trigger("focus"); this.util.keyInteraction(38, containerInput); //arrow up containerInput.blur(); assert.equal($editor2.igNumericEditor("value"), val + spinDelta, "value is not correct after spin"); @@ -2095,7 +2095,7 @@ QUnit.test("cover _handleSpinUpEvent/_handleSpinDownEvent", function (assert) { $editor2.igNumericEditor("option", "dataMode", "int"); $editor2.igNumericEditor("option", "value", 10); - containerInput.focus(); + containerInput.trigger("focus"); this.util.keyInteraction(38, containerInput); //arrow up containerInput.blur(); assert.equal($editor2.igNumericEditor("value"), val + spinDelta, "value is not correct after spin"); @@ -2106,7 +2106,7 @@ QUnit.test("cover _handleSpinUpEvent/_handleSpinDownEvent", function (assert) { value = containerInput.val(); val = $editor3.igNumericEditor("value"); - containerInput.focus(); + containerInput.trigger("focus"); $editor3.igNumericEditor("select", 1, 2); this.util.keyInteraction(38, containerInput); //arrow up assert.ok((1 <= value.indexOf(decimalSeparator)), "cursor position is not left of decimal separator"); @@ -2117,7 +2117,7 @@ QUnit.test("cover _handleSpinUpEvent/_handleSpinDownEvent", function (assert) { spinDelta = $editor4.igNumericEditor("option", "spinDelta"); $editor4.igNumericEditor("option", "selectionOnFocus", 0); - containerInput.focus(); + containerInput.trigger("focus"); this.util.keyInteraction(40, containerInput); //arrow down containerInput.blur(); assert.equal($editor4.igNumericEditor("value"), val - spinDelta, "value is not correct after spin"); @@ -2125,7 +2125,7 @@ QUnit.test("cover _handleSpinUpEvent/_handleSpinDownEvent", function (assert) { $editor4.igNumericEditor("option", "dataMode", "int"); $editor4.igNumericEditor("option", "value", 10); - containerInput.focus(); + containerInput.trigger("focus"); this.util.keyInteraction(40, containerInput); //arrow down containerInput.blur(); assert.equal($editor4.igNumericEditor("value"), val - spinDelta, "value is not correct after spin"); @@ -2137,14 +2137,14 @@ QUnit.test("cover _handleSpinUpEvent/_handleSpinDownEvent", function (assert) { value = containerInput.val(); val = $editor5.igNumericEditor("value"); - containerInput.focus(); + containerInput.trigger("focus"); $editor5.igNumericEditor("select", 1, 2); this.util.keyInteraction(40, containerInput); //arrow down assert.ok((1 <= value.indexOf(decimalSeparator)), "cursor position is not left of decimal separator"); //test fractional case $editor5.igNumericEditor("option", "value", 0.123); - containerInput.focus(); + containerInput.trigger("focus"); $editor5.igNumericEditor("select", 3, 4); this.util.keyInteraction(40, containerInput); //arrow down assert.ok((1 <= value.indexOf(decimalSeparator)), "cursor position is not left of decimal separator"); diff --git a/tests/unit/editors/percentEditor/percent-test.js b/tests/unit/editors/percentEditor/percent-test.js index 974e42163..e975d66b3 100644 --- a/tests/unit/editors/percentEditor/percent-test.js +++ b/tests/unit/editors/percentEditor/percent-test.js @@ -185,19 +185,19 @@ QUnit.test('[ID5] Testing display factor with default value of 100', function (a // 207134: Entered value of 12.12 is chaged to 12.11 in the Percent Editor var field = editorInput4.igPercentEditor("field"); - field.focus(); + field.trigger("focus"); field.val("12.12"); field.blur(); assert.equal(editorInput4.igPercentEditor("displayValue"), "12.12%", "Decimal percent display value changed"); assert.equal(editorInput4.igPercentEditor("value"), 0.1212, "Decimal percent value changed"); // 20719: Entered value is not correct after blurring the editor - field.focus(); + field.trigger("focus"); field.val("33.33"); field.blur(); assert.equal(editorInput4.igPercentEditor("displayValue"), "33.33%", "Decimal percent display value changed"); assert.equal(editorInput4.igPercentEditor("value"), 0.3333, "Decimal percent value changed"); - field.focus(); + field.trigger("focus"); field.val("15.50"); field.blur(); assert.equal(editorInput4.igPercentEditor("displayValue"), "15.50%", "Decimal percent display value changed"); @@ -240,7 +240,7 @@ QUnit.test('[ID7] Spin functionality', function (assert) { maxValue: 0.6 }); editorInput7.igPercentEditor("value", 0.57); - editorInput7.igPercentEditor("field").focus(); + editorInput7.igPercentEditor("field").trigger("focus"); editorInput7.igPercentEditor("spinDown"); assert.equal(editorInput7.igPercentEditor("field").val(), "56", "Edit value after spin down is not correct"); editorInput7.igPercentEditor("field").blur(); @@ -264,7 +264,7 @@ QUnit.test('[ID8] List items.', function (assert) { }); var field = percentEditorListInput.igPercentEditor("field"); - field.focus(); + field.trigger("focus"); field.val("100"); field.blur(); $.ig.TestUtil.wait(50).then(function () { @@ -405,7 +405,7 @@ QUnit.test('[ID9] Lists testing P2, selection-value match', function (assert) { editorInput.igPercentEditor("spinUp"); assert.strictEqual(editorInput.igPercentEditor("value"), 0.05, "Value not changed on spin method"); - editorInput.focus(); + editorInput.trigger("focus"); util.click(spinUpButton); util.click(spinDownButton); assert.equal(editorInput.igPercentEditor("getSelectedListItem").text(), "44.5", "Selection not changed on spin button in edit mode."); @@ -431,7 +431,7 @@ QUnit.test('[ID9] Lists testing P2, selection-value match', function (assert) { }); assert.equal(editorInput.igPercentEditor("getSelectedListItem").text(), "55,47", "decimalSeparator selected item not correct."); editorInput.igPercentEditor("value", 120.45); - editorInput.focus(); + editorInput.trigger("focus"); editorInput.blur(); assert.equal(editorInput.igPercentEditor("getSelectedListItem").text(), "12045", "decimalSeparator selected item did not remain correct."); @@ -445,7 +445,7 @@ QUnit.test('[ID9] Lists testing P2, selection-value match', function (assert) { editorInput.igPercentEditor("value", 120.45); editorInput.igPercentEditor("spinDown"); assert.equal(editorInput.igPercentEditor("getSelectedListItem").text(), "2413,5", "Selected item not correct after spin call"); - editorInput.focus(); + editorInput.trigger("focus"); editorInput.igPercentEditor("spinDown"); assert.equal(editorInput.igPercentEditor("getSelectedListItem").text(), "2413,5", "Selected item not correct after spin call in edit mode"); @@ -467,7 +467,7 @@ QUnit.test('[ID10] Percent Editor Scientific format', function (assert) { }); var field = editorInput.igPercentEditor("field"); - field.focus(); + field.trigger("focus"); field.val("10"); field.blur(); $.ig.TestUtil.wait(20).then(function () { @@ -513,7 +513,7 @@ QUnit.test('[ID12] Percent Spin up', function (assert) { displayFactor: 1 }); - editorInput.focus(); + editorInput.trigger("focus"); editorInput.igPercentEditor("spinUp"); editorInput.blur(); assert.equal(editorInput.igPercentEditor("displayValue"), "0.01%", "Display value after spin up is not correct"); @@ -564,7 +564,7 @@ QUnit.test('[ID13] Paste and insert', function (assert) { spinWrapAround: true }); - editorInput11.igPercentEditor("field").focus(); + editorInput11.igPercentEditor("field").trigger("focus"); editorInput11.igPercentEditor("insert", "301"); var done = assert.async(); @@ -756,7 +756,7 @@ QUnit.test('[ID18] Spin events with set scientificFormat', function (assert) { scientificFormat: "E" }); - editorInput.focus(); + editorInput.trigger("focus"); assert.equal(editorInput.igPercentEditor("field").val(), "0E0", "The wrong value is set in the editor in edit mode."); editorInput.igPercentEditor("spinUp"); assert.equal(editorInput.igPercentEditor("field").val(), "1E0", "The wrong value is set in the editor in edit mode."); diff --git a/tests/unit/editors/textEditor/textEditor-test.js b/tests/unit/editors/textEditor/textEditor-test.js index 769f1446c..d0013e358 100644 --- a/tests/unit/editors/textEditor/textEditor-test.js +++ b/tests/unit/editors/textEditor/textEditor-test.js @@ -588,7 +588,7 @@ QUnit.test("Lists testing P2, selection-value match", function (assert) { assert.equal(editor.igTextEditor("value"), "item1", "Value not changed on spin button"); assert.ok(this.spinUpButton().hasClass("ui-state-disabled"), "Spin up button not disabled"); - editor.focus(); + editor.trigger("focus"); this.util.mouseEvent(this.spinUpButton(), "mousedown"); this.util.mouseEvent(this.spinUpButton(), "mouseup"); this.util.mouseEvent(this.spinDownButton(), "mousedown"); @@ -713,7 +713,7 @@ QUnit.test("Keyboard/Mouse testing", function (assert) { listItems: ["1", "2", "3"] }); editor.igTextEditor("value", "12345"); - this.input().focus(); + this.input().trigger("focus"); this.util.keyInteraction(65, this.input()); assert.ok(this.container().hasClass($.ui.igNotifier.prototype.css.warningState) && this.container().igNotifier("isVisible"), "MaxLength reached message not shown."); @@ -824,7 +824,7 @@ QUnit.test("Spin buttons", function (assert) { assert.notOk(this.dropDownButton().hasClass("ui-state-disabled"), "Disabled class is not removed from the drop down button"); this.dropDownButton().click(); - this.input().focus(); + this.input().trigger("focus"); // SpinUp using buttons this.util.mouseEvent(this.spinUpButton(), "mouseover"); @@ -1170,7 +1170,7 @@ QUnit.test("Clear button dynamic show/hide", function (assert) { buttonType: "clear" }); assert.notOk(this.clearButton().is(":visible"), "The clear button should not be visible initilly"); - this.input().focus(); + this.input().trigger("focus"); assert.notOk(this.clearButton().is(":visible"), "The clear button should not be visible on focus"); this.input().val("someVal"); editor.data("igTextEditor")._processTextChanged(); diff --git a/tests/unit/knockout/editors/igCurrencyEditor/currency-test.js b/tests/unit/knockout/editors/igCurrencyEditor/currency-test.js index ad9fbe66e..7856434a8 100644 --- a/tests/unit/knockout/editors/igCurrencyEditor/currency-test.js +++ b/tests/unit/knockout/editors/igCurrencyEditor/currency-test.js @@ -113,8 +113,8 @@ QUnit.test("Update model -> editor (input)", function (assert) { var done = assert.async(), self = this; $('#inputEditor1').igCurrencyEditor("setFocus"); - $('#inputEditor1').focus().val(52); - $("#outerInput").focus(); + $('#inputEditor1').trigger("focus").val(52); + $("#outerInput").trigger("focus"); this.util.wait(200).then(function () { self.checkAllValues(52, "Values are as expected"); @@ -133,7 +133,7 @@ QUnit.test("Update model -> editor (div)", function (assert) { $('#divEditor1').igCurrencyEditor("setFocus"); $('#divEditor1').find('input').val(15.3).change(); - $('#outerInput').focus(); + $('#outerInput').trigger("focus"); this.util.wait(200).then(function () { self.checkAllValues(15.3, "Values are as expected"); $("#outerInput").igCurrencyEditor("setFocus"); @@ -152,7 +152,7 @@ QUnit.test("Update model -> editor (td)", function (assert) { $('#tdEditor1').igCurrencyEditor("setFocus"); $('#tdEditor1').find('input').val(369).change(); - $('#outerInput').focus(); + $('#outerInput').trigger("focus"); this.util.wait(200).then(function () { self.checkAllValues(369, "Values are as expected"); $("#outerInput").igCurrencyEditor("setFocus"); @@ -263,8 +263,8 @@ QUnit.test("updateMode -> onChange", function (assert) { ko.applyBindings(this.model, document.getElementById("inputEditor1")); $('#inputEditor1').igCurrencyEditor('setFocus'); - $("#inputEditor1").igCurrencyEditor("field").focus().val(485); - $('#outerInput').focus(); + $("#inputEditor1").igCurrencyEditor("field").trigger("focus").val(485); + $('#outerInput').trigger("focus"); this.checkAllValues(485, "The value is updated on keyUp"); }); diff --git a/tests/unit/knockout/editors/igDateEditor/dateeditor-test.js b/tests/unit/knockout/editors/igDateEditor/dateeditor-test.js index 86aacc8b3..8a23a1ce2 100644 --- a/tests/unit/knockout/editors/igDateEditor/dateeditor-test.js +++ b/tests/unit/knockout/editors/igDateEditor/dateeditor-test.js @@ -233,7 +233,7 @@ QUnit.test('Test value set to non-observable value remains non-observable after // and verify the change is reflected, but the value remains nonObservable. stringDate = "01/01/2009"; editorInput = editor.igDateEditor("field"); - editorInput.focus().val(stringDate); + editorInput.trigger("focus").val(stringDate); editorInput.blur(); assert.equal(editor.igDateEditor("value").toString(), new Date(stringDate).toString(), "Value should be changed when interact through UI"); assert.notOk(ko.isObservable(editor.igDateEditor("value")), "Value should be non-observable"); diff --git a/tests/unit/knockout/editors/igMaskEditor/mask-test.js b/tests/unit/knockout/editors/igMaskEditor/mask-test.js index 9233ddf9a..9fbc5939a 100644 --- a/tests/unit/knockout/editors/igMaskEditor/mask-test.js +++ b/tests/unit/knockout/editors/igMaskEditor/mask-test.js @@ -117,7 +117,7 @@ QUnit.test("Initializing igMaskEditor", function (assert) { editorInput = $("#inputEditor1").igMaskEditor("field").val("9f2s").blur(); this.checkAllValues("9f2s", "The value is updated on change"); - $("#inputValue").focus().val("9f2s").change(); + $("#inputValue").trigger("focus").val("9f2s").change(); this.checkAllValues("9f2s", "Values are as expected"); }); diff --git a/tests/unit/knockout/editors/igNumericEditor/numeric-test.js b/tests/unit/knockout/editors/igNumericEditor/numeric-test.js index bae77233d..f20a52303 100644 --- a/tests/unit/knockout/editors/igNumericEditor/numeric-test.js +++ b/tests/unit/knockout/editors/igNumericEditor/numeric-test.js @@ -113,10 +113,10 @@ QUnit.test("Initializing igNumericEditor", function (assert) { editorInput.val(485).blur(); this.checkAllValues(485, "The value is updated on change"); - $("#inputValue").focus().val(236).change(); + $("#inputValue").trigger("focus").val(236).change(); this.checkAllValues(236, "Values are as expected"); - $("#inputValue").focus().val(23.6).change(); + $("#inputValue").trigger("focus").val(23.6).change(); this.checkAllValues(23.6, "Values are as expected"); ko.cleanNode(this.qunitFixture[0]); @@ -260,7 +260,7 @@ QUnit.test("Value set when bound to a ViewModel's non-observable field", functio this.applyBindings(); this.model.nonObservable2 = 245; assert.equal(this.model.nonObservable2, 245); // check the inital value - editor.focus(); // focus editor + editor.trigger("focus"); // focus editor editor.val(255); // change the editor's value editor.blur(); // lose editor's focus to allow KO to update the binding assert.equal(this.model.nonObservable2, 255); // check for the new value diff --git a/tests/unit/knockout/editors/igPercentEditor/percent-test.js b/tests/unit/knockout/editors/igPercentEditor/percent-test.js index 8a0de6450..e68956581 100644 --- a/tests/unit/knockout/editors/igPercentEditor/percent-test.js +++ b/tests/unit/knockout/editors/igPercentEditor/percent-test.js @@ -112,13 +112,13 @@ QUnit.test("Initializing igPercentEditor", function (assert) { editorInput.val(485).blur(); this.checkAllValues(485, "The value is updated on change"); - $("#inputValue").focus().val(236).change(); + $("#inputValue").trigger("focus").val(236).change(); this.checkAllValues(236, "Values are as expected"); - $("#inputValue").focus().val(23.6).change(); + $("#inputValue").trigger("focus").val(23.6).change(); this.checkAllValues(23.6, "Values are as expected"); - $("#inputValue").focus().val(-26).change(); + $("#inputValue").trigger("focus").val(-26).change(); this.checkAllValues(-26, "Values are as expected"); ko.cleanNode(this.qunitFixture[0]); @@ -314,7 +314,7 @@ QUnit.test("Value set when bound to a ViewModel's non-observable field", functio this.applyBindings(); this.model.nonObservable2 = 245; assert.equal(this.model.nonObservable2, 245); // check the inital value - editor.focus(); // focus editor + editor.trigger("focus"); // focus editor editor.val(255); // change the editor's value editor.blur(); // lose editor's focus to allow KO to update the binding assert.equal(this.model.nonObservable2, 255); // check for the new value diff --git a/tests/unit/knockout/editors/igTextEditor/text-test.js b/tests/unit/knockout/editors/igTextEditor/text-test.js index 0f16d70d4..434dbaac2 100644 --- a/tests/unit/knockout/editors/igTextEditor/text-test.js +++ b/tests/unit/knockout/editors/igTextEditor/text-test.js @@ -120,7 +120,7 @@ QUnit.test("Initializing igTextEditor", function (assert) { editorInput.val("E6X").blur(); this.checkAllValues("E6X", "The value is updated on change"); - $("#inputValue").focus().val("New Pesho").change(); + $("#inputValue").trigger("focus").val("New Pesho").change(); this.checkAllValues("New Pesho", "Values are as expected"); diff --git a/tests/unit/scroll/navigation/navigation-test.js b/tests/unit/scroll/navigation/navigation-test.js index 6c8ed1676..787accdd0 100644 --- a/tests/unit/scroll/navigation/navigation-test.js +++ b/tests/unit/scroll/navigation/navigation-test.js @@ -105,7 +105,7 @@ QUnit.test(testId_1, function (assert) { // Simulate keydown of backspace event var downPressEvent = jQuery.Event("keydown", { keyCode: $.ui.keyCode.DOWN }); - this.scrollContainer(this.vhScrollId).focus(); + this.scrollContainer(this.vhScrollId).trigger("focus"); this.scrollContainer(this.vhScrollId).trigger(downPressEvent); assert.equal(this.scrollContainer(this.vhScrollId).scrollTop(), 40, "scrolled down small increment"); }); @@ -118,7 +118,7 @@ QUnit.test(testId_2, function (assert) { // Simulate keydown of backspace event var upPressEvent = jQuery.Event("keydown", { keyCode: $.ui.keyCode.UP }); - this.scrollContainer(this.vhScrollId).focus(); + this.scrollContainer(this.vhScrollId).trigger("focus"); this.scrollContainer(this.vhScrollId).trigger(upPressEvent); assert.equal(this.scrollContainer(this.vhScrollId).scrollTop(), 60, "scrolled up small increment"); }); @@ -131,7 +131,7 @@ QUnit.test(testId_3, function (assert) { // Simulate keydown of backspace event var leftPressEvent = jQuery.Event("keydown", { keyCode: $.ui.keyCode.LEFT }); - this.scrollContainer(this.vhScrollId).focus(); + this.scrollContainer(this.vhScrollId).trigger("focus"); this.scrollContainer(this.vhScrollId).trigger(leftPressEvent); assert.equal(this.scrollContainer(this.vhScrollId).scrollLeft(), 60, "scrolled left small increment"); }); @@ -142,7 +142,7 @@ QUnit.test(testId_4, function (assert) { // Simulate keydown of backspace event var rightPressEvent = jQuery.Event("keydown", { keyCode: $.ui.keyCode.RIGHT }); - this.scrollContainer(this.vhScrollId).focus(); + this.scrollContainer(this.vhScrollId).trigger("focus"); this.scrollContainer(this.vhScrollId).trigger(rightPressEvent); assert.equal(this.scrollContainer(this.vhScrollId).scrollLeft(), 40, "scrolled right small increment"); }); @@ -154,7 +154,7 @@ QUnit.test(testId_5, function (assert) { // Simulate keydown of backspace event var pageDownPressEvent = jQuery.Event("keydown", { keyCode: $.ui.keyCode.PAGE_DOWN }); - this.scrollContainer(this.vhScrollId).focus(); + this.scrollContainer(this.vhScrollId).trigger("focus"); this.scrollContainer(this.vhScrollId).trigger(pageDownPressEvent); assert.equal(this.scrollContainer(this.vhScrollId).scrollTop(), this.scrollContainer(this.vhScrollId).height(), "scrolled down big increment"); }); @@ -168,7 +168,7 @@ QUnit.test(testId_6, function (assert) { // Simulate keydown of backspace event var pageUpPressEvent = jQuery.Event("keydown", { keyCode: $.ui.keyCode.PAGE_UP }); - this.scrollContainer(this.vhScrollId).focus(); + this.scrollContainer(this.vhScrollId).trigger("focus"); this.scrollContainer(this.vhScrollId).trigger(pageUpPressEvent); assert.equal(this.scrollContainer(this.vhScrollId).scrollTop(), this.scrollContainer(this.vhScrollId).height(), "scrolled down big increment"); }); @@ -180,7 +180,7 @@ QUnit.test(testId_7, function (assert) { // Simulate keydown of backspace event var spacePressEvent = jQuery.Event("keydown", { keyCode: $.ui.keyCode.SPACE }); - this.scrollContainer(this.vhScrollId).focus(); + this.scrollContainer(this.vhScrollId).trigger("focus"); this.scrollContainer(this.vhScrollId).trigger(spacePressEvent); assert.equal(this.scrollContainer(this.vhScrollId).scrollTop(), this.scrollContainer(this.vhScrollId).height(), "scrolled down big increment"); }); @@ -194,7 +194,7 @@ QUnit.test(testId_8, function (assert) { // Simulate keydown of backspace event var spacePressEvent = jQuery.Event("keydown", { keyCode: $.ui.keyCode.SPACE, shiftKey: true }); - this.scrollContainer(this.vhScrollId).focus(); + this.scrollContainer(this.vhScrollId).trigger("focus"); this.scrollContainer(this.vhScrollId).trigger(spacePressEvent); assert.equal(this.scrollContainer(this.vhScrollId).scrollTop(), this.scrollContainer(this.vhScrollId).height(), "scrolled down big increment"); }); diff --git a/tests/unit/splitter/jquery.simulate.js b/tests/unit/splitter/jquery.simulate.js index 1430049c7..f2cf46dfd 100644 --- a/tests/unit/splitter/jquery.simulate.js +++ b/tests/unit/splitter/jquery.simulate.js @@ -176,7 +176,7 @@ $.extend( $.simulate.prototype, { } element.on( "focus", trigger ); - element[ 0 ].focus(); + element[ 0 ].trigger("focus"); if ( !triggered ) { focusinEvent = $.Event( "focusin" ); @@ -203,7 +203,7 @@ $.extend( $.simulate.prototype, { setTimeout(function() { // IE won't let the blur occur if the window is inactive if ( element[ 0 ].ownerDocument.activeElement === element[ 0 ] ) { - element[ 0 ].ownerDocument.body.focus(); + element[ 0 ].ownerDocument.body.trigger("focus"); } // Firefox won't trigger events if the window is inactive diff --git a/tests/unit/splitter/splitter-test.js b/tests/unit/splitter/splitter-test.js index f69f19dde..8bd085eba 100644 --- a/tests/unit/splitter/splitter-test.js +++ b/tests/unit/splitter/splitter-test.js @@ -572,7 +572,7 @@ QUnit.test('Test 9: igSplitter widget drag horizontal split bar test.', function var sliptbars = $('.ui-igsplitter-splitbar-hover'); assert.ok(sliptbars.length === 0, 'igSplitter hover sliptbar is not missing.'); - bar.focus(); + bar.trigger("focus"); bar.simulate("drag", { dy: 200, checkAfterMouseDown: function (target) { diff --git a/tests/unit/tilemanager/tilemanager/tilemanager-test.js b/tests/unit/tilemanager/tilemanager/tilemanager-test.js index 6f5cf3226..7cfbde64f 100644 --- a/tests/unit/tilemanager/tilemanager/tilemanager-test.js +++ b/tests/unit/tilemanager/tilemanager/tilemanager-test.js @@ -58,7 +58,7 @@ QUnit.module("igTileManager unit tests", { getTileManagerTileWidth: function (col, colSpan, colWidth, marginLeft) { var baseWidth = 0, width, i; - if ($.isArray(colWidth)) { + if (Array.isArray(colWidth)) { for (i = col; i < col + colSpan; i++) { baseWidth = baseWidth + colWidth[i]; } @@ -72,7 +72,7 @@ QUnit.module("igTileManager unit tests", { getTileManagerTileHeight: function (row, rowSpan, colHeight, marginTop) { var baseHeight = 0, height, i; - if ($.isArray(colHeight)) { + if (Array.isArray(colHeight)) { for (i = row; i < row + rowSpan; i++) { baseHeight += colHeight[i]; } @@ -87,7 +87,7 @@ QUnit.module("igTileManager unit tests", { var baseLeft = 0, i; if (col > 0) { - if ($.isArray(colWidth)) { + if (Array.isArray(colWidth)) { for (i = 0; i < col; i++) { baseLeft += colWidth[i]; } @@ -103,7 +103,7 @@ QUnit.module("igTileManager unit tests", { var baseTop = 0, top, i; if (row > 0) { - if ($.isArray(colHeight)) { + if (Array.isArray(colHeight)) { for (i = 0; i < row; i++) { baseTop += colHeight[i]; } @@ -139,8 +139,8 @@ QUnit.module("igTileManager unit tests", { padding = 5, tilePaddings = padding * 2 + borderWidth, splitterWidth = splitter.outerWidth(), - rightPanelTilesWidth = rightPanelTilesWidth || ($.isArray(colWidth) ? colWidth[colWidth.length - 1] : colWidth), - rightPanelTilesHeight = rightPanelTilesHeight || ($.isArray(colHeight) ? colHeight[colHeight.length - 1] : colHeight), + rightPanelTilesWidth = rightPanelTilesWidth || (Array.isArray(colWidth) ? colWidth[colWidth.length - 1] : colWidth), + rightPanelTilesHeight = rightPanelTilesHeight || (Array.isArray(colHeight) ? colHeight[colHeight.length - 1] : colHeight), rightPanelHasScroll = showRightPanelScroll && rightPanelHasScroll, rightPanelWidth = rightPanelCols * (rightPanelTilesWidth + marginLeft) + (rightPanelHasScroll ? this.scrollWidth : 0), rightPanelHeight = containerHeight, @@ -166,7 +166,7 @@ QUnit.module("igTileManager unit tests", { // Configuration setup this.assert.equal(layoutConfig.rows, rows, 'Number of rows in the layout configuration did not match.'); this.assert.equal(layoutConfig.cols, cols, 'Number of cols in the layout configuration did not match.'); - if ($.isArray(layoutConfig.columnWidth)) { + if (Array.isArray(layoutConfig.columnWidth)) { for (i = 0; i < layoutConfig.columnWidth.length; i++) { this.assert.equal(layoutConfig.columnWidth[i], colWidth[i], 'The columnWidth[' + i + '] in the layout configuration did not match.'); @@ -175,7 +175,7 @@ QUnit.module("igTileManager unit tests", { this.assert.equal(layoutConfig.columnWidth, colWidth, 'The columnWidth in the layout configuration did not match.'); } - if ($.isArray(layoutConfig.columnHeight)) { + if (Array.isArray(layoutConfig.columnHeight)) { for (i = 0; i < layoutConfig.columnHeight.length; i++) { this.assert.equal(layoutConfig.columnHeight[i], colHeight[i], 'The columnHeight[' + i + '] in the layout configuration did not match.'); diff --git a/tests/unit/validator/validator-tests.js b/tests/unit/validator/validator-tests.js index a15d4b5ab..0f4f307d6 100644 --- a/tests/unit/validator/validator-tests.js +++ b/tests/unit/validator/validator-tests.js @@ -666,12 +666,12 @@ QUnit.test('[ID4] Validator API', function (assert) { date: true }); rangeDateEditor.igValidator("option", "valueRange", [value]); - rangeDateEditor.focus(); + rangeDateEditor.trigger("focus"); rangeDateEditor.val(value.getFullYear() - 1).blur(); assert.equal(rangeDateEditor.igValidator("getErrorMessages")[0], $.ig.Validator.locale.minValueMessage.replace("{0}", value.toLocaleString()), "Wrong date min value message should be displayed"); rangeDateEditor.igValidator("option", "valueRange", [null, value]); - rangeDateEditor.focus(); + rangeDateEditor.trigger("focus"); rangeDateEditor.val(value.getFullYear() + 1).blur(); assert.equal(rangeDateEditor.igValidator("getErrorMessages")[0], $.ig.Validator.locale.maxValueMessage.replace("{0}", value.toLocaleString()), "Wrong date max value message should be displayed"); @@ -878,7 +878,7 @@ QUnit.test('[ID5] Validation targets/types', function (assert) { message: "Value shouldn't be valid over the threshold" }; - validatorInput.focus(); + validatorInput.trigger("focus"); $.ig.TestUtil.keyInteraction(65, validatorInput); $.ig.TestUtil.keyInteraction(66, validatorInput); $.ig.TestUtil.keyInteraction(67, validatorInput); @@ -1164,7 +1164,7 @@ QUnit.test('[ID7] Execute all rules', function (assert) { assert.equal(diff.length, 0, "Failed rules event args should match the expected ones, diff: " + diff); } }); - field.focus(); + field.trigger("focus"); $.ig.TestUtil.keyInteraction(65, field); check.message = "Must contain at least one number"; @@ -1183,7 +1183,7 @@ QUnit.test('[ID7] Execute all rules', function (assert) { return false; } }); - field1.focus(); + field1.trigger("focus"); $.ig.TestUtil.keyInteraction(65, field1); check.errorMessages = ["Entry should be at least 2 character(s) long", "Must contain at least one number", "This field needs attention"]; messages = getNotifierMessages(field1); @@ -1257,7 +1257,7 @@ QUnit.test('[ID8] #1102 Setting valueRange min/max to null causes exceptions', f field.igValidator({ valueRange: { min: 10, max: null } }); - field.focus(); + field.trigger("focus"); field.val(5); field.blur(); assert.notOk(field.igValidator("isValid"), "Value below min should not be valid"); @@ -1268,7 +1268,7 @@ QUnit.test('[ID8] #1102 Setting valueRange min/max to null causes exceptions', f field1.igValidator({ valueRange: { min: null, max: 50 } }); - field1.focus(); + field1.trigger("focus"); field1.val(-44); field1.blur(); assert.ok(field.igValidator("isValid"), "Value below max should be valid"); @@ -1373,7 +1373,7 @@ QUnit.test('[ID9] igControls integration', function (assert) { } }); - textbox.igTextEditor("field").focus(); + textbox.igTextEditor("field").trigger("focus"); $.ig.TestUtil.keyInteraction(51, textbox.igTextEditor("field"), null, true); // enter 3 value = ""; valid = false; @@ -1387,7 +1387,7 @@ QUnit.test('[ID9] igControls integration', function (assert) { // Bug 209772: validation onchange does not work correctly when in edit mode assert.strictEqual(ui.value, 3, "Spin editor event args value on validating"); }); - spinEditor.igNumericEditor("field").focus(); + spinEditor.igNumericEditor("field").trigger("focus"); $.ig.TestUtil.keyInteraction(51, spinEditor.igNumericEditor("field"), null, true); // enter 3 spinEditor.one("igvalidatorvalidated", function (evt, ui) { diff --git a/tests/unit/videoplayer/videoplayer-test.js b/tests/unit/videoplayer/videoplayer-test.js index 034d8e579..fcff0deef 100644 --- a/tests/unit/videoplayer/videoplayer-test.js +++ b/tests/unit/videoplayer/videoplayer-test.js @@ -804,7 +804,7 @@ QUnit.test('igVideoPlayer keyboard navigation between control buttons test 25', ev = jQuery.Event('keydown'); ev.keyCode = $.ui.keyCode.END; - slider.focus(); + slider.trigger("focus"); slider.trigger(ev); setTimeout(function(){ @@ -829,12 +829,12 @@ QUnit.test('igVideoPlayer keyboard navigation between control buttons test 25', ev = jQuery.Event('keydown'); ev.keyCode = $.ui.keyCode.SPACE; - $("#player13_ctrls_play").focus(); + $("#player13_ctrls_play").trigger("focus"); $("#player13_ctrls_play").trigger(ev); checkElementClass($("#player13_ctrls_play_lbl"), 'ui-icon-pause', assert); - $("#player13_ctrls_fs_btn_lbl").focus(); + $("#player13_ctrls_fs_btn_lbl").trigger("focus"); $("#player13_ctrls_fs_btn_lbl").trigger('click'); @@ -860,7 +860,7 @@ QUnit.test('igVideoPlayer keyboard navigation between control buttons test 25', $("#player13_banner_grid0").trigger('click'); window.open = windowOpen; - $("#player13_ctrls_vc_btn").focus(); + $("#player13_ctrls_vc_btn").trigger("focus"); ev = jQuery.Event('keydown'); ev.keyCode = $.ui.keyCode.TAB; @@ -878,7 +878,7 @@ QUnit.test('igVideoPlayer keyboard navigation between control buttons test 25', // assert.ok(vsPosNew > vsPos); - // vs.focus(); + // vs.trigger("focus"); // ev = jQuery.Event('keydown'); // ev.keyCode = $.ui.keyCode.TAB; // vs.trigger(ev);