Fix tests
This commit is contained in:
@@ -11,8 +11,9 @@
|
||||
|
||||
import { contains } from './Generic.js';
|
||||
|
||||
let userAgent = navigator.userAgent;
|
||||
let platform = navigator.platform;
|
||||
let isNode = (typeof navigator == 'undefined') ? true : false;
|
||||
let userAgent = (isNode) ? 'node' : navigator.userAgent;
|
||||
let platform = (isNode) ? 'node' : navigator.platform;
|
||||
|
||||
export let isFirefox = !!~userAgent.indexOf('Firefox');
|
||||
export let isMSIE = !!~userAgent.indexOf('MSIE');
|
||||
@@ -20,7 +21,7 @@ export let isMSIE = !!~userAgent.indexOf('MSIE');
|
||||
// Find the users platform. We use this to interpret the meta key
|
||||
// and ISO third level shifts.
|
||||
// http://stackoverflow.com/q/19877924/577598
|
||||
export let isMac = contains(platform, ['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K']);
|
||||
export let isMac = contains(['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'], platform);
|
||||
export let isIpad = platform === 'iPad';
|
||||
export let isIphone = platform === 'iPhone';
|
||||
export let isMSWindows = contains(platform, ['Windows', 'Win16', 'Win32', 'WinCE']);
|
||||
export let isMSWindows = contains(['Windows', 'Win16', 'Win32', 'WinCE'], platform);
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
* @module xterm/utils/Generic
|
||||
*/
|
||||
|
||||
export let contains = function(el, arr) {
|
||||
for (var i = 0; i < arr.length; i += 1) {
|
||||
if (el === arr[i]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
/**
|
||||
* Return if the given array contains the given element
|
||||
* @param {Array} array The array to search for the given element.
|
||||
* @param {Object} el The element to look for into the array
|
||||
*/
|
||||
export let contains = function(arr, el) {
|
||||
return arr.indexOf(el) >= 0;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user