Sha256: 2c872aa2b4e93b6513a8eb4a256ec507f5bdd537ba194aec5f9fadfbe54418e5
Contents?: true
Size: 1.23 KB
Versions: 7
Compression:
Stored size: 1.23 KB
Contents
new Test.Unit.Runner({ testBrowserDetection: function() { var results = $H(Prototype.Browser).map(function(engine){ return engine; }).partition(function(engine){ return engine[1] === true }); var trues = results[0], falses = results[1]; this.info('User agent string is: ' + navigator.userAgent); this.assert(trues.size() == 0 || trues.size() == 1, 'There should be only one or no browser detected.'); // we should have definite trues or falses here trues.each(function(result) { this.assert(result[1] === true); }, this); falses.each(function(result) { this.assert(result[1] === false); }, this); if(navigator.userAgent.indexOf('AppleWebKit/') > -1) { this.info('Running on WebKit'); this.assert(Prototype.Browser.WebKit); } if(!!window.opera) { this.info('Running on Opera'); this.assert(Prototype.Browser.Opera); } if(!!(window.attachEvent && !window.opera)) { this.info('Running on IE'); this.assert(Prototype.Browser.IE); } if(navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1) { this.info('Running on Gecko'); this.assert(Prototype.Browser.Gecko); } } });
Version data entries
7 entries across 7 versions & 3 rubygems