File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515/**
1616 * Returns whether the current runtime is a mobile one (true) or not (false).
1717 *
18- * @private
18+ * @public
1919 * @returns {Promise<bool> }
2020 */
21- async function isMobile ( ) {
21+ export async function isMobile ( ) {
2222 const platformInfo = await browser . runtime . getPlatformInfo ( ) ;
2323
2424 return platformInfo . os === "android" ;
@@ -29,10 +29,10 @@ async function isMobile() {
2929*
3030* This includes Firefox and Thunderbird e.g.
3131*
32- * @private
32+ * @public
3333* @returns {Promise<bool> }
3434*/
35- async function isMozilla ( ) {
35+ export async function isMozilla ( ) {
3636 const browserInfo = await browser . runtime . getBrowserInfo ( ) ;
3737
3838 // Thunderbird is explicitly checked as a workaround as Thunderbird does not return the vendor correctly
@@ -46,10 +46,10 @@ async function isMozilla() {
4646*
4747* This does not include Thunderbird!
4848*
49- * @private
49+ * @public
5050* @returns {Promise<bool> }
5151*/
52- async function isFirefox ( ) {
52+ export async function isFirefox ( ) {
5353 const browserInfo = await browser . runtime . getBrowserInfo ( ) ;
5454
5555 return browserInfo . name === "Firefox" ;
Original file line number Diff line number Diff line change 1+ import "https://unpkg.com/mocha@5.2.0/mocha.js" ; /* globals mocha */
2+ import "https://unpkg.com/chai@4.1.2/chai.js" ; /* globals chai */
3+ import "https://unpkg.com/sinon@6.1.5/pkg/sinon.js" ; /* globals sinon */
4+
5+ import * as EnvironmentalOptions from "../EnvironmentalOptions.js" ;
6+
7+ describe ( "options module: AutomaticSettings.EnvironmentalOptions" , function ( ) {
8+ describe ( "isMobile()" , function ( ) {
9+ it ( "returns true as browser is a mobile browser" , async function ( ) {
10+ const result = await EnvironmentalOptions . isMobile ( ) ;
11+
12+ chai . assert . isTrue ( result ) ;
13+ } ) ;
14+ } ) ;
15+
16+ describe ( "isMozilla()" , function ( ) {
17+ it ( "returns true as browser is a Mozilla browser" , async function ( ) {
18+ const result = await EnvironmentalOptions . isMozilla ( ) ;
19+
20+ chai . assert . isTrue ( result ) ;
21+ } ) ;
22+ } ) ;
23+
24+ describe ( "isFirefox()" , function ( ) {
25+ it ( "returns true as browser is a Mozilla Firefox" , async function ( ) {
26+ const result = await EnvironmentalOptions . isFirefox ( ) ;
27+
28+ chai . assert . isTrue ( result ) ;
29+ } ) ;
30+ } ) ;
31+ } ) ;
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import "https://unpkg.com/mocha@5.2.0/mocha.js"; /* globals mocha */
22
33/* tests */
44import "./automaticSettings.test.js" ;
5+ import "./environmentalOptions.test.js" ;
56
67mocha . checkLeaks ( ) ;
78mocha . run ( ) ;
You can’t perform that action at this time.
0 commit comments