env.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /**
  2. * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. import env, { isEdge, isMac } from '../src/env';
  6. describe( 'Env', () => {
  7. beforeEach( () => {
  8. } );
  9. it( 'is an object', () => {
  10. expect( env ).to.be.an( 'object' );
  11. } );
  12. describe( 'isMac', () => {
  13. it( 'is a boolean', () => {
  14. expect( env.isMac ).to.be.a( 'boolean' );
  15. } );
  16. } );
  17. describe( 'isEdge', () => {
  18. it( 'is a boolean', () => {
  19. expect( env.isEdge ).to.be.a( 'boolean' );
  20. } );
  21. } );
  22. describe( 'isMac()', () => {
  23. it( 'returns true for macintosh UA strings', () => {
  24. expect( isMac( 'macintosh' ) ).to.be.true;
  25. expect( isMac( 'foo macintosh bar' ) ).to.be.true;
  26. } );
  27. it( 'returns false for non–macintosh UA strings', () => {
  28. expect( isMac( '' ) ).to.be.false;
  29. expect( isMac( 'mac' ) ).to.be.false;
  30. expect( isMac( 'foo' ) ).to.be.false;
  31. } );
  32. } );
  33. describe( 'isEdge()', () => {
  34. it( 'returns true for Edge UA strings', () => {
  35. expect( isEdge( 'edge' ) ).to.be.true;
  36. expect( isEdge( 'foo edge bar' ) ).to.be.true;
  37. } );
  38. it( 'returns false for non–Edge UA strings', () => {
  39. expect( isEdge( '' ) ).to.be.false;
  40. expect( isEdge( 'mac' ) ).to.be.false;
  41. expect( isEdge( 'foo' ) ).to.be.false;
  42. } );
  43. } );
  44. } );