diff --git a/package.json b/package.json index 33f81efc..3d7ded4c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "anchor-ui", - "version": "6.1.0", + "version": "6.1.1", "description": "React Component UI Kit", "main": "dist/index.js", "files": [ diff --git a/src/internal/mobile-detect.js b/src/internal/mobile-detect.js index f544fad7..d6a91e72 100644 --- a/src/internal/mobile-detect.js +++ b/src/internal/mobile-detect.js @@ -1,6 +1,6 @@ import MobileDetect from 'mobile-detect'; import get from 'lodash/get'; -const userAgent = get(window, 'navigator.userAgent', ''); +const userAgent = get(get(global, 'window', {}), 'navigator.userAgent', ''); export default new MobileDetect(userAgent); diff --git a/test/internal/mobile-detect.js b/test/internal/mobile-detect.js index b66a21a7..707dcb58 100644 --- a/test/internal/mobile-detect.js +++ b/test/internal/mobile-detect.js @@ -1,6 +1,7 @@ /* eslint-env mocha */ import { expect } from 'chai'; import MobileDetect from 'mobile-detect'; +import md from '../../src/internal/mobile-detect'; describe('MobileDetect', () => { beforeEach(() => { @@ -12,8 +13,6 @@ describe('MobileDetect', () => { }); it('should return an instance of MobileDetect', () => { - const md = require('../../src/internal/mobile-detect'); // eslint-disable-line global-require - expect(md).to.be.an.instanceof(MobileDetect); }); });