Comparing version 0.0.4 to 0.0.5
(function() { | ||
var gen1_continuationOrDefault = function(args) { | ||
var gen1_rethrowErrors = function(continuation, block) { | ||
return function(error, result) { | ||
if (error) { | ||
return continuation(error); | ||
} else { | ||
try { | ||
return block(result); | ||
} catch (ex) { | ||
return continuation(ex); | ||
} | ||
} | ||
}; | ||
}; | ||
var gen2_continuationOrDefault = function(args) { | ||
var c = args[args.length - 1]; | ||
@@ -16,19 +29,5 @@ if (c instanceof Function) { | ||
}; | ||
var gen2_rethrowErrors = function(continuation, block) { | ||
return function(error, result) { | ||
if (error) { | ||
return continuation(error); | ||
} else { | ||
try { | ||
return block(result); | ||
} catch (ex) { | ||
return continuation(ex); | ||
} | ||
} | ||
}; | ||
}; | ||
var self = this; | ||
var finders, waitUntil; | ||
var finders; | ||
finders = require("./finders"); | ||
waitUntil = require("./waitUntil").waitUntil; | ||
module.exports = function(element) { | ||
@@ -54,3 +53,3 @@ var self = this; | ||
var gen4_arguments = Array.prototype.slice.call(arguments, 0, arguments.length - 1); | ||
continuation = gen1_continuationOrDefault(arguments); | ||
continuation = gen2_continuationOrDefault(arguments); | ||
locator = gen4_arguments[0]; | ||
@@ -60,42 +59,41 @@ gen3_options = gen4_arguments[1]; | ||
first = gen3_options !== void 0 && Object.prototype.hasOwnProperty.call(gen3_options, "first") && gen3_options.first !== void 0 ? gen3_options.first : false; | ||
var el; | ||
el = find(locator); | ||
if (first) { | ||
el = $(el[0]); | ||
} | ||
invoke(el, "click", continuation); | ||
return find(locator, gen1_rethrowErrors(continuation, function(gen5_asyncResult) { | ||
var el; | ||
el = gen5_asyncResult; | ||
if (first) { | ||
el = $(el[0]); | ||
} | ||
invoke(el, "click", continuation); | ||
})); | ||
}, | ||
select: function(text, gen5_options, continuation) { | ||
select: function(text, gen6_options, continuation) { | ||
var self = this; | ||
var gen6_arguments = Array.prototype.slice.call(arguments, 0, arguments.length - 1); | ||
continuation = gen1_continuationOrDefault(arguments); | ||
text = gen6_arguments[0]; | ||
gen5_options = gen6_arguments[1]; | ||
var gen7_arguments = Array.prototype.slice.call(arguments, 0, arguments.length - 1); | ||
continuation = gen2_continuationOrDefault(arguments); | ||
text = gen7_arguments[0]; | ||
gen6_options = gen7_arguments[1]; | ||
var from; | ||
from = gen5_options !== void 0 && Object.prototype.hasOwnProperty.call(gen5_options, "from") && gen5_options.from !== void 0 ? gen5_options.from : void 0; | ||
var selectElement; | ||
selectElement = find(from); | ||
return continuation(void 0, selectElement.find("option").each(function(index, option) { | ||
if ($(option).text() === text) { | ||
selectElement.val($(option).val()); | ||
return selectElement.change(); | ||
} | ||
from = gen6_options !== void 0 && Object.prototype.hasOwnProperty.call(gen6_options, "from") && gen6_options.from !== void 0 ? gen6_options.from : void 0; | ||
return find(from, gen1_rethrowErrors(continuation, function(gen8_asyncResult) { | ||
var selectElement; | ||
selectElement = gen8_asyncResult; | ||
return continuation(void 0, selectElement.find("option").each(function(index, option) { | ||
if ($(option).text() === text) { | ||
selectElement.val($(option).val()); | ||
return selectElement.change(); | ||
} | ||
})); | ||
})); | ||
}, | ||
fillIn: function(locator, gen7_options, continuation) { | ||
fillIn: function(locator, gen9_options, continuation) { | ||
var self = this; | ||
var gen8_arguments = Array.prototype.slice.call(arguments, 0, arguments.length - 1); | ||
continuation = gen1_continuationOrDefault(arguments); | ||
locator = gen8_arguments[0]; | ||
gen7_options = gen8_arguments[1]; | ||
var gen10_arguments = Array.prototype.slice.call(arguments, 0, arguments.length - 1); | ||
continuation = gen2_continuationOrDefault(arguments); | ||
locator = gen10_arguments[0]; | ||
gen9_options = gen10_arguments[1]; | ||
var withValue; | ||
withValue = gen7_options !== void 0 && Object.prototype.hasOwnProperty.call(gen7_options, "withValue") && gen7_options.withValue !== void 0 ? gen7_options.withValue : void 0; | ||
return waitUntil(function(continuation) { | ||
var gen9_arguments = Array.prototype.slice.call(arguments, 0, arguments.length - 1); | ||
continuation = gen1_continuationOrDefault(arguments); | ||
return continuation(void 0, find(locator).length > 0); | ||
}, gen2_rethrowErrors(continuation, function(gen10_asyncResult) { | ||
withValue = gen9_options !== void 0 && Object.prototype.hasOwnProperty.call(gen9_options, "withValue") && gen9_options.withValue !== void 0 ? gen9_options.withValue : void 0; | ||
return find(locator, gen1_rethrowErrors(continuation, function(gen11_asyncResult) { | ||
var fillElement; | ||
gen10_asyncResult; | ||
fillElement = find(locator); | ||
fillElement = gen11_asyncResult; | ||
fillElement.val(withValue); | ||
@@ -102,0 +100,0 @@ invoke(fillElement, "change", continuation); |
(function() { | ||
var gen1_continuationOrDefault = function(args) { | ||
var c = args[args.length - 1]; | ||
if (c instanceof Function) { | ||
return c; | ||
} else { | ||
return function(error, result) { | ||
if (error) { | ||
throw error; | ||
} else { | ||
return result; | ||
} | ||
}; | ||
} | ||
}; | ||
var gen2_rethrowErrors = function(continuation, block) { | ||
return function(error, result) { | ||
if (error) { | ||
return continuation(error); | ||
} else { | ||
try { | ||
return block(result); | ||
} catch (ex) { | ||
return continuation(ex); | ||
} | ||
} | ||
}; | ||
}; | ||
var self = this; | ||
var waitUntil; | ||
waitUntil = require("./waitUntil").waitUntil; | ||
module.exports = function(element) { | ||
var self = this; | ||
return { | ||
find: function(locator) { | ||
find: function(locator, continuation) { | ||
var self = this; | ||
return element.find(locator); | ||
var gen3_arguments = Array.prototype.slice.call(arguments, 0, arguments.length - 1); | ||
continuation = gen1_continuationOrDefault(arguments); | ||
locator = gen3_arguments[0]; | ||
return waitUntil(function(continuation) { | ||
var gen4_arguments = Array.prototype.slice.call(arguments, 0, arguments.length - 1); | ||
continuation = gen1_continuationOrDefault(arguments); | ||
if (!locator) { | ||
throw new Error("It seems like find was not called with the async operator - `!` in pogo)"); | ||
} | ||
return continuation(void 0, element.find(locator).length > 0); | ||
}, gen2_rethrowErrors(continuation, function(gen5_asyncResult) { | ||
gen5_asyncResult; | ||
return continuation(void 0, element.find(locator)); | ||
})); | ||
} | ||
@@ -10,0 +52,0 @@ }; |
(function() { | ||
var gen1_continuationOrDefault = function(args) { | ||
var gen1_rethrowErrors = function(continuation, block) { | ||
return function(error, result) { | ||
if (error) { | ||
return continuation(error); | ||
} else { | ||
try { | ||
return block(result); | ||
} catch (ex) { | ||
return continuation(ex); | ||
} | ||
} | ||
}; | ||
}; | ||
var gen2_continuationOrDefault = function(args) { | ||
var c = args[args.length - 1]; | ||
@@ -16,19 +29,5 @@ if (c instanceof Function) { | ||
}; | ||
var gen2_rethrowErrors = function(continuation, block) { | ||
return function(error, result) { | ||
if (error) { | ||
return continuation(error); | ||
} else { | ||
try { | ||
return block(result); | ||
} catch (ex) { | ||
return continuation(ex); | ||
} | ||
} | ||
}; | ||
}; | ||
var self = this; | ||
var finders, waitUntil; | ||
var finders; | ||
finders = require("./finders"); | ||
waitUntil = require("./waitUntil").waitUntil; | ||
module.exports = function(element) { | ||
@@ -39,18 +38,18 @@ var self = this; | ||
return { | ||
isVisible: function(locator) { | ||
isVisible: function(locator, continuation) { | ||
var self = this; | ||
return find(locator).is(":visible"); | ||
var gen3_arguments = Array.prototype.slice.call(arguments, 0, arguments.length - 1); | ||
continuation = gen2_continuationOrDefault(arguments); | ||
locator = gen3_arguments[0]; | ||
return find(locator, gen1_rethrowErrors(continuation, function(gen4_asyncResult) { | ||
return continuation(void 0, gen4_asyncResult.is(":visible")); | ||
})); | ||
}, | ||
hasSelector: function(locator, continuation) { | ||
var self = this; | ||
var gen3_arguments = Array.prototype.slice.call(arguments, 0, arguments.length - 1); | ||
continuation = gen1_continuationOrDefault(arguments); | ||
locator = gen3_arguments[0]; | ||
return waitUntil(function(continuation) { | ||
var gen4_arguments = Array.prototype.slice.call(arguments, 0, arguments.length - 1); | ||
continuation = gen1_continuationOrDefault(arguments); | ||
return continuation(void 0, find(locator).length > 0); | ||
}, gen2_rethrowErrors(continuation, function(gen5_asyncResult) { | ||
gen5_asyncResult; | ||
return continuation(void 0, find(locator).length > 0); | ||
var gen5_arguments = Array.prototype.slice.call(arguments, 0, arguments.length - 1); | ||
continuation = gen2_continuationOrDefault(arguments); | ||
locator = gen5_arguments[0]; | ||
return find(locator, gen1_rethrowErrors(continuation, function(gen6_asyncResult) { | ||
return continuation(void 0, gen6_asyncResult.length > 0); | ||
})); | ||
@@ -57,0 +56,0 @@ } |
{ | ||
"name": "chinchilla", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "JQuery backed Capybara like browser automation", | ||
@@ -35,3 +35,3 @@ "main": "build/index.js", | ||
"karma-browserify": "0.0.6", | ||
"pogoify": "0.0.4" | ||
"pogoify": "0.0.2" | ||
}, | ||
@@ -38,0 +38,0 @@ "dependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1032739
26534