コード例 #1
0
ファイル: detect.spec.js プロジェクト: BaiduTrust/mvoice
                        UAS[ pf ][ bs ].forEach(function ( val ) {
                            var _env = detect( val[ 0 ] );
                            var _browser = val[ 1 ].split( ',' );
                            var _os = val[ 2 ].length ? val[ 2 ].split( ',' ) : [];

                            expect( _env.browser.version ).toEqual( _browser.pop() );
                            expect(
                                _browser.every(function ( key ) {
                                    return _env.browser[ key ] === true;
                                })
                            ).toEqual( true );

                            if ( _os.length ) {
                                expect( _env.os.version ).toEqual( _os.pop() );
                                expect(
                                    _os.every(function ( key ) {
                                        return _env.os[ key ] === true;
                                    })
                                ).toEqual( true );
                            }

                        });
コード例 #2
0
ファイル: detect.spec.js プロジェクト: BaiduTrust/mvoice
 it( 'should return correct.', function() {
     var env = detect( navigator.userAgent );
     expect( typeof env ).toEqual( 'object' );
     expect( typeof env.os ).toEqual( 'object' );
     expect( typeof env.browser ).toEqual( 'object' );
 });