From d9de6af897cd10425ec4e2cd401ade1b37822f77 Mon Sep 17 00:00:00 2001 From: Dmitriy Stepanov Date: Fri, 26 Jan 2018 10:12:59 +0300 Subject: [PATCH 1/3] feat(input): added drop event support --- src/ng/directive/input.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ng/directive/input.js b/src/ng/directive/input.js index 228f5fb2366a..62dc7b9c9239 100644 --- a/src/ng/directive/input.js +++ b/src/ng/directive/input.js @@ -1308,7 +1308,7 @@ function baseInputType(scope, element, attr, ctrl, $sniffer, $browser) { // if user modifies input value using context menu in IE, we need "paste" and "cut" events to catch it if ($sniffer.hasEvent('paste')) { - element.on('paste cut', deferListener); + element.on('paste cut drop', deferListener); } } From bea821033aaf7a4911f07287228349e451251bf7 Mon Sep 17 00:00:00 2001 From: Dmitriy Stepanov Date: Fri, 26 Jan 2018 10:29:54 +0300 Subject: [PATCH 2/3] test(input): added drop event support --- test/ng/directive/inputSpec.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/test/ng/directive/inputSpec.js b/test/ng/directive/inputSpec.js index 9c58807345d3..93d2184f969d 100644 --- a/test/ng/directive/inputSpec.js +++ b/test/ng/directive/inputSpec.js @@ -439,7 +439,7 @@ describe('input', function() { } }); - describe('"keydown", "paste" and "cut" events', function() { + describe('"keydown", "paste", "cut" and "drop" events', function() { beforeEach(function() { // Force browser to report a lack of an 'input' event $sniffer.hasEvent = function(eventName) { @@ -461,6 +461,18 @@ describe('input', function() { expect($rootScope.name).toEqual('mark'); }); + it('should update the model on "drop" event if the input value changes', function() { + var inputElm = helper.compileInput(''); + + browserTrigger(inputElm, 'keydown'); + $browser.defer.flush(); + expect(inputElm).toBePristine(); + + inputElm.val('mark'); + browserTrigger(inputElm, 'drop'); + $browser.defer.flush(); + expect($rootScope.name).toEqual('mark'); + }); it('should update the model on "cut" event', function() { var inputElm = helper.compileInput(''); From ac5abfa5441a4e524cec66a94e1537abf16dd0c8 Mon Sep 17 00:00:00 2001 From: Dmitriy Stepanov Date: Fri, 26 Jan 2018 11:45:59 +0300 Subject: [PATCH 3/3] chore(input): fix comment --- src/ng/directive/input.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ng/directive/input.js b/src/ng/directive/input.js index 62dc7b9c9239..7d1bec7cfe9d 100644 --- a/src/ng/directive/input.js +++ b/src/ng/directive/input.js @@ -1306,7 +1306,7 @@ function baseInputType(scope, element, attr, ctrl, $sniffer, $browser) { deferListener(event, this, this.value); }); - // if user modifies input value using context menu in IE, we need "paste" and "cut" events to catch it + // if user modifies input value using context menu in IE, we need "paste", "cut" and "drop" events to catch it if ($sniffer.hasEvent('paste')) { element.on('paste cut drop', deferListener); }