aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Minar2013-01-16 10:51:24 -0800
committerIgor Minar2013-01-16 23:26:36 -0800
commit8b9e6c3501746edb2c9e2d585e8e0eaeb8ba8327 (patch)
tree31b43664e369b4943ac373cfaf931d979d00066d
parentc97c53dbd43072c12bf0560730bed654e382e265 (diff)
downloadangular.js-8b9e6c3501746edb2c9e2d585e8e0eaeb8ba8327.tar.bz2
fix(scenario): don't trigger input events on IE9
input.enter() should trigger 'change' rather than 'input' event on IE9 because input events on IE9 are broken and angular doesn't rely on them
-rw-r--r--src/ngScenario/dsl.js4
-rw-r--r--test/ngScenario/dslSpec.js24
2 files changed, 19 insertions, 9 deletions
diff --git a/src/ngScenario/dsl.js b/src/ngScenario/dsl.js
index 2f3ca18e..81d74233 100644
--- a/src/ngScenario/dsl.js
+++ b/src/ngScenario/dsl.js
@@ -198,13 +198,13 @@ angular.scenario.dsl('binding', function() {
*/
angular.scenario.dsl('input', function() {
var chain = {};
- var supportInputEvent = 'oninput' in document.createElement('div');
+ var supportInputEvent = 'oninput' in document.createElement('div') && msie != 9;
chain.enter = function(value, event) {
return this.addFutureAction("input '" + this.name + "' enter '" + value + "'", function($window, $document, done) {
var input = $document.elements('[ng\\:model="$1"]', this.name).filter(':input');
input.val(value);
- input.trigger(event || supportInputEvent && 'input' || 'change');
+ input.trigger(event || (supportInputEvent ? 'input' : 'change'));
done();
});
};
diff --git a/test/ngScenario/dslSpec.js b/test/ngScenario/dslSpec.js
index 2db2771c..e955b017 100644
--- a/test/ngScenario/dslSpec.js
+++ b/test/ngScenario/dslSpec.js
@@ -269,7 +269,7 @@ describe("angular.scenario.dsl", function() {
$root.dsl.select('test').options('A', 'B');
expect($root.futureError).toMatch(/did not match/);
});
-
+
it('should fail to select an option that does not exist', function(){
doc.append(
'<select ng-model="test">' +
@@ -596,12 +596,22 @@ describe("angular.scenario.dsl", function() {
});
describe('Input', function() {
- it('should change value in text input', function() {
- doc.append('<input ng-model="test.input" value="something">');
- var chain = $root.dsl.input('test.input');
- chain.enter('foo');
- expect(_jQuery('input[ng-model="test.input"]').val()).toEqual('foo');
- });
+ it('should change value in text input', inject(function($compile) {
+ runs(function() {
+ element = $compile('<input ng-model="test.input" value="something">')($root);
+ doc.append(element);
+ var chain = $root.dsl.input('test.input');
+ chain.enter('foo');
+ expect(_jQuery('input[ng-model="test.input"]').val()).toEqual('foo');
+ });
+
+ // cleanup the event queue
+ waits(0);
+
+ runs(function() {
+ expect($root.test.input).toBe('foo');
+ });
+ }));
it('should change value in text input in dash form', function() {
doc.append('<input ng-model="test.input" value="something">');