Skip to content
This repository has been archived by the owner on Dec 21, 2021. It is now read-only.

Commit

Permalink
AUI-749 - SF
Browse files Browse the repository at this point in the history
  • Loading branch information
ipeychev authored and eduardolundgren committed Feb 5, 2014
1 parent 9497669 commit 38ebcfb
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 33 deletions.
17 changes: 6 additions & 11 deletions src/aui-event/js/aui-event-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,11 @@ A.Event.define('input', {
*/
_dispatchEvent: function(subscription, notifier, event) {
var instance = this,
input = event.target,
input,
valueBeforeKey;

input = event.target;

// Since cut, drop and paste events fires before the element is focused,
// skip focus checking.
if (_SKIP_FOCUS_CHECK_MAP[event.type] ||
Expand All @@ -146,14 +148,7 @@ A.Event.define('input', {
valueBeforeKey = KeyMap.isKey(event.keyCode, 'WIN_IME') ? null : input.get(STR_VALUE);

subscription._timer = A.soon(
A.bind(
'_fireEvent',
instance,
subscription,
notifier,
event,
valueBeforeKey
)
A.bind('_fireEvent', instance, subscription, notifier, event, valueBeforeKey)
);
}
}
Expand All @@ -173,10 +168,10 @@ A.Event.define('input', {
var instance = this,
input = event.target;

subscription._timer = null;

if (input.get(STR_VALUE) !== valueBeforeKey) {
notifier.fire(event);
}

subscription._timer = null;
}
});
45 changes: 23 additions & 22 deletions src/aui-event/tests/unit/js/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ YUI.add('aui-event-tests', function(Y) {
_should: {
ignore: {
'input event': hasNativeInput,
'detach input event': hasNativeInput
'detach input event': hasNativeInput,
'do not dispatch on not modifying keys': hasNativeInput
}
},

Expand Down Expand Up @@ -57,9 +58,9 @@ YUI.add('aui-event-tests', function(Y) {

Y.Mock.expect(
mock, {
method: 'onInput',
args: [YUITest.Mock.Value.Object],
callCount: 1
callCount: 1,
method: 'onInput'
}
);

Expand Down Expand Up @@ -92,9 +93,9 @@ YUI.add('aui-event-tests', function(Y) {

Y.Mock.expect(
mock, {
method: 'onInput',
args: [YUITest.Mock.Value.Object],
callCount: 1
callCount: 1,
method: 'onInput'
}
);

Expand Down Expand Up @@ -138,9 +139,9 @@ YUI.add('aui-event-tests', function(Y) {

Y.Mock.expect(
mock, {
method: 'onInput',
args: [YUITest.Mock.Value.Object],
callCount: 0
callCount: 0,
method: 'onInput'
}
);

Expand All @@ -149,22 +150,16 @@ YUI.add('aui-event-tests', function(Y) {
);

nonModifyingKeys = [
KeyMap.SHIFT,
KeyMap.CTRL,
KeyMap.ALT,
KeyMap.PAUSE,
KeyMap.CAPS_LOCK,
KeyMap.ESC,
KeyMap.PAGE_UP,
KeyMap.PAGE_DOWN,
KeyMap.END,
KeyMap.HOME,
KeyMap.LEFT,
KeyMap.UP,
KeyMap.RIGHT,
KeyMap.CTRL,
KeyMap.DOWN,
KeyMap.PRINT_SCREEN,
KeyMap.END,
KeyMap.ESC,
KeyMap.F1,
KeyMap.F10,
KeyMap.F11,
KeyMap.F12,
KeyMap.F2,
KeyMap.F3,
KeyMap.F4,
Expand All @@ -173,10 +168,16 @@ YUI.add('aui-event-tests', function(Y) {
KeyMap.F7,
KeyMap.F8,
KeyMap.F9,
KeyMap.F10,
KeyMap.F11,
KeyMap.F12,
KeyMap.HOME,
KeyMap.LEFT,
KeyMap.NUM_LOCK,
KeyMap.PAGE_DOWN,
KeyMap.PAGE_UP,
KeyMap.PAUSE,
KeyMap.PRINT_SCREEN,
KeyMap.RIGHT,
KeyMap.SHIFT,
KeyMap.UP,
KeyMap.WIN_KEY
];

Expand Down

0 comments on commit 38ebcfb

Please sign in to comment.