Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Changed: Rename env.mac to env.isMac. #223

Merged
merged 1 commit into from
Feb 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ const env = {
* Indicates that application is running on Macintosh.
*
* @static
* @member {Boolean} module:utils/env~env#mac
* @member {Boolean} module:utils/env~env#isMac
*/
mac: isMac( userAgent )
isMac: isMac( userAgent )
};

export default env;
Expand Down
2 changes: 1 addition & 1 deletion src/keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export function parseKeystroke( keystroke ) {
* @returns {String} Keystroke text specific for the environment.
*/
export function getEnvKeystrokeText( keystroke ) {
if ( !env.mac ) {
if ( !env.isMac ) {
return keystroke;
}

Expand Down
6 changes: 3 additions & 3 deletions tests/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ describe( 'Env', () => {
expect( env ).to.be.an( 'object' );
} );

describe( 'mac', () => {
describe( 'isMac', () => {
it( 'is a boolean', () => {
expect( env.mac ).to.be.a( 'boolean' );
expect( env.isMac ).to.be.a( 'boolean' );
} );
} );

describe( 'isMac', () => {
describe( 'isMac()', () => {
it( 'returns true for macintosh UA strings', () => {
expect( isMac( 'macintosh' ) ).to.be.true;
expect( isMac( 'foo macintosh bar' ) ).to.be.true;
Expand Down
8 changes: 4 additions & 4 deletions tests/keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@ describe( 'Keyboard', () => {
} );

describe( 'getEnvKeystrokeText', () => {
const initialEnvMac = env.mac;
const initialEnvMac = env.isMac;

afterEach( () => {
env.mac = initialEnvMac;
env.isMac = initialEnvMac;
} );

describe( 'on Macintosh', () => {
beforeEach( () => {
env.mac = true;
env.isMac = true;
} );

it( 'replaces CTRL with ⌘', () => {
Expand Down Expand Up @@ -147,7 +147,7 @@ describe( 'Keyboard', () => {

describe( 'on non–Macintosh', () => {
beforeEach( () => {
env.mac = false;
env.isMac = false;
} );

it( 'does not touch anything', () => {
Expand Down