@@ -14,39 +14,44 @@ suite('Base', function () {
14
14
15
15
info ( 'User agent string is: ' + navigator . userAgent ) ;
16
16
17
- assert ( trues . size ( ) === 0 || trues . size ( ) === 1 ,
18
- 'There should be only one or no browser detected.' ) ;
19
-
20
- // we should have definite trues or falses here
21
- trues . each ( function ( result ) {
22
- assert ( result [ 1 ] === true ) ;
23
- } , this ) ;
24
- falses . each ( function ( result ) {
25
- assert ( result [ 1 ] === false ) ;
26
- } , this ) ;
27
-
28
- var ua = navigator . userAgent ;
29
-
30
- if ( ua . indexOf ( 'AppleWebKit/' ) > - 1 ) {
31
- info ( 'Running on WebKit' ) ;
32
- assert ( Prototype . Browser . WebKit ) ;
33
- }
34
-
35
- if ( Object . prototype . toString . call ( window . opera ) === '[object Opera]' ) {
36
- info ( 'Running on Opera' ) ;
37
- assert ( Prototype . Browser . Opera ) ;
38
- }
39
-
40
- if ( ua . indexOf ( 'MSIE' ) > - 1 ) {
41
- info ( 'Running on IE' ) ;
42
- assert ( Prototype . Browser . IE ) ;
43
- }
44
-
45
- if ( ua . indexOf ( 'Gecko' ) > - 1 && ua . indexOf ( 'KHTML' ) === - 1 ) {
46
- info ( 'Running on Gecko' ) ;
47
- assert ( Prototype . Browser . Gecko ) ;
48
- }
49
-
17
+ // It's OK for there to be two true values if we're on MobileSafari,
18
+ // since it's also a WebKit browser.
19
+ if ( Prototype . Browser . MobileSafari ) {
20
+ assert ( trues . size ( ) === 2 , 'MobileSafari should also identify as WebKit.' ) ;
21
+ } else {
22
+ assert ( trues . size ( ) === 0 || trues . size ( ) === 1 ,
23
+ 'There should be only one or no browser detected.' ) ;
24
+ }
25
+
26
+ // we should have definite trues or falses here
27
+ trues . each ( function ( result ) {
28
+ assert ( result [ 1 ] === true ) ;
29
+ } , this ) ;
30
+ falses . each ( function ( result ) {
31
+ assert ( result [ 1 ] === false ) ;
32
+ } , this ) ;
33
+
34
+ var ua = navigator . userAgent ;
35
+
36
+ if ( ua . indexOf ( 'AppleWebKit/' ) > - 1 ) {
37
+ info ( 'Running on WebKit' ) ;
38
+ assert ( Prototype . Browser . WebKit ) ;
39
+ }
40
+
41
+ if ( Object . prototype . toString . call ( window . opera ) === '[object Opera]' ) {
42
+ info ( 'Running on Opera' ) ;
43
+ assert ( Prototype . Browser . Opera ) ;
44
+ }
45
+
46
+ if ( ua . indexOf ( 'MSIE' ) > - 1 ) {
47
+ info ( 'Running on IE' ) ;
48
+ assert ( Prototype . Browser . IE ) ;
49
+ }
50
+
51
+ if ( ua . indexOf ( 'Gecko' ) > - 1 && ua . indexOf ( 'KHTML' ) === - 1 ) {
52
+ info ( 'Running on Gecko' ) ;
53
+ assert ( Prototype . Browser . Gecko ) ;
54
+ }
50
55
} ) ;
51
56
52
57
} ) ;
0 commit comments