still working to get the tests running in ie... stupid IE

This commit is contained in:
Spencer Alger
2013-12-23 17:31:37 -07:00
parent 2b3734a081
commit a77b2be1f2
7 changed files with 20 additions and 11 deletions

View File

@ -11,7 +11,8 @@
"browser": { "browser": {
"./src/lib/connectors/index.js": "./src/lib/connectors/browser_index.js", "./src/lib/connectors/index.js": "./src/lib/connectors/browser_index.js",
"./src/lib/loggers/index.js": "./src/lib/loggers/browser_index.js", "./src/lib/loggers/index.js": "./src/lib/loggers/browser_index.js",
"./test/mocks/server.js": "./test/mocks/browser_server.js" "./test/mocks/server.js": "./test/mocks/browser_server.js",
"lodash": "./node_modules/lodash/dist/lodash.compat.js"
}, },
"devDependencies": { "devDependencies": {
"mocha": "~1.14.0", "mocha": "~1.14.0",

View File

@ -42,7 +42,7 @@ function ClientAction(spec) {
} }
var castType = { var castType = {
enum: function (param, val, name) { 'enum': function (param, val, name) {
/* jshint eqeqeq: false */ /* jshint eqeqeq: false */
for (var i = 0; i < param.options.length; i++) { for (var i = 0; i < param.options.length; i++) {
if (param.options[i] == val) { if (param.options[i] == val) {
@ -80,7 +80,7 @@ var castType = {
throw new TypeError('Invalid ' + name + ': expected be a comma seperated list, array, number or string.'); throw new TypeError('Invalid ' + name + ': expected be a comma seperated list, array, number or string.');
} }
}, },
boolean: function (param, val) { 'boolean': function (param, val) {
val = _.isString(val) ? val.toLowerCase() : val; val = _.isString(val) ? val.toLowerCase() : val;
return (val === 'no' || val === 'off') ? false : !!val; return (val === 'no' || val === 'off') ? false : !!val;
}, },

View File

@ -32,7 +32,7 @@ utils.joinPath = path.join;
* @return {Object} - returns the modified to value * @return {Object} - returns the modified to value
*/ */
utils.deepMerge = function (to, from) { utils.deepMerge = function (to, from) {
Object.keys(from).forEach(function (key) { _.each(from, function (fromVal, key) {
switch (typeof to[key]) { switch (typeof to[key]) {
case 'undefined': case 'undefined':
to[key] = from[key]; to[key] = from[key];
@ -56,7 +56,15 @@ utils.deepMerge = function (to, from) {
* @param {Array} arr - An array to check * @param {Array} arr - An array to check
* @return {Boolean} * @return {Boolean}
*/ */
'String Object PlainObject Array Finite Function RegExp'.split(' ').forEach(function (type) { _.each([
'String',
'Object',
'PlainObject',
'Array',
'Finite',
'Function',
'RegExp'
], function (type) {
var check = _.bindKey(_, 'is' + type); var check = _.bindKey(_, 'is' + type);
utils['isArrayOf' + type + 's'] = function (arr) { utils['isArrayOf' + type + 's'] = function (arr) {

View File

@ -303,7 +303,7 @@ YamlDoc.prototype = {
delete args.catch; delete args.catch;
var client = clientManager.get(); var client = clientManager.get();
var action = Object.keys(args).pop(); var action = _.keys(args).pop();
var clientActionName = _.map(action.split('.'), _.camelCase).join('.'); var clientActionName = _.map(action.split('.'), _.camelCase).join('.');
var clientAction = this.get(clientActionName, client); var clientAction = this.get(clientActionName, client);
var params = _.transform(args[action], function (params, val, name) { var params = _.transform(args[action], function (params, val, name) {

View File

@ -679,11 +679,11 @@ describe('Client Action runner', function () {
opt: { opt: {
type: { type: {
type: 'list', type: 'list',
default: '_all' 'default': '_all'
}, },
thing: { thing: {
type: 'any', type: 'any',
default: '' 'default': ''
} }
} }
} }
@ -729,7 +729,7 @@ describe('Client Action runner', function () {
var action = makeClientAction({ var action = makeClientAction({
params: { params: {
a: { type: 'list', required: true }, a: { type: 'list', required: true },
b: { type: 'duration', default: '15m' }, b: { type: 'duration', 'default': '15m' },
q: { type: 'any' } q: { type: 'any' }
} }
}); });

View File

@ -178,7 +178,7 @@ describe('Connection Pool', function () {
var pingQueue = _.shuffle(connections); var pingQueue = _.shuffle(connections);
var expectedSelection = pingQueue[pingQueue.length - 1]; var expectedSelection = pingQueue[pingQueue.length - 1];
pingQueue.forEach(function (conn) { _.each(pingQueue, function (conn) {
pool.addConnection(conn); pool.addConnection(conn);
stub(conn, 'ping', function (params, cb) { stub(conn, 'ping', function (params, cb) {
if (typeof params === 'function') { if (typeof params === 'function') {

View File

@ -605,7 +605,7 @@ describe('Transport Class', function () {
}); });
[false, 0, null].forEach(function (falsy) { _.each([false, 0, null], function (falsy) {
it('skips the timeout when it is ' + falsy, function () { it('skips the timeout when it is ' + falsy, function () {
var clock = sinon.useFakeTimers(); var clock = sinon.useFakeTimers();
var tran = new Transport({}); var tran = new Transport({});