Comparing version 1.4.5 to 1.4.6
@@ -1,4 +0,1 @@ | ||
/*jslint vars: true, sloppy: true, nomen: true */ | ||
/*global now: false, _, instructions */ | ||
var _ = require('../src/util'); | ||
@@ -67,6 +64,2 @@ | ||
Collector.prototype.export2text = function () { | ||
return JSON.stringify(this.export2json()); | ||
}; | ||
module.exports = Collector; |
{ | ||
"name": "lc2", | ||
"version": "1.4.5", | ||
"version": "1.4.6", | ||
"description": "browser automation library", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -1,3 +0,1 @@ | ||
/*jslint vars: true, sloppy: true, nomen: true */ | ||
/*global require, console, trigger, module, getComputedStyle */ | ||
var $ = require('lc2-selector')(require('sizzle')); | ||
@@ -7,3 +5,2 @@ var $CP = require('./case').$CP; | ||
var global = require('../global'); | ||
var settings = global.settings; | ||
var getDocument = global.getDocument; | ||
@@ -160,3 +157,4 @@ var IF = require('./instruction'); | ||
$CP.$exitLoop = function () { | ||
this.$setActiveTime(this.$$getConfig('interval') || 3000); | ||
this.$setActiveTime(this.$$getConfig('interval') || 3000) | ||
.afterLoop(this); | ||
@@ -170,3 +168,2 @@ if ((this.$$currentLoop += 1) >= this.$$getConfig('times')) { | ||
this.$setTempInstruction(IF(CALL).create('main')); | ||
(settings.loopCallback || _.noop)(this); | ||
@@ -173,0 +170,0 @@ return this; |
@@ -1,5 +0,2 @@ | ||
/*jslint vars: true, sloppy: true, nomen: true */ | ||
/*global require, console, trigger, module */ | ||
var $CP = require('./case').$CP; | ||
var settings = require('../global').settings; | ||
@@ -14,8 +11,13 @@ $CP.getVar = function () { | ||
$CP.start = function () { | ||
var state = this.$$state; | ||
if (state !== 'success' && state !== 'ready') { | ||
$CP.start = function (option) { | ||
if (this.$$state !== 'ready') { | ||
throw new Error('Can not call play!'); | ||
} | ||
for (key in option) { | ||
if (this.hasOwnProperty(key) && typeof option[key] === 'function') { | ||
this[key] = option[key]; | ||
} | ||
} | ||
try { | ||
@@ -26,3 +28,3 @@ this.$setState('running').$$bootstrap(); | ||
console.error(error); | ||
settings.bootExceptionHandle(error); | ||
this.bootException(error); | ||
} | ||
@@ -70,12 +72,2 @@ }; | ||
$CP.debug = function () { | ||
var state = this.$$state; | ||
if (state !== 'success' && state !== 'ready') { | ||
throw new Error('Can not call play!'); | ||
} | ||
this.$setState('debug').$$bootstrap(); | ||
return this; | ||
}; | ||
$CP.getLog = function () { | ||
@@ -94,3 +86,3 @@ return this.$$log; | ||
$CP.getCurrentLine = function () { | ||
return this.$$instructionBuffer.$getLine(); | ||
return this.$$instructionBuffer.line(); | ||
}; | ||
@@ -97,0 +89,0 @@ |
@@ -1,3 +0,1 @@ | ||
/*jslint plusplus: true, sloppy: true, nomen: true */ | ||
/*global require, console, trigger, module */ | ||
var instructionType = require('../instructionType'); | ||
@@ -8,2 +6,3 @@ var CALL = instructionType.CALL; | ||
var settings = require('../global').settings; | ||
var fn = settings.fn; | ||
var Collector = require('../../lib/collector'); | ||
@@ -72,2 +71,11 @@ var IF = require('./instruction'); | ||
this.$loopData = null; | ||
// callback | ||
this.afterRun = fn.afterRun; | ||
this.afterTrigger = fn.afterTrigger; | ||
this.afterLoop = fn.afterLoop; | ||
this.afterFinish = fn.afterFinish; | ||
this.afterLog = fn.afterLog; | ||
this.runException = fn.runException; | ||
this.bootException = fn.bootException; | ||
} | ||
@@ -92,4 +100,2 @@ | ||
(settings.loopCallback || _.noop)(this); | ||
this.$setActiveTime(this.$$getConfig('interval') || settings.readyTimeout) | ||
@@ -104,4 +110,5 @@ .$setTempInstruction(IF(CALL).create('main')) | ||
$CP.$$exitCase = function () { | ||
this.$setState('success').$$interrupt(); | ||
(settings.successCallback || _.noop).call(this); | ||
this.$setState('ready') | ||
.$$interrupt() | ||
.afterFinish(this); | ||
@@ -137,3 +144,3 @@ return this; | ||
this.$$popInstruction().execute(); | ||
settings.runCallback(this); | ||
this.afterRun(this); | ||
} catch (e) { | ||
@@ -140,0 +147,0 @@ console.error('[Error FROM LC2 Core]:' + e); |
@@ -1,4 +0,2 @@ | ||
/*jslint vars: true, sloppy: true, nomen: true */ | ||
/*global require, console, trigger, module, instructionFactories */ | ||
var IF = function InstructionFactory(TYPE, opts) { | ||
function InstructionFactory(TYPE, opts) { | ||
if (!opts) { | ||
@@ -48,4 +46,5 @@ var IF = instructionFactories[TYPE]; | ||
return Instruction; | ||
}, instructionFactories = []; | ||
} | ||
var instructionFactories = []; | ||
module.exports = IF; | ||
module.exports = InstructionFactory; |
@@ -1,5 +0,2 @@ | ||
/*jslint vars: true, sloppy: true, nomen: true */ | ||
/*global require, console, trigger, module */ | ||
var callMainIns, exitIns, settings, setup, | ||
_ = require('./util'); | ||
var settings, setup, _ = require('./util'); | ||
@@ -11,12 +8,11 @@ settings = { | ||
defaultClock: 10, | ||
bootExceptionHandle: _.noop, | ||
triggerCallback: _.noop, | ||
runCallback: _.noop, | ||
runExceptionHandle: function () { | ||
console.log(arguments); | ||
}, | ||
successCallback: _.noop, | ||
readyCallback: _.noop, | ||
loopCallback: _.noop, | ||
consoleFn: _.noop | ||
fn: { | ||
afterRun: _.noop, | ||
afterTrigger: _.noop, | ||
afterLoop: _.noop, | ||
afterFinish: _.noop, | ||
afterLog: _.noop, | ||
runException: _.noop, | ||
bootException: _.noop | ||
} | ||
}; | ||
@@ -40,2 +36,8 @@ | ||
}; | ||
setup.fn = function (name, fn) { | ||
var $fn = settings.fn; | ||
if ($fn.hasOwnProperty(name) && typeof fn === 'function') { | ||
$fn[name] = fn; | ||
} | ||
}; | ||
@@ -42,0 +44,0 @@ function init(wrapDOM, callback) { |
@@ -1,3 +0,1 @@ | ||
/*jslint sloppy: true, nomen: true */ | ||
/*global require, console */ | ||
var IF = require('./class/instruction'); | ||
@@ -63,3 +61,3 @@ var global = require('./global'); | ||
if (!flag) { | ||
settings.runExceptionHandle(this.$case); | ||
CASE.runException(CASE); | ||
} | ||
@@ -136,3 +134,3 @@ | ||
trigger(DOM).does(action, param); | ||
settings.triggerCallback(DOM, this.$case); | ||
this.$case.afterTrigger(DOM, this.$case); | ||
} catch (msg) { | ||
@@ -229,4 +227,4 @@ console.log(msg); | ||
this.$case.$pushLog([LOG, msg], this.line()); | ||
this.$case.afterLog(msg); | ||
console.log(msg); | ||
settings.consoleFn(msg); | ||
}, | ||
@@ -233,0 +231,0 @@ bodyFactory: function (msg) { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
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
327463
29
7952
2
0