Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Commit 9d37069

Browse files
committed
test(number inputs): Safari6 keep the previous value on invalid input
1 parent 89dde01 commit 9d37069

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

test/directive/ng_model_spec.dart

+5-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ library ng_model_spec;
22

33
import '../_specs.dart';
44
import 'dart:html' as dom;
5+
import 'package:browser_detect/browser_detect.dart';
56

67
//-----------------------------------------------------------------------------
78
// Utility functions
@@ -189,12 +190,14 @@ void main() {
189190
expect(element.value).toEqual('1');
190191
expect(_.rootScope.context[modelFieldName]).toEqual(1);
191192

193+
// The following test fails on Safari 6
194+
var failsOnThisBrowser = browser.isSafari && browser.version < "7.0";
192195
simulateTypingText(element, 'e');
193196
// Because the text is not a valid number, the element value is empty.
194-
expect(element.value).toEqual('');
197+
if (!failsOnThisBrowser) expect(element.value).toEqual('');
195198
// When the input is invalid, the model is [double.NAN]:
196199
_.triggerEvent(element, 'change');
197-
expect(_.rootScope.context[modelFieldName].isNaN).toBeTruthy();
200+
if (!failsOnThisBrowser) expect(_.rootScope.context[modelFieldName].isNaN).toBeTruthy();
198201

199202
simulateTypingText(element, '1');
200203
_.triggerEvent(element, 'change');

0 commit comments

Comments
 (0)