aboutsummaryrefslogtreecommitdiffstats
path: root/test/ng/snifferSpec.js
diff options
context:
space:
mode:
authorIgor Minar2012-05-06 09:27:10 -0700
committerIgor Minar2012-05-06 23:01:33 -0700
commit49dfdf8f0238ef8c473fcb44694f6b5696ecde70 (patch)
treedb9e407863a264356d52172e089159bb5fb647a1 /test/ng/snifferSpec.js
parent5bcb749abb91dba0847cb9bc900777a67fd55aa8 (diff)
downloadangular.js-49dfdf8f0238ef8c473fcb44694f6b5696ecde70.tar.bz2
fix(ngModel): use keydown/change events on IE9 instead of input
On IE9 the input event is not fired when backspace or delete key are pressed or when cut is performed. This makes listening on the input event unreliable and therefore it's better for us to just use keydown/change events instead. Closes #879
Diffstat (limited to 'test/ng/snifferSpec.js')
-rw-r--r--test/ng/snifferSpec.js20
1 files changed, 14 insertions, 6 deletions
diff --git a/test/ng/snifferSpec.js b/test/ng/snifferSpec.js
index 4e5f50ec..81a0db5e 100644
--- a/test/ng/snifferSpec.js
+++ b/test/ng/snifferSpec.js
@@ -45,10 +45,10 @@ describe('$sniffer', function() {
});
- it('should return true if "oninput" is present in a div element', function() {
- mockDivElement = {oninput: noop};
+ it('should return true if "onchange" is present in a div element', function() {
+ mockDivElement = {onchange: noop};
- expect($sniffer.hasEvent('input')).toBe(true);
+ expect($sniffer.hasEvent('change')).toBe(true);
});
@@ -62,11 +62,19 @@ describe('$sniffer', function() {
it('should only create the element once', function() {
mockDivElement = {};
- $sniffer.hasEvent('input');
- $sniffer.hasEvent('input');
- $sniffer.hasEvent('input');
+ $sniffer.hasEvent('change');
+ $sniffer.hasEvent('change');
+ $sniffer.hasEvent('change');
expect(mockDocument.createElement).toHaveBeenCalledOnce();
});
+
+
+ it('should claim that IE9 doesn\'t have support for "oninput"', function() {
+ // IE9 implementation is fubared, so it's better to pretend that it doesn't have the support
+ mockDivElement = {oninput: noop};
+
+ expect($sniffer.hasEvent('input')).toBe((msie == 9) ? false : true);
+ });
});
});