Skip to content

Commit

Permalink
Fix native function shadowing problem and enable more Sauce targets
Browse files Browse the repository at this point in the history
Replace sorta facetious test with a more realistic one

Fix native function shadowing problem and enable more Sauce targets

More browser targets

Change browser versions to explicit versioning
  • Loading branch information
ndhoule committed Sep 3, 2014
1 parent 98b25cc commit bdf4be2
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 67 deletions.
7 changes: 7 additions & 0 deletions lib/internal/natives.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/* jshint unused: false */

export var nativeKeys = Object.keys;

export var nativeParseInt = parseInt;

export var nativeIsFinite = isFinite;
3 changes: 1 addition & 2 deletions lib/object/isFinite.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import isNumber from './isNumber';

var nativeIsFinite = isFinite;
import { nativeIsFinite } from '../internal/natives';

/**
* Tests if a value is finite.
Expand Down
8 changes: 4 additions & 4 deletions lib/object/isNaN.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import isNumber from './isNumber';

/**
* Tests if a value is `NaN`.
* Tests if a value is `NaN`. Mirrors the behavior of `Number.isNaN`.
*
* @name isNaN
* @api public
Expand All @@ -13,7 +13,7 @@ import isNumber from './isNumber';
* //=> true
*
* isNaN(new Number(NaN));
* //=> true
* //=> false
*
* isNaN(0);
* //=> false
Expand All @@ -24,8 +24,8 @@ import isNumber from './isNumber';
* isNaN({});
* //=> false
*/
var isNaN = isNaN || function isNaN(val) {
return isNumber(val) && val != +val;
var isNaN = Number.isNaN || function isNaN(val) {
return isNumber(val) && val !== val;
};

export default isNaN;
52 changes: 0 additions & 52 deletions test/config/browser-targets.js

This file was deleted.

74 changes: 72 additions & 2 deletions test/config/karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,83 @@
module.exports = function(config) {
'use strict';

var customLaunchers = require('./browser-targets');

if (!process.env.SAUCE_USERNAME || !process.env.SAUCE_ACCESS_KEY) {
console.log('Make sure the SAUCE_USERNAME and SAUCE_ACCESS_KEY environment variables are set.');
process.exit(1);
}

/**
* TODO: Browser support should look something like this (list not final):
*
* - IE 9, 10, 11
* - Chrome current, current - 1
* - Safari current, current - 1
* - Firefox current, current - 1
* - Opera current, current - 1
* - iOS 7.x, 6.x, 5.x (?)
* - Android 4.x (?)
*/

// See for config:
// - https://saucelabs.com/platforms
// - https://github.com/karma-runner/karma-sauce-launcher#customlaunchers-config-properties
var customLaunchers = {
// Desktop
'SL_IE_9': {
base: 'SauceLabs',
browserName: 'internet explorer',
platform: 'Windows 7',
version: '9'
},
'SL_IE_10': {
base: 'SauceLabs',
browserName: 'internet explorer',
platform: 'Windows 7',
version: '10'
},
'SL_IE_11': {
base: 'SauceLabs',
browserName: 'internet explorer',
platform: 'Windows 8.1',
version: '11'
},
'SL_Chrome_37': {
base: 'SauceLabs',
browserName: 'chrome',
version: '37'
},
'SL_Firefox_31': {
base: 'SauceLabs',
browserName: 'firefox',
version: '31'
},
'SL_Safari_7': {
base: 'SauceLabs',
browserName: 'safari',
platform: 'OS X 10.9',
version: '7'
},
'SL_Opera_12': {
base: 'SauceLabs',
browserName: 'opera',
platform: 'Windows 7',
version: '12'
},

// Mobile
'SL_iPhone_7.1': {
base: 'SauceLabs',
browserName: 'iphone',
platform: 'OS X 10.9',
version: '7.1'
},
'SL_Android': {
base: 'SauceLabs',
browserName: 'android',
version: '4.4'
}
};

config.set({
basePath: '../..',
frameworks: ['mocha', 'sinon-chai', 'chai-js-factories', 'chai'],
Expand Down
2 changes: 1 addition & 1 deletion test/unit/object/isNaN.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ describe('isNaN', function() {

it('should return `true` when passed NaN', function() {
expect(isNaN(NaN)).to.be.true;
expect(isNaN(new Number(NaN))).to.be.true;
});

it('should return `false` when passed anything other than NaN', function() {
expect(isNaN(new Number(NaN))).to.be.false;
expect(isNaN(0)).to.be.false;
expect(isNaN(1)).to.be.false;
expect(isNaN(-1)).to.be.false;
Expand Down
8 changes: 2 additions & 6 deletions test/unit/object/mapObject.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,9 @@ describe('mapObject', function() {

it('should work on string objects', function() {
var str = new String('test');
var expected = new String();
expected[0] = 'ta';
expected[1] = 'ea';
expected[2] = 'sa';
expected[3] = 'ta';
var expected = new String('TEST');

expect(mapObject(function(val) { return val + 'a'; }, str)).to.eql(expected);
expect(mapObject(function(val) { return val.toUpperCase(); }, str)).to.eql(expected);
});

it('should handle other complex object types gracefully', function() {
Expand Down

0 comments on commit bdf4be2

Please sign in to comment.