@@ -21,7 +21,7 @@ import {
2121 isIOS ,
2222 isAndroidWebView ,
2323} from '../browser' ;
24- import { isFF , isGecko } from '../firefox' ;
24+ import { isFF , isGecko , getFFVersion } from '../firefox' ;
2525
2626describe ( 'browser Utils' , ( ) => {
2727 const win = ( obj : any = { } ) => {
@@ -352,6 +352,41 @@ describe('browser Utils', () => {
352352 ) . to . be . true ;
353353 } ) ;
354354
355+ it ( 'isFFVersion' , ( ) => {
356+ chai . assert (
357+ getFFVersion ( win ( 'Something' ) ) === 0 ,
358+ 'false for something that not looks like Firefox' ,
359+ ) ;
360+ chai . assert (
361+ getFFVersion ( ffWin ( ) ) === 123 ,
362+ 'true if Firefox and version >= requested one' ,
363+ ) ;
364+ chai . expect (
365+ getFFVersion ( ffWin ( ) ) ,
366+ 'false if Firefox and version < requested one' ,
367+ ) . to . be . lt ( 200 ) ;
368+ } ) ;
369+
370+ it ( 'returns Firefox version for Windows UA' , ( ) => {
371+ const ctx = win ( {
372+ navigator : {
373+ userAgent :
374+ 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:147.0) Gecko/20100101 Firefox/147.0' ,
375+ } ,
376+ } ) ;
377+ chai . expect ( getFFVersion ( ctx ) ) . to . eq ( 147 ) ;
378+ } ) ;
379+
380+ it ( 'returns Firefox version for macOS UA' , ( ) => {
381+ const ctx = win ( {
382+ navigator : {
383+ userAgent :
384+ 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:148.0) Gecko/20100101 Firefox/148.0' ,
385+ } ,
386+ } ) ;
387+ chai . expect ( getFFVersion ( ctx ) ) . to . eq ( 148 ) ;
388+ } ) ;
389+
355390 it ( 'check isIOS' , ( ) => {
356391 chai . expect (
357392 isIOS (
0 commit comments