aurelia-testing
Advanced tools
Comparing version 1.0.0-beta.3.0.1 to 1.0.0-beta.4.0.0
{ | ||
"name": "aurelia-testing", | ||
"version": "1.0.0-beta.3.0.1", | ||
"version": "1.0.0-beta.4.0.0", | ||
"description": "A collection of helpers for testing Aurelia apps and components.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -1,22 +0,18 @@ | ||
define(['exports', './compile-spy', './view-spy', './component-tester', './wait'], function (exports, _compileSpy, _viewSpy, _componentTester, _wait) { | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.waitForDocumentElements = exports.waitForDocumentElement = exports.waitFor = exports.configure = exports.ComponentTester = exports.StageComponent = exports.ViewSpy = exports.CompileSpy = undefined; | ||
function configure(config) { | ||
config.globalResources('./compile-spy', './view-spy'); | ||
} | ||
exports.CompileSpy = _compileSpy.CompileSpy; | ||
exports.ViewSpy = _viewSpy.ViewSpy; | ||
exports.StageComponent = _componentTester.StageComponent; | ||
exports.ComponentTester = _componentTester.ComponentTester; | ||
exports.configure = configure; | ||
exports.waitFor = _wait.waitFor; | ||
exports.waitForDocumentElement = _wait.waitForDocumentElement; | ||
exports.waitForDocumentElements = _wait.waitForDocumentElements; | ||
}); | ||
define(["require", "exports", "./compile-spy", "./view-spy", "./component-tester", "./wait"], function (require, exports, compile_spy_1, view_spy_1, component_tester_1, wait_1) { | ||
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(compile_spy_1); | ||
__export(view_spy_1); | ||
__export(component_tester_1); | ||
__export(wait_1); | ||
function configure(config) { | ||
config.globalResources([ | ||
'./compile-spy', | ||
'./view-spy' | ||
]); | ||
} | ||
exports.configure = configure; | ||
}); |
@@ -1,37 +0,31 @@ | ||
define(['exports', 'aurelia-templating', 'aurelia-dependency-injection', 'aurelia-logging', 'aurelia-pal'], function (exports, _aureliaTemplating, _aureliaDependencyInjection, _aureliaLogging, _aureliaPal) { | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.CompileSpy = undefined; | ||
var LogManager = _interopRequireWildcard(_aureliaLogging); | ||
function _interopRequireWildcard(obj) { | ||
if (obj && obj.__esModule) { | ||
return obj; | ||
} else { | ||
var newObj = {}; | ||
if (obj != null) { | ||
for (var key in obj) { | ||
if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
define(["require", "exports", "aurelia-templating", "aurelia-dependency-injection", "aurelia-logging", "aurelia-pal"], function (require, exports, aurelia_templating_1, aurelia_dependency_injection_1, aurelia_logging_1, aurelia_pal_1) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
* Attribute to be placed on any element to have it emit the View Compiler's | ||
* TargetInstruction into the debug console, giving you insight into all the | ||
* parsed bindings, behaviors and event handers for the targeted element. | ||
*/ | ||
var CompileSpy = /** @class */ (function () { | ||
/** | ||
* Creates and instanse of CompileSpy. | ||
* @param element target element on where attribute is placed on. | ||
* @param instruction instructions for how the target element should be enhanced. | ||
*/ | ||
function CompileSpy(element, instruction) { | ||
aurelia_logging_1.getLogger('compile-spy').info(element.toString(), instruction); | ||
} | ||
} | ||
newObj.default = obj; | ||
return newObj; | ||
} | ||
} | ||
var _dec, _dec2, _class; | ||
var CompileSpy = exports.CompileSpy = (_dec = (0, _aureliaTemplating.customAttribute)('compile-spy'), _dec2 = (0, _aureliaDependencyInjection.inject)(_aureliaPal.DOM.Element, _aureliaTemplating.TargetInstruction), _dec(_class = _dec2(_class = function CompileSpy(element, instruction) { | ||
LogManager.getLogger('compile-spy').info(element, instruction); | ||
}) || _class) || _class); | ||
}); | ||
CompileSpy = __decorate([ | ||
aurelia_templating_1.customAttribute('compile-spy'), | ||
aurelia_dependency_injection_1.inject(aurelia_pal_1.DOM.Element, aurelia_templating_1.TargetInstruction) | ||
], CompileSpy); | ||
return CompileSpy; | ||
}()); | ||
exports.CompileSpy = CompileSpy; | ||
}); |
@@ -1,170 +0,116 @@ | ||
define(['exports', 'aurelia-templating', 'aurelia-framework', './wait'], function (exports, _aureliaTemplating, _aureliaFramework, _wait) { | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.ComponentTester = exports.StageComponent = undefined; | ||
var StageComponent = exports.StageComponent = function () { | ||
function StageComponent() { | ||
} | ||
StageComponent.withResources = function withResources(resources) { | ||
return new ComponentTester().withResources(resources); | ||
}; | ||
return StageComponent; | ||
}(); | ||
var ComponentTester = exports.ComponentTester = function () { | ||
function ComponentTester() { | ||
this.configure = function (aurelia) { | ||
return aurelia.use.standardConfiguration(); | ||
}; | ||
this._resources = []; | ||
} | ||
ComponentTester.prototype.bootstrap = function bootstrap(configure) { | ||
this.configure = configure; | ||
}; | ||
ComponentTester.prototype.withResources = function withResources(resources) { | ||
this._resources = resources; | ||
return this; | ||
}; | ||
ComponentTester.prototype.inView = function inView(html) { | ||
this._html = html; | ||
return this; | ||
}; | ||
ComponentTester.prototype.boundTo = function boundTo(bindingContext) { | ||
this._bindingContext = bindingContext; | ||
return this; | ||
}; | ||
ComponentTester.prototype.manuallyHandleLifecycle = function manuallyHandleLifecycle() { | ||
this._prepareLifecycle(); | ||
return this; | ||
}; | ||
ComponentTester.prototype.create = function create(bootstrap) { | ||
var _this = this; | ||
return bootstrap(function (aurelia) { | ||
return Promise.resolve(_this.configure(aurelia)).then(function () { | ||
if (_this._resources) { | ||
aurelia.use.globalResources(_this._resources); | ||
} | ||
return aurelia.start().then(function (a) { | ||
_this.host = document.createElement('div'); | ||
_this.host.innerHTML = _this._html; | ||
document.body.appendChild(_this.host); | ||
return aurelia.enhance(_this._bindingContext, _this.host).then(function () { | ||
_this._rootView = aurelia.root; | ||
_this.element = _this.host.firstElementChild; | ||
if (aurelia.root.controllers.length) { | ||
_this.viewModel = aurelia.root.controllers[0].viewModel; | ||
} | ||
return new Promise(function (resolve) { | ||
return setTimeout(function () { | ||
return resolve(); | ||
}, 0); | ||
}); | ||
define(["require", "exports", "aurelia-templating", "./wait"], function (require, exports, aurelia_templating_1, wait_1) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var StageComponent = /** @class */ (function () { | ||
function StageComponent() { | ||
} | ||
StageComponent.withResources = function (resources) { | ||
if (resources === void 0) { resources = []; } | ||
return new ComponentTester().withResources(resources); | ||
}; | ||
return StageComponent; | ||
}()); | ||
exports.StageComponent = StageComponent; | ||
var ComponentTester = /** @class */ (function () { | ||
function ComponentTester() { | ||
this.resources = []; | ||
} | ||
ComponentTester.prototype.configure = function (aurelia) { | ||
return aurelia.use.standardConfiguration(); | ||
}; | ||
ComponentTester.prototype.bootstrap = function (configure) { | ||
this.configure = configure; | ||
}; | ||
ComponentTester.prototype.withResources = function (resources) { | ||
this.resources = resources; | ||
return this; | ||
}; | ||
ComponentTester.prototype.inView = function (html) { | ||
this.html = html; | ||
return this; | ||
}; | ||
ComponentTester.prototype.boundTo = function (bindingContext) { | ||
this.bindingContext = bindingContext; | ||
return this; | ||
}; | ||
ComponentTester.prototype.manuallyHandleLifecycle = function () { | ||
this._prepareLifecycle(); | ||
return this; | ||
}; | ||
ComponentTester.prototype.create = function (bootstrap) { | ||
var _this = this; | ||
return bootstrap(function (aurelia) { | ||
return Promise.resolve(_this.configure(aurelia)).then(function () { | ||
if (_this.resources) { | ||
aurelia.use.globalResources(_this.resources); | ||
} | ||
return aurelia.start().then(function () { | ||
_this.host = document.createElement('div'); | ||
_this.host.innerHTML = _this.html; | ||
document.body.appendChild(_this.host); | ||
return aurelia.enhance(_this.bindingContext, _this.host).then(function () { | ||
_this.rootView = aurelia.root; | ||
_this.element = _this.host.firstElementChild; | ||
if (aurelia.root.controllers.length) { | ||
_this.viewModel = aurelia.root.controllers[0].viewModel; | ||
} | ||
return new Promise(function (resolve) { return setTimeout(function () { return resolve(); }, 0); }); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}; | ||
ComponentTester.prototype.dispose = function dispose() { | ||
if (this.host === undefined || this._rootView === undefined) { | ||
throw new Error('Cannot call ComponentTester.dispose() before ComponentTester.create()'); | ||
} | ||
this._rootView.detached(); | ||
this._rootView.unbind(); | ||
return this.host.parentNode.removeChild(this.host); | ||
}; | ||
ComponentTester.prototype._prepareLifecycle = function _prepareLifecycle() { | ||
var _this2 = this; | ||
var bindPrototype = _aureliaTemplating.View.prototype.bind; | ||
_aureliaTemplating.View.prototype.bind = function () {}; | ||
this.bind = function (bindingContext) { | ||
return new Promise(function (resolve) { | ||
_aureliaTemplating.View.prototype.bind = bindPrototype; | ||
if (bindingContext !== undefined) { | ||
_this2._bindingContext = bindingContext; | ||
} | ||
_this2._rootView.bind(_this2._bindingContext); | ||
setTimeout(function () { | ||
return resolve(); | ||
}, 0); | ||
}); | ||
}; | ||
var attachedPrototype = _aureliaTemplating.View.prototype.attached; | ||
_aureliaTemplating.View.prototype.attached = function () {}; | ||
this.attached = function () { | ||
return new Promise(function (resolve) { | ||
_aureliaTemplating.View.prototype.attached = attachedPrototype; | ||
_this2._rootView.attached(); | ||
setTimeout(function () { | ||
return resolve(); | ||
}, 0); | ||
}); | ||
}; | ||
this.detached = function () { | ||
return new Promise(function (resolve) { | ||
_this2._rootView.detached(); | ||
setTimeout(function () { | ||
return resolve(); | ||
}, 0); | ||
}); | ||
}; | ||
this.unbind = function () { | ||
return new Promise(function (resolve) { | ||
_this2._rootView.unbind(); | ||
setTimeout(function () { | ||
return resolve(); | ||
}, 0); | ||
}); | ||
}; | ||
}; | ||
ComponentTester.prototype.waitForElement = function waitForElement(selector, options) { | ||
var _this3 = this; | ||
return (0, _wait.waitFor)(function () { | ||
return _this3.element.querySelector(selector); | ||
}, options); | ||
}; | ||
ComponentTester.prototype.waitForElements = function waitForElements(selector, options) { | ||
var _this4 = this; | ||
return (0, _wait.waitFor)(function () { | ||
return _this4.element.querySelectorAll(selector); | ||
}, options); | ||
}; | ||
return ComponentTester; | ||
}(); | ||
}); | ||
}; | ||
ComponentTester.prototype.dispose = function () { | ||
if (this.host === undefined || this.rootView === undefined) { | ||
throw new Error('Cannot call ComponentTester.dispose() before ComponentTester.create()'); | ||
} | ||
this.rootView.detached(); | ||
this.rootView.unbind(); | ||
return this.host.parentNode.removeChild(this.host); | ||
}; | ||
ComponentTester.prototype._prepareLifecycle = function () { | ||
var _this = this; | ||
// bind | ||
var bindPrototype = aurelia_templating_1.View.prototype.bind; | ||
// tslint:disable-next-line:no-empty | ||
aurelia_templating_1.View.prototype.bind = function () { }; | ||
this.bind = function (bindingContext) { return new Promise(function (resolve) { | ||
aurelia_templating_1.View.prototype.bind = bindPrototype; | ||
if (bindingContext !== undefined) { | ||
_this.bindingContext = bindingContext; | ||
} | ||
_this.rootView.bind(_this.bindingContext); | ||
setTimeout(function () { return resolve(); }, 0); | ||
}); }; | ||
// attached | ||
var attachedPrototype = aurelia_templating_1.View.prototype.attached; | ||
// tslint:disable-next-line:no-empty | ||
aurelia_templating_1.View.prototype.attached = function () { }; | ||
this.attached = function () { return new Promise(function (resolve) { | ||
aurelia_templating_1.View.prototype.attached = attachedPrototype; | ||
_this.rootView.attached(); | ||
setTimeout(function () { return resolve(); }, 0); | ||
}); }; | ||
// detached | ||
this.detached = function () { return new Promise(function (resolve) { | ||
_this.rootView.detached(); | ||
setTimeout(function () { return resolve(); }, 0); | ||
}); }; | ||
// unbind | ||
this.unbind = function () { return new Promise(function (resolve) { | ||
_this.rootView.unbind(); | ||
setTimeout(function () { return resolve(); }, 0); | ||
}); }; | ||
}; | ||
ComponentTester.prototype.waitForElement = function (selector, options) { | ||
var _this = this; | ||
return wait_1.waitFor(function () { return _this.element.querySelector(selector); }, options); | ||
}; | ||
ComponentTester.prototype.waitForElements = function (selector, options) { | ||
var _this = this; | ||
return wait_1.waitFor(function () { return _this.element.querySelectorAll(selector); }, options); | ||
}; | ||
return ComponentTester; | ||
}()); | ||
exports.ComponentTester = ComponentTester; | ||
}); |
@@ -1,70 +0,69 @@ | ||
define(['exports', 'aurelia-templating', 'aurelia-logging'], function (exports, _aureliaTemplating, _aureliaLogging) { | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.ViewSpy = undefined; | ||
var LogManager = _interopRequireWildcard(_aureliaLogging); | ||
function _interopRequireWildcard(obj) { | ||
if (obj && obj.__esModule) { | ||
return obj; | ||
} else { | ||
var newObj = {}; | ||
if (obj != null) { | ||
for (var key in obj) { | ||
if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
define(["require", "exports", "aurelia-templating", "aurelia-logging"], function (require, exports, aurelia_templating_1, aurelia_logging_1) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
* Attribute to be placed on any HTML element in a view to emit the View instance | ||
* to the debug console, giving you insight into the live View instance, including | ||
* all child views, live bindings, behaviors and more. | ||
*/ | ||
var ViewSpy = /** @class */ (function () { | ||
/** | ||
* Creates a new instance of ViewSpy. | ||
*/ | ||
function ViewSpy() { | ||
this.logger = aurelia_logging_1.getLogger('view-spy'); | ||
} | ||
} | ||
newObj.default = obj; | ||
return newObj; | ||
} | ||
} | ||
var _dec, _class; | ||
var ViewSpy = exports.ViewSpy = (_dec = (0, _aureliaTemplating.customAttribute)('view-spy'), _dec(_class = function () { | ||
function ViewSpy() { | ||
this.logger = LogManager.getLogger('view-spy'); | ||
} | ||
ViewSpy.prototype._log = function _log(lifecycleName, context) { | ||
if (!this.value && lifecycleName === 'created') { | ||
this.logger.info(lifecycleName, this.view); | ||
} else if (this.value && this.value.indexOf(lifecycleName) !== -1) { | ||
this.logger.info(lifecycleName, this.view, context); | ||
} | ||
}; | ||
ViewSpy.prototype.created = function created(view) { | ||
this.view = view; | ||
this._log('created'); | ||
}; | ||
ViewSpy.prototype.bind = function bind(bindingContext) { | ||
this._log('bind', bindingContext); | ||
}; | ||
ViewSpy.prototype.attached = function attached() { | ||
this._log('attached'); | ||
}; | ||
ViewSpy.prototype.detached = function detached() { | ||
this._log('detached'); | ||
}; | ||
ViewSpy.prototype.unbind = function unbind() { | ||
this._log('unbind'); | ||
}; | ||
return ViewSpy; | ||
}()) || _class); | ||
}); | ||
ViewSpy.prototype._log = function (lifecycleName, context) { | ||
if (!this.value && lifecycleName === 'created') { | ||
this.logger.info(lifecycleName, this.view); | ||
} | ||
else if (this.value && this.value.indexOf(lifecycleName) !== -1) { | ||
this.logger.info(lifecycleName, this.view, context); | ||
} | ||
}; | ||
/** | ||
* Invoked when the target view is created. | ||
* @param view The target view. | ||
*/ | ||
ViewSpy.prototype.created = function (view) { | ||
this.view = view; | ||
this._log('created'); | ||
}; | ||
/** | ||
* Invoked when the target view is bound. | ||
* @param bindingContext The target view's binding context. | ||
*/ | ||
ViewSpy.prototype.bind = function (bindingContext) { | ||
this._log('bind', bindingContext); | ||
}; | ||
/** | ||
* Invoked when the target element is attached to the DOM. | ||
*/ | ||
ViewSpy.prototype.attached = function () { | ||
this._log('attached'); | ||
}; | ||
/** | ||
* Invoked when the target element is detached from the DOM. | ||
*/ | ||
ViewSpy.prototype.detached = function () { | ||
this._log('detached'); | ||
}; | ||
/** | ||
* Invoked when the target element is unbound. | ||
*/ | ||
ViewSpy.prototype.unbind = function () { | ||
this._log('unbind'); | ||
}; | ||
ViewSpy = __decorate([ | ||
aurelia_templating_1.customAttribute('view-spy') | ||
], ViewSpy); | ||
return ViewSpy; | ||
}()); | ||
exports.ViewSpy = ViewSpy; | ||
}); |
@@ -1,52 +0,52 @@ | ||
define(['exports'], function (exports) { | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.waitFor = waitFor; | ||
exports.waitForDocumentElement = waitForDocumentElement; | ||
exports.waitForDocumentElements = waitForDocumentElements; | ||
function waitFor(getter, options) { | ||
var timedOut = false; | ||
options = Object.assign({ | ||
present: true, | ||
interval: 50, | ||
timeout: 5000 | ||
}, options); | ||
function wait() { | ||
var element = getter(); | ||
var found = element !== null && (!(element instanceof NodeList) && !element.jquery || element.length > 0); | ||
if (!options.present ^ found || timedOut) { | ||
return Promise.resolve(element); | ||
} | ||
return new Promise(function (rs) { | ||
return setTimeout(rs, options.interval); | ||
}).then(wait); | ||
var __assign = (this && this.__assign) || Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return Promise.race([new Promise(function (rs, rj) { | ||
return setTimeout(function () { | ||
timedOut = true; | ||
rj(options.present ? 'Element not found' : 'Element not removed'); | ||
}, options.timeout); | ||
}), wait()]); | ||
} | ||
function waitForDocumentElement(selector, options) { | ||
return waitFor(function () { | ||
return document.querySelector(selector); | ||
}, options); | ||
} | ||
function waitForDocumentElements(selector, options) { | ||
return waitFor(function () { | ||
return document.querySelectorAll(selector); | ||
}, options); | ||
} | ||
}); | ||
return t; | ||
}; | ||
define(["require", "exports"], function (require, exports) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
* Generic function to wait for something to happen. Uses polling | ||
* @param getter: a getter function that returns anything else than `null` or an | ||
* empty array or an empty jQuery object when the | ||
* condition is met | ||
* @param options: lookup options, defaults to | ||
* `{present: true, interval: 50, timeout: 5000}` | ||
*/ | ||
function waitFor(getter, options) { | ||
if (options === void 0) { options = { present: true, interval: 50, timeout: 5000 }; } | ||
// prevents infinite recursion if the request times out | ||
var timedOut = false; | ||
options = __assign({ present: true, interval: 50, timeout: 5000 }, options); | ||
function wait() { | ||
var element = getter(); | ||
// boolean is needed here, hence the length > 0 | ||
var found = element !== null && (!(element instanceof NodeList) && | ||
!element.jquery || element.length > 0); | ||
if (!options.present === !found || timedOut) { | ||
return Promise.resolve(element); | ||
} | ||
return new Promise(function (rs) { return setTimeout(rs, options.interval); }).then(wait); | ||
} | ||
return Promise.race([ | ||
new Promise(function (_, rj) { return setTimeout(function () { | ||
timedOut = true; | ||
rj(options.present ? 'Element not found' : 'Element not removed'); | ||
}, options.timeout); }), | ||
wait() | ||
]); | ||
} | ||
exports.waitFor = waitFor; | ||
function waitForDocumentElement(selector, options) { | ||
return waitFor(function () { return document.querySelector(selector); }, options); | ||
} | ||
exports.waitForDocumentElement = waitForDocumentElement; | ||
function waitForDocumentElements(selector, options) { | ||
return waitFor(function () { return document.querySelectorAll(selector); }, options); | ||
} | ||
exports.waitForDocumentElements = waitForDocumentElements; | ||
}); |
@@ -1,27 +0,16 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.waitForDocumentElements = exports.waitForDocumentElement = exports.waitFor = exports.configure = exports.ComponentTester = exports.StageComponent = exports.ViewSpy = exports.CompileSpy = undefined; | ||
var _compileSpy = require('./compile-spy'); | ||
var _viewSpy = require('./view-spy'); | ||
var _componentTester = require('./component-tester'); | ||
var _wait = require('./wait'); | ||
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./compile-spy")); | ||
__export(require("./view-spy")); | ||
__export(require("./component-tester")); | ||
__export(require("./wait")); | ||
function configure(config) { | ||
config.globalResources('./compile-spy', './view-spy'); | ||
config.globalResources([ | ||
'./compile-spy', | ||
'./view-spy' | ||
]); | ||
} | ||
exports.CompileSpy = _compileSpy.CompileSpy; | ||
exports.ViewSpy = _viewSpy.ViewSpy; | ||
exports.StageComponent = _componentTester.StageComponent; | ||
exports.ComponentTester = _componentTester.ComponentTester; | ||
exports.configure = configure; | ||
exports.waitFor = _wait.waitFor; | ||
exports.waitForDocumentElement = _wait.waitForDocumentElement; | ||
exports.waitForDocumentElements = _wait.waitForDocumentElements; |
@@ -1,28 +0,33 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.CompileSpy = undefined; | ||
var _dec, _dec2, _class; | ||
var _aureliaTemplating = require('aurelia-templating'); | ||
var _aureliaDependencyInjection = require('aurelia-dependency-injection'); | ||
var _aureliaLogging = require('aurelia-logging'); | ||
var LogManager = _interopRequireWildcard(_aureliaLogging); | ||
var _aureliaPal = require('aurelia-pal'); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | ||
var CompileSpy = exports.CompileSpy = (_dec = (0, _aureliaTemplating.customAttribute)('compile-spy'), _dec2 = (0, _aureliaDependencyInjection.inject)(_aureliaPal.DOM.Element, _aureliaTemplating.TargetInstruction), _dec(_class = _dec2(_class = function CompileSpy(element, instruction) { | ||
LogManager.getLogger('compile-spy').info(element, instruction); | ||
}) || _class) || _class); | ||
"use strict"; | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var aurelia_templating_1 = require("aurelia-templating"); | ||
var aurelia_dependency_injection_1 = require("aurelia-dependency-injection"); | ||
var aurelia_logging_1 = require("aurelia-logging"); | ||
var aurelia_pal_1 = require("aurelia-pal"); | ||
/** | ||
* Attribute to be placed on any element to have it emit the View Compiler's | ||
* TargetInstruction into the debug console, giving you insight into all the | ||
* parsed bindings, behaviors and event handers for the targeted element. | ||
*/ | ||
var CompileSpy = /** @class */ (function () { | ||
/** | ||
* Creates and instanse of CompileSpy. | ||
* @param element target element on where attribute is placed on. | ||
* @param instruction instructions for how the target element should be enhanced. | ||
*/ | ||
function CompileSpy(element, instruction) { | ||
aurelia_logging_1.getLogger('compile-spy').info(element.toString(), instruction); | ||
} | ||
CompileSpy = __decorate([ | ||
aurelia_templating_1.customAttribute('compile-spy'), | ||
aurelia_dependency_injection_1.inject(aurelia_pal_1.DOM.Element, aurelia_templating_1.TargetInstruction) | ||
], CompileSpy); | ||
return CompileSpy; | ||
}()); | ||
exports.CompileSpy = CompileSpy; |
@@ -1,174 +0,116 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.ComponentTester = exports.StageComponent = undefined; | ||
var _aureliaTemplating = require('aurelia-templating'); | ||
var _aureliaFramework = require('aurelia-framework'); | ||
var _wait = require('./wait'); | ||
var StageComponent = exports.StageComponent = function () { | ||
function StageComponent() { | ||
} | ||
StageComponent.withResources = function withResources(resources) { | ||
return new ComponentTester().withResources(resources); | ||
}; | ||
return StageComponent; | ||
}(); | ||
var ComponentTester = exports.ComponentTester = function () { | ||
function ComponentTester() { | ||
this.configure = function (aurelia) { | ||
return aurelia.use.standardConfiguration(); | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var aurelia_templating_1 = require("aurelia-templating"); | ||
var wait_1 = require("./wait"); | ||
var StageComponent = /** @class */ (function () { | ||
function StageComponent() { | ||
} | ||
StageComponent.withResources = function (resources) { | ||
if (resources === void 0) { resources = []; } | ||
return new ComponentTester().withResources(resources); | ||
}; | ||
this._resources = []; | ||
} | ||
ComponentTester.prototype.bootstrap = function bootstrap(configure) { | ||
this.configure = configure; | ||
}; | ||
ComponentTester.prototype.withResources = function withResources(resources) { | ||
this._resources = resources; | ||
return this; | ||
}; | ||
ComponentTester.prototype.inView = function inView(html) { | ||
this._html = html; | ||
return this; | ||
}; | ||
ComponentTester.prototype.boundTo = function boundTo(bindingContext) { | ||
this._bindingContext = bindingContext; | ||
return this; | ||
}; | ||
ComponentTester.prototype.manuallyHandleLifecycle = function manuallyHandleLifecycle() { | ||
this._prepareLifecycle(); | ||
return this; | ||
}; | ||
ComponentTester.prototype.create = function create(bootstrap) { | ||
var _this = this; | ||
return bootstrap(function (aurelia) { | ||
return Promise.resolve(_this.configure(aurelia)).then(function () { | ||
if (_this._resources) { | ||
aurelia.use.globalResources(_this._resources); | ||
} | ||
return aurelia.start().then(function (a) { | ||
_this.host = document.createElement('div'); | ||
_this.host.innerHTML = _this._html; | ||
document.body.appendChild(_this.host); | ||
return aurelia.enhance(_this._bindingContext, _this.host).then(function () { | ||
_this._rootView = aurelia.root; | ||
_this.element = _this.host.firstElementChild; | ||
if (aurelia.root.controllers.length) { | ||
_this.viewModel = aurelia.root.controllers[0].viewModel; | ||
} | ||
return new Promise(function (resolve) { | ||
return setTimeout(function () { | ||
return resolve(); | ||
}, 0); | ||
return StageComponent; | ||
}()); | ||
exports.StageComponent = StageComponent; | ||
var ComponentTester = /** @class */ (function () { | ||
function ComponentTester() { | ||
this.resources = []; | ||
} | ||
ComponentTester.prototype.configure = function (aurelia) { | ||
return aurelia.use.standardConfiguration(); | ||
}; | ||
ComponentTester.prototype.bootstrap = function (configure) { | ||
this.configure = configure; | ||
}; | ||
ComponentTester.prototype.withResources = function (resources) { | ||
this.resources = resources; | ||
return this; | ||
}; | ||
ComponentTester.prototype.inView = function (html) { | ||
this.html = html; | ||
return this; | ||
}; | ||
ComponentTester.prototype.boundTo = function (bindingContext) { | ||
this.bindingContext = bindingContext; | ||
return this; | ||
}; | ||
ComponentTester.prototype.manuallyHandleLifecycle = function () { | ||
this._prepareLifecycle(); | ||
return this; | ||
}; | ||
ComponentTester.prototype.create = function (bootstrap) { | ||
var _this = this; | ||
return bootstrap(function (aurelia) { | ||
return Promise.resolve(_this.configure(aurelia)).then(function () { | ||
if (_this.resources) { | ||
aurelia.use.globalResources(_this.resources); | ||
} | ||
return aurelia.start().then(function () { | ||
_this.host = document.createElement('div'); | ||
_this.host.innerHTML = _this.html; | ||
document.body.appendChild(_this.host); | ||
return aurelia.enhance(_this.bindingContext, _this.host).then(function () { | ||
_this.rootView = aurelia.root; | ||
_this.element = _this.host.firstElementChild; | ||
if (aurelia.root.controllers.length) { | ||
_this.viewModel = aurelia.root.controllers[0].viewModel; | ||
} | ||
return new Promise(function (resolve) { return setTimeout(function () { return resolve(); }, 0); }); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}; | ||
ComponentTester.prototype.dispose = function dispose() { | ||
if (this.host === undefined || this._rootView === undefined) { | ||
throw new Error('Cannot call ComponentTester.dispose() before ComponentTester.create()'); | ||
} | ||
this._rootView.detached(); | ||
this._rootView.unbind(); | ||
return this.host.parentNode.removeChild(this.host); | ||
}; | ||
ComponentTester.prototype._prepareLifecycle = function _prepareLifecycle() { | ||
var _this2 = this; | ||
var bindPrototype = _aureliaTemplating.View.prototype.bind; | ||
_aureliaTemplating.View.prototype.bind = function () {}; | ||
this.bind = function (bindingContext) { | ||
return new Promise(function (resolve) { | ||
_aureliaTemplating.View.prototype.bind = bindPrototype; | ||
if (bindingContext !== undefined) { | ||
_this2._bindingContext = bindingContext; | ||
}; | ||
ComponentTester.prototype.dispose = function () { | ||
if (this.host === undefined || this.rootView === undefined) { | ||
throw new Error('Cannot call ComponentTester.dispose() before ComponentTester.create()'); | ||
} | ||
_this2._rootView.bind(_this2._bindingContext); | ||
setTimeout(function () { | ||
return resolve(); | ||
}, 0); | ||
}); | ||
this.rootView.detached(); | ||
this.rootView.unbind(); | ||
return this.host.parentNode.removeChild(this.host); | ||
}; | ||
var attachedPrototype = _aureliaTemplating.View.prototype.attached; | ||
_aureliaTemplating.View.prototype.attached = function () {}; | ||
this.attached = function () { | ||
return new Promise(function (resolve) { | ||
_aureliaTemplating.View.prototype.attached = attachedPrototype; | ||
_this2._rootView.attached(); | ||
setTimeout(function () { | ||
return resolve(); | ||
}, 0); | ||
}); | ||
ComponentTester.prototype._prepareLifecycle = function () { | ||
var _this = this; | ||
// bind | ||
var bindPrototype = aurelia_templating_1.View.prototype.bind; | ||
// tslint:disable-next-line:no-empty | ||
aurelia_templating_1.View.prototype.bind = function () { }; | ||
this.bind = function (bindingContext) { return new Promise(function (resolve) { | ||
aurelia_templating_1.View.prototype.bind = bindPrototype; | ||
if (bindingContext !== undefined) { | ||
_this.bindingContext = bindingContext; | ||
} | ||
_this.rootView.bind(_this.bindingContext); | ||
setTimeout(function () { return resolve(); }, 0); | ||
}); }; | ||
// attached | ||
var attachedPrototype = aurelia_templating_1.View.prototype.attached; | ||
// tslint:disable-next-line:no-empty | ||
aurelia_templating_1.View.prototype.attached = function () { }; | ||
this.attached = function () { return new Promise(function (resolve) { | ||
aurelia_templating_1.View.prototype.attached = attachedPrototype; | ||
_this.rootView.attached(); | ||
setTimeout(function () { return resolve(); }, 0); | ||
}); }; | ||
// detached | ||
this.detached = function () { return new Promise(function (resolve) { | ||
_this.rootView.detached(); | ||
setTimeout(function () { return resolve(); }, 0); | ||
}); }; | ||
// unbind | ||
this.unbind = function () { return new Promise(function (resolve) { | ||
_this.rootView.unbind(); | ||
setTimeout(function () { return resolve(); }, 0); | ||
}); }; | ||
}; | ||
this.detached = function () { | ||
return new Promise(function (resolve) { | ||
_this2._rootView.detached(); | ||
setTimeout(function () { | ||
return resolve(); | ||
}, 0); | ||
}); | ||
ComponentTester.prototype.waitForElement = function (selector, options) { | ||
var _this = this; | ||
return wait_1.waitFor(function () { return _this.element.querySelector(selector); }, options); | ||
}; | ||
this.unbind = function () { | ||
return new Promise(function (resolve) { | ||
_this2._rootView.unbind(); | ||
setTimeout(function () { | ||
return resolve(); | ||
}, 0); | ||
}); | ||
ComponentTester.prototype.waitForElements = function (selector, options) { | ||
var _this = this; | ||
return wait_1.waitFor(function () { return _this.element.querySelectorAll(selector); }, options); | ||
}; | ||
}; | ||
ComponentTester.prototype.waitForElement = function waitForElement(selector, options) { | ||
var _this3 = this; | ||
return (0, _wait.waitFor)(function () { | ||
return _this3.element.querySelector(selector); | ||
}, options); | ||
}; | ||
ComponentTester.prototype.waitForElements = function waitForElements(selector, options) { | ||
var _this4 = this; | ||
return (0, _wait.waitFor)(function () { | ||
return _this4.element.querySelectorAll(selector); | ||
}, options); | ||
}; | ||
return ComponentTester; | ||
}(); | ||
return ComponentTester; | ||
}()); | ||
exports.ComponentTester = ComponentTester; |
@@ -1,57 +0,69 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.ViewSpy = undefined; | ||
var _dec, _class; | ||
var _aureliaTemplating = require('aurelia-templating'); | ||
var _aureliaLogging = require('aurelia-logging'); | ||
var LogManager = _interopRequireWildcard(_aureliaLogging); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | ||
var ViewSpy = exports.ViewSpy = (_dec = (0, _aureliaTemplating.customAttribute)('view-spy'), _dec(_class = function () { | ||
function ViewSpy() { | ||
this.logger = LogManager.getLogger('view-spy'); | ||
} | ||
ViewSpy.prototype._log = function _log(lifecycleName, context) { | ||
if (!this.value && lifecycleName === 'created') { | ||
this.logger.info(lifecycleName, this.view); | ||
} else if (this.value && this.value.indexOf(lifecycleName) !== -1) { | ||
this.logger.info(lifecycleName, this.view, context); | ||
"use strict"; | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var aurelia_templating_1 = require("aurelia-templating"); | ||
var aurelia_logging_1 = require("aurelia-logging"); | ||
/** | ||
* Attribute to be placed on any HTML element in a view to emit the View instance | ||
* to the debug console, giving you insight into the live View instance, including | ||
* all child views, live bindings, behaviors and more. | ||
*/ | ||
var ViewSpy = /** @class */ (function () { | ||
/** | ||
* Creates a new instance of ViewSpy. | ||
*/ | ||
function ViewSpy() { | ||
this.logger = aurelia_logging_1.getLogger('view-spy'); | ||
} | ||
}; | ||
ViewSpy.prototype.created = function created(view) { | ||
this.view = view; | ||
this._log('created'); | ||
}; | ||
ViewSpy.prototype.bind = function bind(bindingContext) { | ||
this._log('bind', bindingContext); | ||
}; | ||
ViewSpy.prototype.attached = function attached() { | ||
this._log('attached'); | ||
}; | ||
ViewSpy.prototype.detached = function detached() { | ||
this._log('detached'); | ||
}; | ||
ViewSpy.prototype.unbind = function unbind() { | ||
this._log('unbind'); | ||
}; | ||
return ViewSpy; | ||
}()) || _class); | ||
ViewSpy.prototype._log = function (lifecycleName, context) { | ||
if (!this.value && lifecycleName === 'created') { | ||
this.logger.info(lifecycleName, this.view); | ||
} | ||
else if (this.value && this.value.indexOf(lifecycleName) !== -1) { | ||
this.logger.info(lifecycleName, this.view, context); | ||
} | ||
}; | ||
/** | ||
* Invoked when the target view is created. | ||
* @param view The target view. | ||
*/ | ||
ViewSpy.prototype.created = function (view) { | ||
this.view = view; | ||
this._log('created'); | ||
}; | ||
/** | ||
* Invoked when the target view is bound. | ||
* @param bindingContext The target view's binding context. | ||
*/ | ||
ViewSpy.prototype.bind = function (bindingContext) { | ||
this._log('bind', bindingContext); | ||
}; | ||
/** | ||
* Invoked when the target element is attached to the DOM. | ||
*/ | ||
ViewSpy.prototype.attached = function () { | ||
this._log('attached'); | ||
}; | ||
/** | ||
* Invoked when the target element is detached from the DOM. | ||
*/ | ||
ViewSpy.prototype.detached = function () { | ||
this._log('detached'); | ||
}; | ||
/** | ||
* Invoked when the target element is unbound. | ||
*/ | ||
ViewSpy.prototype.unbind = function () { | ||
this._log('unbind'); | ||
}; | ||
ViewSpy = __decorate([ | ||
aurelia_templating_1.customAttribute('view-spy') | ||
], ViewSpy); | ||
return ViewSpy; | ||
}()); | ||
exports.ViewSpy = ViewSpy; |
@@ -1,50 +0,50 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.waitFor = waitFor; | ||
exports.waitForDocumentElement = waitForDocumentElement; | ||
exports.waitForDocumentElements = waitForDocumentElements; | ||
"use strict"; | ||
var __assign = (this && this.__assign) || Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
* Generic function to wait for something to happen. Uses polling | ||
* @param getter: a getter function that returns anything else than `null` or an | ||
* empty array or an empty jQuery object when the | ||
* condition is met | ||
* @param options: lookup options, defaults to | ||
* `{present: true, interval: 50, timeout: 5000}` | ||
*/ | ||
function waitFor(getter, options) { | ||
var timedOut = false; | ||
options = Object.assign({ | ||
present: true, | ||
interval: 50, | ||
timeout: 5000 | ||
}, options); | ||
function wait() { | ||
var element = getter(); | ||
var found = element !== null && (!(element instanceof NodeList) && !element.jquery || element.length > 0); | ||
if (!options.present ^ found || timedOut) { | ||
return Promise.resolve(element); | ||
if (options === void 0) { options = { present: true, interval: 50, timeout: 5000 }; } | ||
// prevents infinite recursion if the request times out | ||
var timedOut = false; | ||
options = __assign({ present: true, interval: 50, timeout: 5000 }, options); | ||
function wait() { | ||
var element = getter(); | ||
// boolean is needed here, hence the length > 0 | ||
var found = element !== null && (!(element instanceof NodeList) && | ||
!element.jquery || element.length > 0); | ||
if (!options.present === !found || timedOut) { | ||
return Promise.resolve(element); | ||
} | ||
return new Promise(function (rs) { return setTimeout(rs, options.interval); }).then(wait); | ||
} | ||
return new Promise(function (rs) { | ||
return setTimeout(rs, options.interval); | ||
}).then(wait); | ||
} | ||
return Promise.race([new Promise(function (rs, rj) { | ||
return setTimeout(function () { | ||
timedOut = true; | ||
rj(options.present ? 'Element not found' : 'Element not removed'); | ||
}, options.timeout); | ||
}), wait()]); | ||
return Promise.race([ | ||
new Promise(function (_, rj) { return setTimeout(function () { | ||
timedOut = true; | ||
rj(options.present ? 'Element not found' : 'Element not removed'); | ||
}, options.timeout); }), | ||
wait() | ||
]); | ||
} | ||
exports.waitFor = waitFor; | ||
function waitForDocumentElement(selector, options) { | ||
return waitFor(function () { | ||
return document.querySelector(selector); | ||
}, options); | ||
return waitFor(function () { return document.querySelector(selector); }, options); | ||
} | ||
exports.waitForDocumentElement = waitForDocumentElement; | ||
function waitForDocumentElements(selector, options) { | ||
return waitFor(function () { | ||
return document.querySelectorAll(selector); | ||
}, options); | ||
} | ||
return waitFor(function () { return document.querySelectorAll(selector); }, options); | ||
} | ||
exports.waitForDocumentElements = waitForDocumentElements; |
@@ -1,10 +0,10 @@ | ||
import { CompileSpy } from './compile-spy'; | ||
import { ViewSpy } from './view-spy'; | ||
import { StageComponent, ComponentTester } from './component-tester'; | ||
import { waitFor, waitForDocumentElement, waitForDocumentElements } from './wait'; | ||
function configure(config) { | ||
config.globalResources('./compile-spy', './view-spy'); | ||
export * from './compile-spy'; | ||
export * from './view-spy'; | ||
export * from './component-tester'; | ||
export * from './wait'; | ||
export function configure(config) { | ||
config.globalResources([ | ||
'./compile-spy', | ||
'./view-spy' | ||
]); | ||
} | ||
export { CompileSpy, ViewSpy, StageComponent, ComponentTester, configure, waitFor, waitForDocumentElement, waitForDocumentElements }; |
@@ -1,12 +0,30 @@ | ||
var _dec, _dec2, _class; | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
import { customAttribute, TargetInstruction } from 'aurelia-templating'; | ||
import { inject } from 'aurelia-dependency-injection'; | ||
import * as LogManager from 'aurelia-logging'; | ||
import { getLogger } from 'aurelia-logging'; | ||
import { DOM } from 'aurelia-pal'; | ||
export let CompileSpy = (_dec = customAttribute('compile-spy'), _dec2 = inject(DOM.Element, TargetInstruction), _dec(_class = _dec2(_class = class CompileSpy { | ||
constructor(element, instruction) { | ||
LogManager.getLogger('compile-spy').info(element, instruction); | ||
} | ||
}) || _class) || _class); | ||
/** | ||
* Attribute to be placed on any element to have it emit the View Compiler's | ||
* TargetInstruction into the debug console, giving you insight into all the | ||
* parsed bindings, behaviors and event handers for the targeted element. | ||
*/ | ||
let CompileSpy = class CompileSpy { | ||
/** | ||
* Creates and instanse of CompileSpy. | ||
* @param element target element on where attribute is placed on. | ||
* @param instruction instructions for how the target element should be enhanced. | ||
*/ | ||
constructor(element, instruction) { | ||
getLogger('compile-spy').info(element.toString(), instruction); | ||
} | ||
}; | ||
CompileSpy = __decorate([ | ||
customAttribute('compile-spy'), | ||
inject(DOM.Element, TargetInstruction) | ||
], CompileSpy); | ||
export { CompileSpy }; |
import { View } from 'aurelia-templating'; | ||
import { Aurelia } from 'aurelia-framework'; | ||
import { waitFor } from './wait'; | ||
export let StageComponent = class StageComponent { | ||
static withResources(resources) { | ||
return new ComponentTester().withResources(resources); | ||
} | ||
}; | ||
export let ComponentTester = class ComponentTester { | ||
constructor() { | ||
this.configure = aurelia => aurelia.use.standardConfiguration(); | ||
this._resources = []; | ||
} | ||
bootstrap(configure) { | ||
this.configure = configure; | ||
} | ||
withResources(resources) { | ||
this._resources = resources; | ||
return this; | ||
} | ||
inView(html) { | ||
this._html = html; | ||
return this; | ||
} | ||
boundTo(bindingContext) { | ||
this._bindingContext = bindingContext; | ||
return this; | ||
} | ||
manuallyHandleLifecycle() { | ||
this._prepareLifecycle(); | ||
return this; | ||
} | ||
create(bootstrap) { | ||
return bootstrap(aurelia => { | ||
return Promise.resolve(this.configure(aurelia)).then(() => { | ||
if (this._resources) { | ||
aurelia.use.globalResources(this._resources); | ||
export class StageComponent { | ||
static withResources(resources = []) { | ||
return new ComponentTester().withResources(resources); | ||
} | ||
} | ||
export class ComponentTester { | ||
constructor() { | ||
this.resources = []; | ||
} | ||
configure(aurelia) { | ||
return aurelia.use.standardConfiguration(); | ||
} | ||
bootstrap(configure) { | ||
this.configure = configure; | ||
} | ||
withResources(resources) { | ||
this.resources = resources; | ||
return this; | ||
} | ||
inView(html) { | ||
this.html = html; | ||
return this; | ||
} | ||
boundTo(bindingContext) { | ||
this.bindingContext = bindingContext; | ||
return this; | ||
} | ||
manuallyHandleLifecycle() { | ||
this._prepareLifecycle(); | ||
return this; | ||
} | ||
create(bootstrap) { | ||
return bootstrap((aurelia) => { | ||
return Promise.resolve(this.configure(aurelia)).then(() => { | ||
if (this.resources) { | ||
aurelia.use.globalResources(this.resources); | ||
} | ||
return aurelia.start().then(() => { | ||
this.host = document.createElement('div'); | ||
this.host.innerHTML = this.html; | ||
document.body.appendChild(this.host); | ||
return aurelia.enhance(this.bindingContext, this.host).then(() => { | ||
this.rootView = aurelia.root; | ||
this.element = this.host.firstElementChild; | ||
if (aurelia.root.controllers.length) { | ||
this.viewModel = aurelia.root.controllers[0].viewModel; | ||
} | ||
return new Promise(resolve => setTimeout(() => resolve(), 0)); | ||
}); | ||
}); | ||
}); | ||
}); | ||
} | ||
dispose() { | ||
if (this.host === undefined || this.rootView === undefined) { | ||
throw new Error('Cannot call ComponentTester.dispose() before ComponentTester.create()'); | ||
} | ||
return aurelia.start().then(a => { | ||
this.host = document.createElement('div'); | ||
this.host.innerHTML = this._html; | ||
document.body.appendChild(this.host); | ||
return aurelia.enhance(this._bindingContext, this.host).then(() => { | ||
this._rootView = aurelia.root; | ||
this.element = this.host.firstElementChild; | ||
if (aurelia.root.controllers.length) { | ||
this.viewModel = aurelia.root.controllers[0].viewModel; | ||
this.rootView.detached(); | ||
this.rootView.unbind(); | ||
return this.host.parentNode.removeChild(this.host); | ||
} | ||
_prepareLifecycle() { | ||
// bind | ||
const bindPrototype = View.prototype.bind; | ||
// tslint:disable-next-line:no-empty | ||
View.prototype.bind = () => { }; | ||
this.bind = bindingContext => new Promise(resolve => { | ||
View.prototype.bind = bindPrototype; | ||
if (bindingContext !== undefined) { | ||
this.bindingContext = bindingContext; | ||
} | ||
return new Promise(resolve => setTimeout(() => resolve(), 0)); | ||
}); | ||
this.rootView.bind(this.bindingContext); | ||
setTimeout(() => resolve(), 0); | ||
}); | ||
}); | ||
}); | ||
} | ||
dispose() { | ||
if (this.host === undefined || this._rootView === undefined) { | ||
throw new Error('Cannot call ComponentTester.dispose() before ComponentTester.create()'); | ||
// attached | ||
const attachedPrototype = View.prototype.attached; | ||
// tslint:disable-next-line:no-empty | ||
View.prototype.attached = () => { }; | ||
this.attached = () => new Promise(resolve => { | ||
View.prototype.attached = attachedPrototype; | ||
this.rootView.attached(); | ||
setTimeout(() => resolve(), 0); | ||
}); | ||
// detached | ||
this.detached = () => new Promise(resolve => { | ||
this.rootView.detached(); | ||
setTimeout(() => resolve(), 0); | ||
}); | ||
// unbind | ||
this.unbind = () => new Promise(resolve => { | ||
this.rootView.unbind(); | ||
setTimeout(() => resolve(), 0); | ||
}); | ||
} | ||
this._rootView.detached(); | ||
this._rootView.unbind(); | ||
return this.host.parentNode.removeChild(this.host); | ||
} | ||
_prepareLifecycle() { | ||
const bindPrototype = View.prototype.bind; | ||
View.prototype.bind = () => {}; | ||
this.bind = bindingContext => new Promise(resolve => { | ||
View.prototype.bind = bindPrototype; | ||
if (bindingContext !== undefined) { | ||
this._bindingContext = bindingContext; | ||
} | ||
this._rootView.bind(this._bindingContext); | ||
setTimeout(() => resolve(), 0); | ||
}); | ||
const attachedPrototype = View.prototype.attached; | ||
View.prototype.attached = () => {}; | ||
this.attached = () => new Promise(resolve => { | ||
View.prototype.attached = attachedPrototype; | ||
this._rootView.attached(); | ||
setTimeout(() => resolve(), 0); | ||
}); | ||
this.detached = () => new Promise(resolve => { | ||
this._rootView.detached(); | ||
setTimeout(() => resolve(), 0); | ||
}); | ||
this.unbind = () => new Promise(resolve => { | ||
this._rootView.unbind(); | ||
setTimeout(() => resolve(), 0); | ||
}); | ||
} | ||
waitForElement(selector, options) { | ||
return waitFor(() => this.element.querySelector(selector), options); | ||
} | ||
waitForElements(selector, options) { | ||
return waitFor(() => this.element.querySelectorAll(selector), options); | ||
} | ||
}; | ||
waitForElement(selector, options) { | ||
return waitFor(() => this.element.querySelector(selector), options); | ||
} | ||
waitForElements(selector, options) { | ||
return waitFor(() => this.element.querySelectorAll(selector), options); | ||
} | ||
} |
@@ -1,39 +0,66 @@ | ||
var _dec, _class; | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
import { customAttribute } from 'aurelia-templating'; | ||
import * as LogManager from 'aurelia-logging'; | ||
export let ViewSpy = (_dec = customAttribute('view-spy'), _dec(_class = class ViewSpy { | ||
constructor() { | ||
this.logger = LogManager.getLogger('view-spy'); | ||
} | ||
_log(lifecycleName, context) { | ||
if (!this.value && lifecycleName === 'created') { | ||
this.logger.info(lifecycleName, this.view); | ||
} else if (this.value && this.value.indexOf(lifecycleName) !== -1) { | ||
this.logger.info(lifecycleName, this.view, context); | ||
import { getLogger } from 'aurelia-logging'; | ||
/** | ||
* Attribute to be placed on any HTML element in a view to emit the View instance | ||
* to the debug console, giving you insight into the live View instance, including | ||
* all child views, live bindings, behaviors and more. | ||
*/ | ||
let ViewSpy = class ViewSpy { | ||
/** | ||
* Creates a new instance of ViewSpy. | ||
*/ | ||
constructor() { | ||
this.logger = getLogger('view-spy'); | ||
} | ||
} | ||
created(view) { | ||
this.view = view; | ||
this._log('created'); | ||
} | ||
bind(bindingContext) { | ||
this._log('bind', bindingContext); | ||
} | ||
attached() { | ||
this._log('attached'); | ||
} | ||
detached() { | ||
this._log('detached'); | ||
} | ||
unbind() { | ||
this._log('unbind'); | ||
} | ||
}) || _class); | ||
_log(lifecycleName, context) { | ||
if (!this.value && lifecycleName === 'created') { | ||
this.logger.info(lifecycleName, this.view); | ||
} | ||
else if (this.value && this.value.indexOf(lifecycleName) !== -1) { | ||
this.logger.info(lifecycleName, this.view, context); | ||
} | ||
} | ||
/** | ||
* Invoked when the target view is created. | ||
* @param view The target view. | ||
*/ | ||
created(view) { | ||
this.view = view; | ||
this._log('created'); | ||
} | ||
/** | ||
* Invoked when the target view is bound. | ||
* @param bindingContext The target view's binding context. | ||
*/ | ||
bind(bindingContext) { | ||
this._log('bind', bindingContext); | ||
} | ||
/** | ||
* Invoked when the target element is attached to the DOM. | ||
*/ | ||
attached() { | ||
this._log('attached'); | ||
} | ||
/** | ||
* Invoked when the target element is detached from the DOM. | ||
*/ | ||
detached() { | ||
this._log('detached'); | ||
} | ||
/** | ||
* Invoked when the target element is unbound. | ||
*/ | ||
unbind() { | ||
this._log('unbind'); | ||
} | ||
}; | ||
ViewSpy = __decorate([ | ||
customAttribute('view-spy') | ||
], ViewSpy); | ||
export { ViewSpy }; |
@@ -1,35 +0,36 @@ | ||
export function waitFor(getter, options) { | ||
let timedOut = false; | ||
options = Object.assign({ | ||
present: true, | ||
interval: 50, | ||
timeout: 5000 | ||
}, options); | ||
function wait() { | ||
let element = getter(); | ||
let found = element !== null && (!(element instanceof NodeList) && !element.jquery || element.length > 0); | ||
if (!options.present ^ found || timedOut) { | ||
return Promise.resolve(element); | ||
/** | ||
* Generic function to wait for something to happen. Uses polling | ||
* @param getter: a getter function that returns anything else than `null` or an | ||
* empty array or an empty jQuery object when the | ||
* condition is met | ||
* @param options: lookup options, defaults to | ||
* `{present: true, interval: 50, timeout: 5000}` | ||
*/ | ||
export function waitFor(getter, options = { present: true, interval: 50, timeout: 5000 }) { | ||
// prevents infinite recursion if the request times out | ||
let timedOut = false; | ||
options = Object.assign({ present: true, interval: 50, timeout: 5000 }, options); | ||
function wait() { | ||
const element = getter(); | ||
// boolean is needed here, hence the length > 0 | ||
const found = element !== null && (!(element instanceof NodeList) && | ||
!element.jquery || element.length > 0); | ||
if (!options.present === !found || timedOut) { | ||
return Promise.resolve(element); | ||
} | ||
return new Promise(rs => setTimeout(rs, options.interval)).then(wait); | ||
} | ||
return new Promise(rs => setTimeout(rs, options.interval)).then(wait); | ||
} | ||
return Promise.race([new Promise((rs, rj) => setTimeout(() => { | ||
timedOut = true; | ||
rj(options.present ? 'Element not found' : 'Element not removed'); | ||
}, options.timeout)), wait()]); | ||
return Promise.race([ | ||
new Promise((_, rj) => setTimeout(() => { | ||
timedOut = true; | ||
rj(options.present ? 'Element not found' : 'Element not removed'); | ||
}, options.timeout)), | ||
wait() | ||
]); | ||
} | ||
export function waitForDocumentElement(selector, options) { | ||
return waitFor(() => document.querySelector(selector), options); | ||
return waitFor(() => document.querySelector(selector), options); | ||
} | ||
export function waitForDocumentElements(selector, options) { | ||
return waitFor(() => document.querySelectorAll(selector), options); | ||
} | ||
return waitFor(() => document.querySelectorAll(selector), options); | ||
} |
@@ -1,10 +0,10 @@ | ||
import { CompileSpy } from './compile-spy'; | ||
import { ViewSpy } from './view-spy'; | ||
import { StageComponent, ComponentTester } from './component-tester'; | ||
import { waitFor, waitForDocumentElement, waitForDocumentElements } from './wait'; | ||
function configure(config) { | ||
config.globalResources('./compile-spy', './view-spy'); | ||
export * from './compile-spy'; | ||
export * from './view-spy'; | ||
export * from './component-tester'; | ||
export * from './wait'; | ||
export function configure(config) { | ||
config.globalResources([ | ||
'./compile-spy', | ||
'./view-spy' | ||
]); | ||
} | ||
export { CompileSpy, ViewSpy, StageComponent, ComponentTester, configure, waitFor, waitForDocumentElement, waitForDocumentElements }; |
@@ -1,14 +0,31 @@ | ||
var _dec, _dec2, _class; | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
import { customAttribute, TargetInstruction } from 'aurelia-templating'; | ||
import { inject } from 'aurelia-dependency-injection'; | ||
import * as LogManager from 'aurelia-logging'; | ||
import { getLogger } from 'aurelia-logging'; | ||
import { DOM } from 'aurelia-pal'; | ||
export var CompileSpy = (_dec = customAttribute('compile-spy'), _dec2 = inject(DOM.Element, TargetInstruction), _dec(_class = _dec2(_class = function CompileSpy(element, instruction) { | ||
LogManager.getLogger('compile-spy').info(element, instruction); | ||
}) || _class) || _class); | ||
/** | ||
* Attribute to be placed on any element to have it emit the View Compiler's | ||
* TargetInstruction into the debug console, giving you insight into all the | ||
* parsed bindings, behaviors and event handers for the targeted element. | ||
*/ | ||
var CompileSpy = /** @class */ (function () { | ||
/** | ||
* Creates and instanse of CompileSpy. | ||
* @param element target element on where attribute is placed on. | ||
* @param instruction instructions for how the target element should be enhanced. | ||
*/ | ||
function CompileSpy(element, instruction) { | ||
getLogger('compile-spy').info(element.toString(), instruction); | ||
} | ||
CompileSpy = __decorate([ | ||
customAttribute('compile-spy'), | ||
inject(DOM.Element, TargetInstruction) | ||
], CompileSpy); | ||
return CompileSpy; | ||
}()); | ||
export { CompileSpy }; |
@@ -1,165 +0,114 @@ | ||
import { View } from 'aurelia-templating'; | ||
import { Aurelia } from 'aurelia-framework'; | ||
import { waitFor } from './wait'; | ||
export var StageComponent = function () { | ||
function StageComponent() { | ||
} | ||
StageComponent.withResources = function withResources(resources) { | ||
return new ComponentTester().withResources(resources); | ||
}; | ||
return StageComponent; | ||
}(); | ||
export var ComponentTester = function () { | ||
function ComponentTester() { | ||
this.configure = function (aurelia) { | ||
return aurelia.use.standardConfiguration(); | ||
var StageComponent = /** @class */ (function () { | ||
function StageComponent() { | ||
} | ||
StageComponent.withResources = function (resources) { | ||
if (resources === void 0) { resources = []; } | ||
return new ComponentTester().withResources(resources); | ||
}; | ||
this._resources = []; | ||
} | ||
ComponentTester.prototype.bootstrap = function bootstrap(configure) { | ||
this.configure = configure; | ||
}; | ||
ComponentTester.prototype.withResources = function withResources(resources) { | ||
this._resources = resources; | ||
return this; | ||
}; | ||
ComponentTester.prototype.inView = function inView(html) { | ||
this._html = html; | ||
return this; | ||
}; | ||
ComponentTester.prototype.boundTo = function boundTo(bindingContext) { | ||
this._bindingContext = bindingContext; | ||
return this; | ||
}; | ||
ComponentTester.prototype.manuallyHandleLifecycle = function manuallyHandleLifecycle() { | ||
this._prepareLifecycle(); | ||
return this; | ||
}; | ||
ComponentTester.prototype.create = function create(bootstrap) { | ||
var _this = this; | ||
return bootstrap(function (aurelia) { | ||
return Promise.resolve(_this.configure(aurelia)).then(function () { | ||
if (_this._resources) { | ||
aurelia.use.globalResources(_this._resources); | ||
} | ||
return aurelia.start().then(function (a) { | ||
_this.host = document.createElement('div'); | ||
_this.host.innerHTML = _this._html; | ||
document.body.appendChild(_this.host); | ||
return aurelia.enhance(_this._bindingContext, _this.host).then(function () { | ||
_this._rootView = aurelia.root; | ||
_this.element = _this.host.firstElementChild; | ||
if (aurelia.root.controllers.length) { | ||
_this.viewModel = aurelia.root.controllers[0].viewModel; | ||
} | ||
return new Promise(function (resolve) { | ||
return setTimeout(function () { | ||
return resolve(); | ||
}, 0); | ||
return StageComponent; | ||
}()); | ||
export { StageComponent }; | ||
var ComponentTester = /** @class */ (function () { | ||
function ComponentTester() { | ||
this.resources = []; | ||
} | ||
ComponentTester.prototype.configure = function (aurelia) { | ||
return aurelia.use.standardConfiguration(); | ||
}; | ||
ComponentTester.prototype.bootstrap = function (configure) { | ||
this.configure = configure; | ||
}; | ||
ComponentTester.prototype.withResources = function (resources) { | ||
this.resources = resources; | ||
return this; | ||
}; | ||
ComponentTester.prototype.inView = function (html) { | ||
this.html = html; | ||
return this; | ||
}; | ||
ComponentTester.prototype.boundTo = function (bindingContext) { | ||
this.bindingContext = bindingContext; | ||
return this; | ||
}; | ||
ComponentTester.prototype.manuallyHandleLifecycle = function () { | ||
this._prepareLifecycle(); | ||
return this; | ||
}; | ||
ComponentTester.prototype.create = function (bootstrap) { | ||
var _this = this; | ||
return bootstrap(function (aurelia) { | ||
return Promise.resolve(_this.configure(aurelia)).then(function () { | ||
if (_this.resources) { | ||
aurelia.use.globalResources(_this.resources); | ||
} | ||
return aurelia.start().then(function () { | ||
_this.host = document.createElement('div'); | ||
_this.host.innerHTML = _this.html; | ||
document.body.appendChild(_this.host); | ||
return aurelia.enhance(_this.bindingContext, _this.host).then(function () { | ||
_this.rootView = aurelia.root; | ||
_this.element = _this.host.firstElementChild; | ||
if (aurelia.root.controllers.length) { | ||
_this.viewModel = aurelia.root.controllers[0].viewModel; | ||
} | ||
return new Promise(function (resolve) { return setTimeout(function () { return resolve(); }, 0); }); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}; | ||
ComponentTester.prototype.dispose = function dispose() { | ||
if (this.host === undefined || this._rootView === undefined) { | ||
throw new Error('Cannot call ComponentTester.dispose() before ComponentTester.create()'); | ||
} | ||
this._rootView.detached(); | ||
this._rootView.unbind(); | ||
return this.host.parentNode.removeChild(this.host); | ||
}; | ||
ComponentTester.prototype._prepareLifecycle = function _prepareLifecycle() { | ||
var _this2 = this; | ||
var bindPrototype = View.prototype.bind; | ||
View.prototype.bind = function () {}; | ||
this.bind = function (bindingContext) { | ||
return new Promise(function (resolve) { | ||
View.prototype.bind = bindPrototype; | ||
if (bindingContext !== undefined) { | ||
_this2._bindingContext = bindingContext; | ||
}; | ||
ComponentTester.prototype.dispose = function () { | ||
if (this.host === undefined || this.rootView === undefined) { | ||
throw new Error('Cannot call ComponentTester.dispose() before ComponentTester.create()'); | ||
} | ||
_this2._rootView.bind(_this2._bindingContext); | ||
setTimeout(function () { | ||
return resolve(); | ||
}, 0); | ||
}); | ||
this.rootView.detached(); | ||
this.rootView.unbind(); | ||
return this.host.parentNode.removeChild(this.host); | ||
}; | ||
var attachedPrototype = View.prototype.attached; | ||
View.prototype.attached = function () {}; | ||
this.attached = function () { | ||
return new Promise(function (resolve) { | ||
View.prototype.attached = attachedPrototype; | ||
_this2._rootView.attached(); | ||
setTimeout(function () { | ||
return resolve(); | ||
}, 0); | ||
}); | ||
ComponentTester.prototype._prepareLifecycle = function () { | ||
var _this = this; | ||
// bind | ||
var bindPrototype = View.prototype.bind; | ||
// tslint:disable-next-line:no-empty | ||
View.prototype.bind = function () { }; | ||
this.bind = function (bindingContext) { return new Promise(function (resolve) { | ||
View.prototype.bind = bindPrototype; | ||
if (bindingContext !== undefined) { | ||
_this.bindingContext = bindingContext; | ||
} | ||
_this.rootView.bind(_this.bindingContext); | ||
setTimeout(function () { return resolve(); }, 0); | ||
}); }; | ||
// attached | ||
var attachedPrototype = View.prototype.attached; | ||
// tslint:disable-next-line:no-empty | ||
View.prototype.attached = function () { }; | ||
this.attached = function () { return new Promise(function (resolve) { | ||
View.prototype.attached = attachedPrototype; | ||
_this.rootView.attached(); | ||
setTimeout(function () { return resolve(); }, 0); | ||
}); }; | ||
// detached | ||
this.detached = function () { return new Promise(function (resolve) { | ||
_this.rootView.detached(); | ||
setTimeout(function () { return resolve(); }, 0); | ||
}); }; | ||
// unbind | ||
this.unbind = function () { return new Promise(function (resolve) { | ||
_this.rootView.unbind(); | ||
setTimeout(function () { return resolve(); }, 0); | ||
}); }; | ||
}; | ||
this.detached = function () { | ||
return new Promise(function (resolve) { | ||
_this2._rootView.detached(); | ||
setTimeout(function () { | ||
return resolve(); | ||
}, 0); | ||
}); | ||
ComponentTester.prototype.waitForElement = function (selector, options) { | ||
var _this = this; | ||
return waitFor(function () { return _this.element.querySelector(selector); }, options); | ||
}; | ||
this.unbind = function () { | ||
return new Promise(function (resolve) { | ||
_this2._rootView.unbind(); | ||
setTimeout(function () { | ||
return resolve(); | ||
}, 0); | ||
}); | ||
ComponentTester.prototype.waitForElements = function (selector, options) { | ||
var _this = this; | ||
return waitFor(function () { return _this.element.querySelectorAll(selector); }, options); | ||
}; | ||
}; | ||
ComponentTester.prototype.waitForElement = function waitForElement(selector, options) { | ||
var _this3 = this; | ||
return waitFor(function () { | ||
return _this3.element.querySelector(selector); | ||
}, options); | ||
}; | ||
ComponentTester.prototype.waitForElements = function waitForElements(selector, options) { | ||
var _this4 = this; | ||
return waitFor(function () { | ||
return _this4.element.querySelectorAll(selector); | ||
}, options); | ||
}; | ||
return ComponentTester; | ||
}(); | ||
return ComponentTester; | ||
}()); | ||
export { ComponentTester }; |
@@ -1,45 +0,67 @@ | ||
var _dec, _class; | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
import { customAttribute } from 'aurelia-templating'; | ||
import * as LogManager from 'aurelia-logging'; | ||
export var ViewSpy = (_dec = customAttribute('view-spy'), _dec(_class = function () { | ||
function ViewSpy() { | ||
this.logger = LogManager.getLogger('view-spy'); | ||
} | ||
ViewSpy.prototype._log = function _log(lifecycleName, context) { | ||
if (!this.value && lifecycleName === 'created') { | ||
this.logger.info(lifecycleName, this.view); | ||
} else if (this.value && this.value.indexOf(lifecycleName) !== -1) { | ||
this.logger.info(lifecycleName, this.view, context); | ||
import { getLogger } from 'aurelia-logging'; | ||
/** | ||
* Attribute to be placed on any HTML element in a view to emit the View instance | ||
* to the debug console, giving you insight into the live View instance, including | ||
* all child views, live bindings, behaviors and more. | ||
*/ | ||
var ViewSpy = /** @class */ (function () { | ||
/** | ||
* Creates a new instance of ViewSpy. | ||
*/ | ||
function ViewSpy() { | ||
this.logger = getLogger('view-spy'); | ||
} | ||
}; | ||
ViewSpy.prototype.created = function created(view) { | ||
this.view = view; | ||
this._log('created'); | ||
}; | ||
ViewSpy.prototype.bind = function bind(bindingContext) { | ||
this._log('bind', bindingContext); | ||
}; | ||
ViewSpy.prototype.attached = function attached() { | ||
this._log('attached'); | ||
}; | ||
ViewSpy.prototype.detached = function detached() { | ||
this._log('detached'); | ||
}; | ||
ViewSpy.prototype.unbind = function unbind() { | ||
this._log('unbind'); | ||
}; | ||
return ViewSpy; | ||
}()) || _class); | ||
ViewSpy.prototype._log = function (lifecycleName, context) { | ||
if (!this.value && lifecycleName === 'created') { | ||
this.logger.info(lifecycleName, this.view); | ||
} | ||
else if (this.value && this.value.indexOf(lifecycleName) !== -1) { | ||
this.logger.info(lifecycleName, this.view, context); | ||
} | ||
}; | ||
/** | ||
* Invoked when the target view is created. | ||
* @param view The target view. | ||
*/ | ||
ViewSpy.prototype.created = function (view) { | ||
this.view = view; | ||
this._log('created'); | ||
}; | ||
/** | ||
* Invoked when the target view is bound. | ||
* @param bindingContext The target view's binding context. | ||
*/ | ||
ViewSpy.prototype.bind = function (bindingContext) { | ||
this._log('bind', bindingContext); | ||
}; | ||
/** | ||
* Invoked when the target element is attached to the DOM. | ||
*/ | ||
ViewSpy.prototype.attached = function () { | ||
this._log('attached'); | ||
}; | ||
/** | ||
* Invoked when the target element is detached from the DOM. | ||
*/ | ||
ViewSpy.prototype.detached = function () { | ||
this._log('detached'); | ||
}; | ||
/** | ||
* Invoked when the target element is unbound. | ||
*/ | ||
ViewSpy.prototype.unbind = function () { | ||
this._log('unbind'); | ||
}; | ||
ViewSpy = __decorate([ | ||
customAttribute('view-spy') | ||
], ViewSpy); | ||
return ViewSpy; | ||
}()); | ||
export { ViewSpy }; |
@@ -1,43 +0,45 @@ | ||
var __assign = (this && this.__assign) || Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
/** | ||
* Generic function to wait for something to happen. Uses polling | ||
* @param getter: a getter function that returns anything else than `null` or an | ||
* empty array or an empty jQuery object when the | ||
* condition is met | ||
* @param options: lookup options, defaults to | ||
* `{present: true, interval: 50, timeout: 5000}` | ||
*/ | ||
export function waitFor(getter, options) { | ||
var timedOut = false; | ||
options = Object.assign({ | ||
present: true, | ||
interval: 50, | ||
timeout: 5000 | ||
}, options); | ||
function wait() { | ||
var element = getter(); | ||
var found = element !== null && (!(element instanceof NodeList) && !element.jquery || element.length > 0); | ||
if (!options.present ^ found || timedOut) { | ||
return Promise.resolve(element); | ||
if (options === void 0) { options = { present: true, interval: 50, timeout: 5000 }; } | ||
// prevents infinite recursion if the request times out | ||
var timedOut = false; | ||
options = __assign({ present: true, interval: 50, timeout: 5000 }, options); | ||
function wait() { | ||
var element = getter(); | ||
// boolean is needed here, hence the length > 0 | ||
var found = element !== null && (!(element instanceof NodeList) && | ||
!element.jquery || element.length > 0); | ||
if (!options.present === !found || timedOut) { | ||
return Promise.resolve(element); | ||
} | ||
return new Promise(function (rs) { return setTimeout(rs, options.interval); }).then(wait); | ||
} | ||
return new Promise(function (rs) { | ||
return setTimeout(rs, options.interval); | ||
}).then(wait); | ||
} | ||
return Promise.race([new Promise(function (rs, rj) { | ||
return setTimeout(function () { | ||
timedOut = true; | ||
rj(options.present ? 'Element not found' : 'Element not removed'); | ||
}, options.timeout); | ||
}), wait()]); | ||
return Promise.race([ | ||
new Promise(function (_, rj) { return setTimeout(function () { | ||
timedOut = true; | ||
rj(options.present ? 'Element not found' : 'Element not removed'); | ||
}, options.timeout); }), | ||
wait() | ||
]); | ||
} | ||
export function waitForDocumentElement(selector, options) { | ||
return waitFor(function () { | ||
return document.querySelector(selector); | ||
}, options); | ||
return waitFor(function () { return document.querySelector(selector); }, options); | ||
} | ||
export function waitForDocumentElements(selector, options) { | ||
return waitFor(function () { | ||
return document.querySelectorAll(selector); | ||
}, options); | ||
} | ||
return waitFor(function () { return document.querySelectorAll(selector); }, options); | ||
} |
@@ -1,44 +0,39 @@ | ||
'use strict'; | ||
System.register(['./compile-spy', './view-spy', './component-tester', './wait'], function (_export, _context) { | ||
"use strict"; | ||
var CompileSpy, ViewSpy, StageComponent, ComponentTester, waitFor, waitForDocumentElement, waitForDocumentElements; | ||
function configure(config) { | ||
config.globalResources('./compile-spy', './view-spy'); | ||
} | ||
return { | ||
setters: [function (_compileSpy) { | ||
CompileSpy = _compileSpy.CompileSpy; | ||
}, function (_viewSpy) { | ||
ViewSpy = _viewSpy.ViewSpy; | ||
}, function (_componentTester) { | ||
StageComponent = _componentTester.StageComponent; | ||
ComponentTester = _componentTester.ComponentTester; | ||
}, function (_wait) { | ||
waitFor = _wait.waitFor; | ||
waitForDocumentElement = _wait.waitForDocumentElement; | ||
waitForDocumentElements = _wait.waitForDocumentElements; | ||
}], | ||
execute: function () { | ||
_export('CompileSpy', CompileSpy); | ||
_export('ViewSpy', ViewSpy); | ||
_export('StageComponent', StageComponent); | ||
_export('ComponentTester', ComponentTester); | ||
_export('configure', configure); | ||
_export('waitFor', waitFor); | ||
_export('waitForDocumentElement', waitForDocumentElement); | ||
_export('waitForDocumentElements', waitForDocumentElements); | ||
System.register(["./compile-spy", "./view-spy", "./component-tester", "./wait"], function (exports_1, context_1) { | ||
"use strict"; | ||
var __moduleName = context_1 && context_1.id; | ||
function configure(config) { | ||
config.globalResources([ | ||
'./compile-spy', | ||
'./view-spy' | ||
]); | ||
} | ||
}; | ||
}); | ||
exports_1("configure", configure); | ||
var exportedNames_1 = { | ||
"configure": true | ||
}; | ||
function exportStar_1(m) { | ||
var exports = {}; | ||
for (var n in m) { | ||
if (n !== "default" && !exportedNames_1.hasOwnProperty(n)) exports[n] = m[n]; | ||
} | ||
exports_1(exports); | ||
} | ||
return { | ||
setters: [ | ||
function (compile_spy_1_1) { | ||
exportStar_1(compile_spy_1_1); | ||
}, | ||
function (view_spy_1_1) { | ||
exportStar_1(view_spy_1_1); | ||
}, | ||
function (component_tester_1_1) { | ||
exportStar_1(component_tester_1_1); | ||
}, | ||
function (wait_1_1) { | ||
exportStar_1(wait_1_1); | ||
} | ||
], | ||
execute: function () { | ||
} | ||
}; | ||
}); |
@@ -1,31 +0,45 @@ | ||
'use strict'; | ||
System.register(['aurelia-templating', 'aurelia-dependency-injection', 'aurelia-logging', 'aurelia-pal'], function (_export, _context) { | ||
"use strict"; | ||
var customAttribute, TargetInstruction, inject, LogManager, DOM, _dec, _dec2, _class, CompileSpy; | ||
return { | ||
setters: [function (_aureliaTemplating) { | ||
customAttribute = _aureliaTemplating.customAttribute; | ||
TargetInstruction = _aureliaTemplating.TargetInstruction; | ||
}, function (_aureliaDependencyInjection) { | ||
inject = _aureliaDependencyInjection.inject; | ||
}, function (_aureliaLogging) { | ||
LogManager = _aureliaLogging; | ||
}, function (_aureliaPal) { | ||
DOM = _aureliaPal.DOM; | ||
}], | ||
execute: function () { | ||
_export('CompileSpy', CompileSpy = (_dec = customAttribute('compile-spy'), _dec2 = inject(DOM.Element, TargetInstruction), _dec(_class = _dec2(_class = function CompileSpy(element, instruction) { | ||
LogManager.getLogger('compile-spy').info(element, instruction); | ||
}) || _class) || _class)); | ||
_export('CompileSpy', CompileSpy); | ||
} | ||
}; | ||
}); | ||
System.register(["aurelia-templating", "aurelia-dependency-injection", "aurelia-logging", "aurelia-pal"], function (exports_1, context_1) { | ||
"use strict"; | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
var __moduleName = context_1 && context_1.id; | ||
var aurelia_templating_1, aurelia_dependency_injection_1, aurelia_logging_1, aurelia_pal_1, CompileSpy; | ||
return { | ||
setters: [ | ||
function (aurelia_templating_1_1) { | ||
aurelia_templating_1 = aurelia_templating_1_1; | ||
}, | ||
function (aurelia_dependency_injection_1_1) { | ||
aurelia_dependency_injection_1 = aurelia_dependency_injection_1_1; | ||
}, | ||
function (aurelia_logging_1_1) { | ||
aurelia_logging_1 = aurelia_logging_1_1; | ||
}, | ||
function (aurelia_pal_1_1) { | ||
aurelia_pal_1 = aurelia_pal_1_1; | ||
} | ||
], | ||
execute: function () { | ||
CompileSpy = /** @class */ (function () { | ||
/** | ||
* Creates and instanse of CompileSpy. | ||
* @param element target element on where attribute is placed on. | ||
* @param instruction instructions for how the target element should be enhanced. | ||
*/ | ||
function CompileSpy(element, instruction) { | ||
aurelia_logging_1.getLogger('compile-spy').info(element.toString(), instruction); | ||
} | ||
CompileSpy = __decorate([ | ||
aurelia_templating_1.customAttribute('compile-spy'), | ||
aurelia_dependency_injection_1.inject(aurelia_pal_1.DOM.Element, aurelia_templating_1.TargetInstruction) | ||
], CompileSpy); | ||
return CompileSpy; | ||
}()); | ||
exports_1("CompileSpy", CompileSpy); | ||
} | ||
}; | ||
}); |
@@ -1,184 +0,129 @@ | ||
'use strict'; | ||
System.register(['aurelia-templating', 'aurelia-framework', './wait'], function (_export, _context) { | ||
"use strict"; | ||
var View, Aurelia, waitFor, StageComponent, ComponentTester; | ||
return { | ||
setters: [function (_aureliaTemplating) { | ||
View = _aureliaTemplating.View; | ||
}, function (_aureliaFramework) { | ||
Aurelia = _aureliaFramework.Aurelia; | ||
}, function (_wait) { | ||
waitFor = _wait.waitFor; | ||
}], | ||
execute: function () { | ||
_export('StageComponent', StageComponent = function () { | ||
function StageComponent() { | ||
System.register(["aurelia-templating", "./wait"], function (exports_1, context_1) { | ||
"use strict"; | ||
var __moduleName = context_1 && context_1.id; | ||
var aurelia_templating_1, wait_1, StageComponent, ComponentTester; | ||
return { | ||
setters: [ | ||
function (aurelia_templating_1_1) { | ||
aurelia_templating_1 = aurelia_templating_1_1; | ||
}, | ||
function (wait_1_1) { | ||
wait_1 = wait_1_1; | ||
} | ||
], | ||
execute: function () { | ||
StageComponent = /** @class */ (function () { | ||
function StageComponent() { | ||
} | ||
StageComponent.withResources = function (resources) { | ||
if (resources === void 0) { resources = []; } | ||
return new ComponentTester().withResources(resources); | ||
}; | ||
return StageComponent; | ||
}()); | ||
exports_1("StageComponent", StageComponent); | ||
ComponentTester = /** @class */ (function () { | ||
function ComponentTester() { | ||
this.resources = []; | ||
} | ||
ComponentTester.prototype.configure = function (aurelia) { | ||
return aurelia.use.standardConfiguration(); | ||
}; | ||
ComponentTester.prototype.bootstrap = function (configure) { | ||
this.configure = configure; | ||
}; | ||
ComponentTester.prototype.withResources = function (resources) { | ||
this.resources = resources; | ||
return this; | ||
}; | ||
ComponentTester.prototype.inView = function (html) { | ||
this.html = html; | ||
return this; | ||
}; | ||
ComponentTester.prototype.boundTo = function (bindingContext) { | ||
this.bindingContext = bindingContext; | ||
return this; | ||
}; | ||
ComponentTester.prototype.manuallyHandleLifecycle = function () { | ||
this._prepareLifecycle(); | ||
return this; | ||
}; | ||
ComponentTester.prototype.create = function (bootstrap) { | ||
var _this = this; | ||
return bootstrap(function (aurelia) { | ||
return Promise.resolve(_this.configure(aurelia)).then(function () { | ||
if (_this.resources) { | ||
aurelia.use.globalResources(_this.resources); | ||
} | ||
return aurelia.start().then(function () { | ||
_this.host = document.createElement('div'); | ||
_this.host.innerHTML = _this.html; | ||
document.body.appendChild(_this.host); | ||
return aurelia.enhance(_this.bindingContext, _this.host).then(function () { | ||
_this.rootView = aurelia.root; | ||
_this.element = _this.host.firstElementChild; | ||
if (aurelia.root.controllers.length) { | ||
_this.viewModel = aurelia.root.controllers[0].viewModel; | ||
} | ||
return new Promise(function (resolve) { return setTimeout(function () { return resolve(); }, 0); }); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}; | ||
ComponentTester.prototype.dispose = function () { | ||
if (this.host === undefined || this.rootView === undefined) { | ||
throw new Error('Cannot call ComponentTester.dispose() before ComponentTester.create()'); | ||
} | ||
this.rootView.detached(); | ||
this.rootView.unbind(); | ||
return this.host.parentNode.removeChild(this.host); | ||
}; | ||
ComponentTester.prototype._prepareLifecycle = function () { | ||
var _this = this; | ||
// bind | ||
var bindPrototype = aurelia_templating_1.View.prototype.bind; | ||
// tslint:disable-next-line:no-empty | ||
aurelia_templating_1.View.prototype.bind = function () { }; | ||
this.bind = function (bindingContext) { return new Promise(function (resolve) { | ||
aurelia_templating_1.View.prototype.bind = bindPrototype; | ||
if (bindingContext !== undefined) { | ||
_this.bindingContext = bindingContext; | ||
} | ||
_this.rootView.bind(_this.bindingContext); | ||
setTimeout(function () { return resolve(); }, 0); | ||
}); }; | ||
// attached | ||
var attachedPrototype = aurelia_templating_1.View.prototype.attached; | ||
// tslint:disable-next-line:no-empty | ||
aurelia_templating_1.View.prototype.attached = function () { }; | ||
this.attached = function () { return new Promise(function (resolve) { | ||
aurelia_templating_1.View.prototype.attached = attachedPrototype; | ||
_this.rootView.attached(); | ||
setTimeout(function () { return resolve(); }, 0); | ||
}); }; | ||
// detached | ||
this.detached = function () { return new Promise(function (resolve) { | ||
_this.rootView.detached(); | ||
setTimeout(function () { return resolve(); }, 0); | ||
}); }; | ||
// unbind | ||
this.unbind = function () { return new Promise(function (resolve) { | ||
_this.rootView.unbind(); | ||
setTimeout(function () { return resolve(); }, 0); | ||
}); }; | ||
}; | ||
ComponentTester.prototype.waitForElement = function (selector, options) { | ||
var _this = this; | ||
return wait_1.waitFor(function () { return _this.element.querySelector(selector); }, options); | ||
}; | ||
ComponentTester.prototype.waitForElements = function (selector, options) { | ||
var _this = this; | ||
return wait_1.waitFor(function () { return _this.element.querySelectorAll(selector); }, options); | ||
}; | ||
return ComponentTester; | ||
}()); | ||
exports_1("ComponentTester", ComponentTester); | ||
} | ||
StageComponent.withResources = function withResources(resources) { | ||
return new ComponentTester().withResources(resources); | ||
}; | ||
return StageComponent; | ||
}()); | ||
_export('StageComponent', StageComponent); | ||
_export('ComponentTester', ComponentTester = function () { | ||
function ComponentTester() { | ||
this.configure = function (aurelia) { | ||
return aurelia.use.standardConfiguration(); | ||
}; | ||
this._resources = []; | ||
} | ||
ComponentTester.prototype.bootstrap = function bootstrap(configure) { | ||
this.configure = configure; | ||
}; | ||
ComponentTester.prototype.withResources = function withResources(resources) { | ||
this._resources = resources; | ||
return this; | ||
}; | ||
ComponentTester.prototype.inView = function inView(html) { | ||
this._html = html; | ||
return this; | ||
}; | ||
ComponentTester.prototype.boundTo = function boundTo(bindingContext) { | ||
this._bindingContext = bindingContext; | ||
return this; | ||
}; | ||
ComponentTester.prototype.manuallyHandleLifecycle = function manuallyHandleLifecycle() { | ||
this._prepareLifecycle(); | ||
return this; | ||
}; | ||
ComponentTester.prototype.create = function create(bootstrap) { | ||
var _this = this; | ||
return bootstrap(function (aurelia) { | ||
return Promise.resolve(_this.configure(aurelia)).then(function () { | ||
if (_this._resources) { | ||
aurelia.use.globalResources(_this._resources); | ||
} | ||
return aurelia.start().then(function (a) { | ||
_this.host = document.createElement('div'); | ||
_this.host.innerHTML = _this._html; | ||
document.body.appendChild(_this.host); | ||
return aurelia.enhance(_this._bindingContext, _this.host).then(function () { | ||
_this._rootView = aurelia.root; | ||
_this.element = _this.host.firstElementChild; | ||
if (aurelia.root.controllers.length) { | ||
_this.viewModel = aurelia.root.controllers[0].viewModel; | ||
} | ||
return new Promise(function (resolve) { | ||
return setTimeout(function () { | ||
return resolve(); | ||
}, 0); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}; | ||
ComponentTester.prototype.dispose = function dispose() { | ||
if (this.host === undefined || this._rootView === undefined) { | ||
throw new Error('Cannot call ComponentTester.dispose() before ComponentTester.create()'); | ||
} | ||
this._rootView.detached(); | ||
this._rootView.unbind(); | ||
return this.host.parentNode.removeChild(this.host); | ||
}; | ||
ComponentTester.prototype._prepareLifecycle = function _prepareLifecycle() { | ||
var _this2 = this; | ||
var bindPrototype = View.prototype.bind; | ||
View.prototype.bind = function () {}; | ||
this.bind = function (bindingContext) { | ||
return new Promise(function (resolve) { | ||
View.prototype.bind = bindPrototype; | ||
if (bindingContext !== undefined) { | ||
_this2._bindingContext = bindingContext; | ||
} | ||
_this2._rootView.bind(_this2._bindingContext); | ||
setTimeout(function () { | ||
return resolve(); | ||
}, 0); | ||
}); | ||
}; | ||
var attachedPrototype = View.prototype.attached; | ||
View.prototype.attached = function () {}; | ||
this.attached = function () { | ||
return new Promise(function (resolve) { | ||
View.prototype.attached = attachedPrototype; | ||
_this2._rootView.attached(); | ||
setTimeout(function () { | ||
return resolve(); | ||
}, 0); | ||
}); | ||
}; | ||
this.detached = function () { | ||
return new Promise(function (resolve) { | ||
_this2._rootView.detached(); | ||
setTimeout(function () { | ||
return resolve(); | ||
}, 0); | ||
}); | ||
}; | ||
this.unbind = function () { | ||
return new Promise(function (resolve) { | ||
_this2._rootView.unbind(); | ||
setTimeout(function () { | ||
return resolve(); | ||
}, 0); | ||
}); | ||
}; | ||
}; | ||
ComponentTester.prototype.waitForElement = function waitForElement(selector, options) { | ||
var _this3 = this; | ||
return waitFor(function () { | ||
return _this3.element.querySelector(selector); | ||
}, options); | ||
}; | ||
ComponentTester.prototype.waitForElements = function waitForElements(selector, options) { | ||
var _this4 = this; | ||
return waitFor(function () { | ||
return _this4.element.querySelectorAll(selector); | ||
}, options); | ||
}; | ||
return ComponentTester; | ||
}()); | ||
_export('ComponentTester', ComponentTester); | ||
} | ||
}; | ||
}); | ||
}; | ||
}); |
@@ -1,59 +0,77 @@ | ||
'use strict'; | ||
System.register(['aurelia-templating', 'aurelia-logging'], function (_export, _context) { | ||
"use strict"; | ||
var customAttribute, LogManager, _dec, _class, ViewSpy; | ||
return { | ||
setters: [function (_aureliaTemplating) { | ||
customAttribute = _aureliaTemplating.customAttribute; | ||
}, function (_aureliaLogging) { | ||
LogManager = _aureliaLogging; | ||
}], | ||
execute: function () { | ||
_export('ViewSpy', ViewSpy = (_dec = customAttribute('view-spy'), _dec(_class = function () { | ||
function ViewSpy() { | ||
this.logger = LogManager.getLogger('view-spy'); | ||
System.register(["aurelia-templating", "aurelia-logging"], function (exports_1, context_1) { | ||
"use strict"; | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
var __moduleName = context_1 && context_1.id; | ||
var aurelia_templating_1, aurelia_logging_1, ViewSpy; | ||
return { | ||
setters: [ | ||
function (aurelia_templating_1_1) { | ||
aurelia_templating_1 = aurelia_templating_1_1; | ||
}, | ||
function (aurelia_logging_1_1) { | ||
aurelia_logging_1 = aurelia_logging_1_1; | ||
} | ||
], | ||
execute: function () { | ||
ViewSpy = /** @class */ (function () { | ||
/** | ||
* Creates a new instance of ViewSpy. | ||
*/ | ||
function ViewSpy() { | ||
this.logger = aurelia_logging_1.getLogger('view-spy'); | ||
} | ||
ViewSpy.prototype._log = function (lifecycleName, context) { | ||
if (!this.value && lifecycleName === 'created') { | ||
this.logger.info(lifecycleName, this.view); | ||
} | ||
else if (this.value && this.value.indexOf(lifecycleName) !== -1) { | ||
this.logger.info(lifecycleName, this.view, context); | ||
} | ||
}; | ||
/** | ||
* Invoked when the target view is created. | ||
* @param view The target view. | ||
*/ | ||
ViewSpy.prototype.created = function (view) { | ||
this.view = view; | ||
this._log('created'); | ||
}; | ||
/** | ||
* Invoked when the target view is bound. | ||
* @param bindingContext The target view's binding context. | ||
*/ | ||
ViewSpy.prototype.bind = function (bindingContext) { | ||
this._log('bind', bindingContext); | ||
}; | ||
/** | ||
* Invoked when the target element is attached to the DOM. | ||
*/ | ||
ViewSpy.prototype.attached = function () { | ||
this._log('attached'); | ||
}; | ||
/** | ||
* Invoked when the target element is detached from the DOM. | ||
*/ | ||
ViewSpy.prototype.detached = function () { | ||
this._log('detached'); | ||
}; | ||
/** | ||
* Invoked when the target element is unbound. | ||
*/ | ||
ViewSpy.prototype.unbind = function () { | ||
this._log('unbind'); | ||
}; | ||
ViewSpy = __decorate([ | ||
aurelia_templating_1.customAttribute('view-spy') | ||
], ViewSpy); | ||
return ViewSpy; | ||
}()); | ||
exports_1("ViewSpy", ViewSpy); | ||
} | ||
ViewSpy.prototype._log = function _log(lifecycleName, context) { | ||
if (!this.value && lifecycleName === 'created') { | ||
this.logger.info(lifecycleName, this.view); | ||
} else if (this.value && this.value.indexOf(lifecycleName) !== -1) { | ||
this.logger.info(lifecycleName, this.view, context); | ||
} | ||
}; | ||
ViewSpy.prototype.created = function created(view) { | ||
this.view = view; | ||
this._log('created'); | ||
}; | ||
ViewSpy.prototype.bind = function bind(bindingContext) { | ||
this._log('bind', bindingContext); | ||
}; | ||
ViewSpy.prototype.attached = function attached() { | ||
this._log('attached'); | ||
}; | ||
ViewSpy.prototype.detached = function detached() { | ||
this._log('detached'); | ||
}; | ||
ViewSpy.prototype.unbind = function unbind() { | ||
this._log('unbind'); | ||
}; | ||
return ViewSpy; | ||
}()) || _class)); | ||
_export('ViewSpy', ViewSpy); | ||
} | ||
}; | ||
}); | ||
}; | ||
}); |
@@ -1,59 +0,57 @@ | ||
'use strict'; | ||
System.register([], function (_export, _context) { | ||
"use strict"; | ||
function waitFor(getter, options) { | ||
var timedOut = false; | ||
options = Object.assign({ | ||
present: true, | ||
interval: 50, | ||
timeout: 5000 | ||
}, options); | ||
function wait() { | ||
var element = getter(); | ||
var found = element !== null && (!(element instanceof NodeList) && !element.jquery || element.length > 0); | ||
if (!options.present ^ found || timedOut) { | ||
return Promise.resolve(element); | ||
} | ||
return new Promise(function (rs) { | ||
return setTimeout(rs, options.interval); | ||
}).then(wait); | ||
System.register([], function (exports_1, context_1) { | ||
"use strict"; | ||
var __assign = (this && this.__assign) || Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
var __moduleName = context_1 && context_1.id; | ||
/** | ||
* Generic function to wait for something to happen. Uses polling | ||
* @param getter: a getter function that returns anything else than `null` or an | ||
* empty array or an empty jQuery object when the | ||
* condition is met | ||
* @param options: lookup options, defaults to | ||
* `{present: true, interval: 50, timeout: 5000}` | ||
*/ | ||
function waitFor(getter, options) { | ||
if (options === void 0) { options = { present: true, interval: 50, timeout: 5000 }; } | ||
// prevents infinite recursion if the request times out | ||
var timedOut = false; | ||
options = __assign({ present: true, interval: 50, timeout: 5000 }, options); | ||
function wait() { | ||
var element = getter(); | ||
// boolean is needed here, hence the length > 0 | ||
var found = element !== null && (!(element instanceof NodeList) && | ||
!element.jquery || element.length > 0); | ||
if (!options.present === !found || timedOut) { | ||
return Promise.resolve(element); | ||
} | ||
return new Promise(function (rs) { return setTimeout(rs, options.interval); }).then(wait); | ||
} | ||
return Promise.race([ | ||
new Promise(function (_, rj) { return setTimeout(function () { | ||
timedOut = true; | ||
rj(options.present ? 'Element not found' : 'Element not removed'); | ||
}, options.timeout); }), | ||
wait() | ||
]); | ||
} | ||
return Promise.race([new Promise(function (rs, rj) { | ||
return setTimeout(function () { | ||
timedOut = true; | ||
rj(options.present ? 'Element not found' : 'Element not removed'); | ||
}, options.timeout); | ||
}), wait()]); | ||
} | ||
_export('waitFor', waitFor); | ||
function waitForDocumentElement(selector, options) { | ||
return waitFor(function () { | ||
return document.querySelector(selector); | ||
}, options); | ||
} | ||
_export('waitForDocumentElement', waitForDocumentElement); | ||
function waitForDocumentElements(selector, options) { | ||
return waitFor(function () { | ||
return document.querySelectorAll(selector); | ||
}, options); | ||
} | ||
_export('waitForDocumentElements', waitForDocumentElements); | ||
return { | ||
setters: [], | ||
execute: function () {} | ||
}; | ||
}); | ||
exports_1("waitFor", waitFor); | ||
function waitForDocumentElement(selector, options) { | ||
return waitFor(function () { return document.querySelector(selector); }, options); | ||
} | ||
exports_1("waitForDocumentElement", waitForDocumentElement); | ||
function waitForDocumentElements(selector, options) { | ||
return waitFor(function () { return document.querySelectorAll(selector); }, options); | ||
} | ||
exports_1("waitForDocumentElements", waitForDocumentElements); | ||
return { | ||
setters: [], | ||
execute: function () { | ||
} | ||
}; | ||
}); |
@@ -1,1 +0,1 @@ | ||
{"name":"aurelia-testing","children":[{"id":17,"name":"CompileSpy","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Attribute to be placed on any element to have it emit the View Compiler's\nTargetInstruction into the debug console, giving you insight into all the\nparsed bindings, behaviors and event handers for the targeted element."},"children":[{"id":18,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"comment":{"shortText":"Creates and instanse of CompileSpy."},"signatures":[{"id":19,"name":"new CompileSpy","kind":16384,"kindString":"Constructor signature","flags":{},"comment":{"shortText":"Creates and instanse of CompileSpy."},"parameters":[{"id":20,"name":"element","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"shortText":"target element on where attribute is placed on."},"type":{"type":"instrinct","name":"any"}},{"id":21,"name":"instruction","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"shortText":"instructions for how the target element should be enhanced.\n"},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"reference","name":"CompileSpy","id":17}}]}],"groups":[{"title":"Constructors","kind":512,"children":[18]}]},{"id":26,"name":"ComponentTester","kind":128,"kindString":"Class","flags":{"isExported":true},"children":[{"id":31,"name":"attached","kind":1024,"kindString":"Property","flags":{"isExported":true},"type":{"type":"reflection","declaration":{"id":32,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":33,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"instrinct","name":"void"}}]}}},{"id":27,"name":"bind","kind":1024,"kindString":"Property","flags":{"isExported":true},"type":{"type":"reflection","declaration":{"id":28,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":29,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":30,"name":"bindingContext","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"}}]}}},{"id":39,"name":"configure","kind":1024,"kindString":"Property","flags":{"isExported":true},"type":{"type":"instrinct","name":"any"}},{"id":37,"name":"element","kind":1024,"kindString":"Property","flags":{"isExported":true},"type":{"type":"reference","name":"Element"}},{"id":34,"name":"unbind","kind":1024,"kindString":"Property","flags":{"isExported":true},"type":{"type":"reflection","declaration":{"id":35,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":36,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"instrinct","name":"void"}}]}}},{"id":38,"name":"viewModel","kind":1024,"kindString":"Property","flags":{"isExported":true},"type":{"type":"instrinct","name":"any"}},{"id":40,"name":"bootstrap","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":41,"name":"bootstrap","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":42,"name":"configure","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reflection","declaration":{"id":43,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":44,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":45,"name":"aurelia","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Aurelia"}}],"type":{"type":"instrinct","name":"void"}}]}}}],"type":{"type":"instrinct","name":"any"}}]},{"id":52,"name":"boundTo","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":53,"name":"boundTo","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":54,"name":"bindingContext","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"reference","name":"ComponentTester","id":26}}]},{"id":57,"name":"create","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":58,"name":"create","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":59,"name":"bootstrap","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reflection","declaration":{"id":60,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":61,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":62,"name":"configure","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reflection","declaration":{"id":63,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":64,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":65,"name":"aurelia","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Aurelia"}}],"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"instrinct","name":"void"}]}}]}}}],"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"instrinct","name":"void"}]}}]}}}],"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"instrinct","name":"void"}]}}]},{"id":66,"name":"dispose","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":67,"name":"dispose","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"instrinct","name":"any"}}]},{"id":49,"name":"inView","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":50,"name":"inView","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":51,"name":"html","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"reference","name":"ComponentTester","id":26}}]},{"id":55,"name":"manuallyHandleLifecycle","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":56,"name":"manuallyHandleLifecycle","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"reference","name":"ComponentTester","id":26}}]},{"id":68,"name":"waitForElement","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":69,"name":"waitForElement","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":70,"name":"selector","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}},{"id":71,"name":"options","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"reference","name":"Element"}]}}]},{"id":72,"name":"waitForElements","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":73,"name":"waitForElements","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":74,"name":"selector","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}},{"id":75,"name":"options","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"reference","name":"Element"}]}}]},{"id":46,"name":"withResources","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":47,"name":"withResources","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":48,"name":"resources","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"union","types":[{"type":"instrinct","name":"string"},{"type":"instrinct","isArray":true,"name":"string"}]}}],"type":{"type":"reference","name":"ComponentTester","id":26}}]}],"groups":[{"title":"Properties","kind":1024,"children":[31,27,39,37,34,38]},{"title":"Methods","kind":2048,"children":[40,52,57,66,49,55,68,72,46]}]},{"id":22,"name":"StageComponent","kind":128,"kindString":"Class","flags":{"isExported":true},"children":[{"id":23,"name":"withResources","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExported":true},"signatures":[{"id":24,"name":"withResources","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":25,"name":"resources","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"union","types":[{"type":"instrinct","name":"string"},{"type":"instrinct","isArray":true,"name":"string"}]}}],"type":{"type":"reference","name":"ComponentTester","id":26}}]}],"groups":[{"title":"Methods","kind":2048,"children":[23]}]},{"id":2,"name":"ViewSpy","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Attribute to be placed on any HTML element in a view to emit the View instance\nto the debug console, giving you insight into the live View instance, including\nall child views, live bindings, behaviors and more."},"children":[{"id":3,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"comment":{"shortText":"Creates a new instance of ViewSpy."},"signatures":[{"id":4,"name":"new ViewSpy","kind":16384,"kindString":"Constructor signature","flags":{},"comment":{"shortText":"Creates a new instance of ViewSpy."},"type":{"type":"reference","name":"ViewSpy","id":2}}]},{"id":11,"name":"attached","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":12,"name":"attached","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Invoked when the target element is attached to the DOM."},"type":{"type":"instrinct","name":"any"}}]},{"id":8,"name":"bind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":9,"name":"bind","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Invoked when the target view is bound."},"parameters":[{"id":10,"name":"bindingContext","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"The target view's binding context.\n"},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"any"}}]},{"id":5,"name":"created","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":6,"name":"created","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Invoked when the target view is created."},"parameters":[{"id":7,"name":"view","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"The target view.\n"},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"any"}}]},{"id":13,"name":"detached","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":14,"name":"detached","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Invoked when the target element is detached from the DOM."},"type":{"type":"instrinct","name":"any"}}]},{"id":15,"name":"unbind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":16,"name":"unbind","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Invoked when the target element is unbound."},"type":{"type":"instrinct","name":"any"}}]}],"groups":[{"title":"Constructors","kind":512,"children":[3]},{"title":"Methods","kind":2048,"children":[11,8,5,13,15]}]},{"id":76,"name":"waitFor","kind":64,"kindString":"Function","flags":{"isExported":true},"signatures":[{"id":77,"name":"waitFor","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Generic function to wait for something to happen. Uses polling"},"parameters":[{"id":78,"name":"getter","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reflection","declaration":{"id":79,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":80,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"instrinct","name":"any"}}]}}},{"id":81,"name":"options","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"instrinct","name":"any"}]}}]},{"id":82,"name":"waitForDocumentElement","kind":64,"kindString":"Function","flags":{"isExported":true},"signatures":[{"id":83,"name":"waitForDocumentElement","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":84,"name":"selector","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}},{"id":85,"name":"options","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"reference","name":"Element"}]}}]},{"id":86,"name":"waitForDocumentElements","kind":64,"kindString":"Function","flags":{"isExported":true},"signatures":[{"id":87,"name":"waitForDocumentElements","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":88,"name":"selector","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}},{"id":89,"name":"options","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"reference","name":"Element"}]}}]}],"groups":[{"title":"Classes","kind":128,"children":[17,26,22,2]},{"title":"Functions","kind":64,"children":[76,82,86]}]} | ||
{"name":"aurelia-testing","children":[{"name":"\"src/aurelia-testing\"","children":[{"id":203,"name":"configure","kind":64,"kindString":"Function","flags":{"isExported":true},"signatures":[{"id":204,"name":"configure","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":205,"name":"config","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"FrameworkConfiguration"}}],"type":{"type":"intrinsic","name":"void"}}],"sources":[{"fileName":"src/aurelia-testing.ts","line":7,"character":25}]}],"groups":[{"title":"Functions","kind":64,"children":[203]}]},{"name":"\"src/compile-spy\"","children":[{"id":2,"name":"CompileSpy","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Attribute to be placed on any element to have it emit the View Compiler's\nTargetInstruction into the debug console, giving you insight into all the\nparsed bindings, behaviors and event handers for the targeted element."},"decorators":[{"name":"customAttribute","type":{"type":"reference","name":"customAttribute"},"arguments":{"name":"'compile-spy'"}},{"name":"inject","type":{"type":"reference","name":"inject"},"arguments":{"rest":"DOM.Element","...":["TargetInstruction"]}}],"children":[{"id":3,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"comment":{"shortText":"Creates and instanse of CompileSpy."},"signatures":[{"id":4,"name":"new CompileSpy","kind":16384,"kindString":"Constructor signature","flags":{},"comment":{"shortText":"Creates and instanse of CompileSpy."},"parameters":[{"id":5,"name":"element","kind":32768,"kindString":"Parameter","flags":{},"comment":{"shortText":"target element on where attribute is placed on."},"type":{"type":"reference","name":"Element"}},{"id":6,"name":"instruction","kind":32768,"kindString":"Parameter","flags":{},"comment":{"shortText":"instructions for how the target element should be enhanced.\n"},"type":{"type":"reference","name":"TargetInstruction"}}],"type":{"type":"reference","name":"CompileSpy","id":2}}],"sources":[{"fileName":"src/compile-spy.ts","line":13,"character":25}]}],"groups":[{"title":"Constructors","kind":512,"children":[3]}],"sources":[{"fileName":"src/compile-spy.ts","line":13,"character":23}]}],"groups":[{"title":"Classes","kind":128,"children":[2]}]},{"name":"\"src/component-tester\"","children":[{"id":131,"name":"ComponentTester","kind":128,"kindString":"Class","flags":{"isExported":true},"typeParameter":[{"id":132,"name":"T","kind":131072,"kindString":"Type parameter","flags":{}}],"children":[{"id":137,"name":"attached","kind":1024,"kindString":"Property","flags":{"isExported":true,"isPublic":true},"sources":[{"fileName":"src/component-tester.ts","line":21,"character":17}],"type":{"type":"reflection","declaration":{"id":138,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":139,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"intrinsic","name":"void"}]}}],"sources":[{"fileName":"src/component-tester.ts","line":21,"character":18}]}}},{"id":133,"name":"bind","kind":1024,"kindString":"Property","flags":{"isExported":true,"isPublic":true},"sources":[{"fileName":"src/component-tester.ts","line":20,"character":13}],"type":{"type":"reflection","declaration":{"id":134,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":135,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":136,"name":"bindingContext","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"__type"}}],"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"intrinsic","name":"void"}]}}],"sources":[{"fileName":"src/component-tester.ts","line":20,"character":14}]}}},{"id":150,"name":"bindingContext","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"src/component-tester.ts","line":29,"character":24}],"type":{"type":"reference","name":"__type"}},{"id":140,"name":"detached","kind":1024,"kindString":"Property","flags":{"isExported":true,"isPublic":true},"sources":[{"fileName":"src/component-tester.ts","line":22,"character":17}],"type":{"type":"reflection","declaration":{"id":141,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":142,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"intrinsic","name":"void"}]}}],"sources":[{"fileName":"src/component-tester.ts","line":22,"character":18}]}}},{"id":146,"name":"element","kind":1024,"kindString":"Property","flags":{"isExported":true,"isPublic":true},"sources":[{"fileName":"src/component-tester.ts","line":24,"character":16}],"type":{"type":"reference","name":"Element"}},{"id":152,"name":"host","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"src/component-tester.ts","line":31,"character":14}],"type":{"type":"reference","name":"HTMLDivElement"}},{"id":148,"name":"html","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"src/component-tester.ts","line":27,"character":14}],"type":{"type":"intrinsic","name":"string"}},{"id":149,"name":"resources","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"src/component-tester.ts","line":28,"character":19}],"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"array","elementType":{"type":"intrinsic","name":"string"}}]},"defaultValue":" []"},{"id":151,"name":"rootView","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"src/component-tester.ts","line":30,"character":18}],"type":{"type":"reference","name":"View"}},{"id":143,"name":"unbind","kind":1024,"kindString":"Property","flags":{"isExported":true,"isPublic":true},"sources":[{"fileName":"src/component-tester.ts","line":23,"character":15}],"type":{"type":"reflection","declaration":{"id":144,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":145,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"intrinsic","name":"void"}]}}],"sources":[{"fileName":"src/component-tester.ts","line":23,"character":16}]}}},{"id":147,"name":"viewModel","kind":1024,"kindString":"Property","flags":{"isExported":true,"isPublic":true},"sources":[{"fileName":"src/component-tester.ts","line":25,"character":18}],"type":{"type":"typeParameter","name":"T"}},{"id":184,"name":"_prepareLifecycle","kind":2048,"kindString":"Method","flags":{"isPrivate":true,"isExported":true},"signatures":[{"id":185,"name":"_prepareLifecycle","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"intrinsic","name":"void"}}],"sources":[{"fileName":"src/component-tester.ts","line":102,"character":27}]},{"id":156,"name":"bootstrap","kind":2048,"kindString":"Method","flags":{"isExported":true,"isPublic":true},"signatures":[{"id":157,"name":"bootstrap","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":158,"name":"configure","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reflection","declaration":{"id":159,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":160,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":161,"name":"aurelia","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Aurelia"}}],"type":{"type":"reference","name":"FrameworkConfiguration"}}],"sources":[{"fileName":"src/component-tester.ts","line":37,"character":29}]}}}],"type":{"type":"intrinsic","name":"void"}}],"sources":[{"fileName":"src/component-tester.ts","line":37,"character":18}]},{"id":168,"name":"boundTo","kind":2048,"kindString":"Method","flags":{"isExported":true,"isPublic":true},"signatures":[{"id":169,"name":"boundTo","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":170,"name":"bindingContext","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"__type"}}],"type":{"type":"reference","name":"ComponentTester","id":131,"typeArguments":[{"type":"typeParameter","name":"T"}]}}],"sources":[{"fileName":"src/component-tester.ts","line":51,"character":16}]},{"id":153,"name":"configure","kind":2048,"kindString":"Method","flags":{"isExported":true,"isPublic":true},"signatures":[{"id":154,"name":"configure","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":155,"name":"aurelia","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Aurelia"}}],"type":{"type":"reference","name":"FrameworkConfiguration"}}],"sources":[{"fileName":"src/component-tester.ts","line":33,"character":18}]},{"id":173,"name":"create","kind":2048,"kindString":"Method","flags":{"isExported":true,"isPublic":true},"signatures":[{"id":174,"name":"create","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":175,"name":"bootstrap","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reflection","declaration":{"id":176,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":177,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":178,"name":"configure","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reflection","declaration":{"id":179,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":180,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":181,"name":"aurelia","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Aurelia"}}],"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"intrinsic","name":"void"}]}}],"sources":[{"fileName":"src/component-tester.ts","line":61,"character":38}]}}}],"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"intrinsic","name":"void"}]}}],"sources":[{"fileName":"src/component-tester.ts","line":61,"character":26}]}}}],"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"intrinsic","name":"void"}]}}],"sources":[{"fileName":"src/component-tester.ts","line":61,"character":15}]},{"id":182,"name":"dispose","kind":2048,"kindString":"Method","flags":{"isExported":true,"isPublic":true},"signatures":[{"id":183,"name":"dispose","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"reference","name":"Element"}}],"sources":[{"fileName":"src/component-tester.ts","line":89,"character":16}]},{"id":165,"name":"inView","kind":2048,"kindString":"Method","flags":{"isExported":true,"isPublic":true},"signatures":[{"id":166,"name":"inView","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":167,"name":"html","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","name":"ComponentTester","id":131,"typeArguments":[{"type":"typeParameter","name":"T"}]}}],"sources":[{"fileName":"src/component-tester.ts","line":46,"character":15}]},{"id":171,"name":"manuallyHandleLifecycle","kind":2048,"kindString":"Method","flags":{"isExported":true,"isPublic":true},"signatures":[{"id":172,"name":"manuallyHandleLifecycle","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"reference","name":"ComponentTester","id":131,"typeArguments":[{"type":"typeParameter","name":"T"}]}}],"sources":[{"fileName":"src/component-tester.ts","line":56,"character":32}]},{"id":186,"name":"waitForElement","kind":2048,"kindString":"Method","flags":{"isExported":true,"isPublic":true},"signatures":[{"id":187,"name":"waitForElement","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":188,"name":"selector","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":189,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"undefined"},{"type":"reflection","declaration":{"id":190,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"children":[{"id":192,"name":"interval","kind":32,"kindString":"Variable","flags":{"isOptional":true},"sources":[{"fileName":"src/component-tester.ts","line":141,"character":12}],"type":{"type":"union","types":[{"type":"intrinsic","name":"undefined"},{"type":"intrinsic","name":"number"}]}},{"id":191,"name":"present","kind":32,"kindString":"Variable","flags":{"isOptional":true},"sources":[{"fileName":"src/component-tester.ts","line":140,"character":11}],"type":{"type":"union","types":[{"type":"intrinsic","name":"undefined"},{"type":"intrinsic","name":"true"},{"type":"intrinsic","name":"false"}]}},{"id":193,"name":"timeout","kind":32,"kindString":"Variable","flags":{"isOptional":true},"sources":[{"fileName":"src/component-tester.ts","line":142,"character":11}],"type":{"type":"union","types":[{"type":"intrinsic","name":"undefined"},{"type":"intrinsic","name":"number"}]}}],"groups":[{"title":"Variables","kind":32,"children":[192,191,193]}]}}]}}],"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"reference","name":"Element"}]}}],"sources":[{"fileName":"src/component-tester.ts","line":139,"character":23}]},{"id":194,"name":"waitForElements","kind":2048,"kindString":"Method","flags":{"isExported":true,"isPublic":true},"signatures":[{"id":195,"name":"waitForElements","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":196,"name":"selector","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":197,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"undefined"},{"type":"reflection","declaration":{"id":198,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"children":[{"id":200,"name":"interval","kind":32,"kindString":"Variable","flags":{"isOptional":true},"sources":[{"fileName":"src/component-tester.ts","line":149,"character":12}],"type":{"type":"union","types":[{"type":"intrinsic","name":"undefined"},{"type":"intrinsic","name":"number"}]}},{"id":199,"name":"present","kind":32,"kindString":"Variable","flags":{"isOptional":true},"sources":[{"fileName":"src/component-tester.ts","line":148,"character":11}],"type":{"type":"union","types":[{"type":"intrinsic","name":"undefined"},{"type":"intrinsic","name":"true"},{"type":"intrinsic","name":"false"}]}},{"id":201,"name":"timeout","kind":32,"kindString":"Variable","flags":{"isOptional":true},"sources":[{"fileName":"src/component-tester.ts","line":150,"character":11}],"type":{"type":"union","types":[{"type":"intrinsic","name":"undefined"},{"type":"intrinsic","name":"number"}]}}],"groups":[{"title":"Variables","kind":32,"children":[200,199,201]}]}}]}}],"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"reference","name":"NodeListOf","typeArguments":[{"type":"reference","name":"Element"}]}]}}],"sources":[{"fileName":"src/component-tester.ts","line":147,"character":24}]},{"id":162,"name":"withResources","kind":2048,"kindString":"Method","flags":{"isExported":true,"isPublic":true},"signatures":[{"id":163,"name":"withResources","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":164,"name":"resources","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"array","elementType":{"type":"intrinsic","name":"string"}}]}}],"type":{"type":"reference","name":"ComponentTester","id":131,"typeArguments":[{"type":"typeParameter","name":"T"}]}}],"sources":[{"fileName":"src/component-tester.ts","line":41,"character":22}]}],"groups":[{"title":"Properties","kind":1024,"children":[137,133,150,140,146,152,148,149,151,143,147]},{"title":"Methods","kind":2048,"children":[184,156,168,153,173,182,165,171,186,194,162]}],"sources":[{"fileName":"src/component-tester.ts","line":19,"character":28}]},{"id":126,"name":"StageComponent","kind":128,"kindString":"Class","flags":{"isExported":true},"children":[{"id":127,"name":"withResources","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExported":true,"isPublic":true},"signatures":[{"id":128,"name":"withResources","kind":4096,"kindString":"Call signature","flags":{},"typeParameter":[{"id":129,"name":"T","kind":131072,"kindString":"Type parameter","flags":{}}],"parameters":[{"id":130,"name":"resources","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"array","elementType":{"type":"intrinsic","name":"string"}}]},"defaultValue":" []"}],"type":{"type":"reference","name":"ComponentTester","id":131,"typeArguments":[{"type":"typeParameter","name":"T"}]}}],"sources":[{"fileName":"src/component-tester.ts","line":14,"character":29}]}],"groups":[{"title":"Methods","kind":2048,"children":[127]}],"sources":[{"fileName":"src/component-tester.ts","line":13,"character":27}]},{"id":59,"name":"AureliaWithRoot","kind":256,"kindString":"Interface","flags":{},"children":[{"id":66,"name":"constructor","kind":512,"kindString":"Constructor","flags":{},"comment":{"shortText":"Creates an instance of Aurelia."},"signatures":[{"id":67,"name":"new AureliaWithRoot","kind":16384,"kindString":"Constructor signature","flags":{},"comment":{"shortText":"Creates an instance of Aurelia."},"parameters":[{"id":68,"name":"loader","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"shortText":"The loader for this Aurelia instance to use. If a loader is not specified, Aurelia will use the loader type specified by PLATFORM.Loader."},"type":{"type":"reference","name":"Loader"}},{"id":69,"name":"container","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"shortText":"The dependency injection container for this Aurelia instance to use. If a container is not specified, Aurelia will create an empty, global container."},"type":{"type":"reference","name":"Container"}},{"id":70,"name":"resources","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"shortText":"The resource registry for this Aurelia instance to use. If a resource registry is not specified, Aurelia will create an empty registry.\n"},"type":{"type":"reference","name":"ViewResources"}}],"type":{"type":"reference","name":"AureliaWithRoot","id":59},"inheritedFrom":{"type":"reference","name":"Aurelia.__constructor"}}],"sources":[{"fileName":"node_modules/aurelia-framework/dist/aurelia-framework.d.ts","line":54,"character":30}],"inheritedFrom":{"type":"reference","name":"Aurelia.__constructor"}},{"id":63,"name":"container","kind":1024,"kindString":"Property","flags":{},"comment":{"shortText":"The root DI container used by the application."},"sources":[{"fileName":"node_modules/aurelia-framework/dist/aurelia-framework.d.ts","line":44,"character":11}],"type":{"type":"reference","name":"Container"},"inheritedFrom":{"type":"reference","name":"Aurelia.container"}},{"id":61,"name":"host","kind":1024,"kindString":"Property","flags":{},"comment":{"shortText":"The DOM Element that Aurelia will attach to."},"sources":[{"fileName":"node_modules/aurelia-framework/dist/aurelia-framework.d.ts","line":33,"character":6}],"type":{"type":"reference","name":"Element"},"inheritedFrom":{"type":"reference","name":"Aurelia.host"}},{"id":62,"name":"loader","kind":1024,"kindString":"Property","flags":{},"comment":{"shortText":"/**\nThe loader used by the application."},"sources":[{"fileName":"node_modules/aurelia-framework/dist/aurelia-framework.d.ts","line":39,"character":8}],"type":{"type":"reference","name":"Loader"},"inheritedFrom":{"type":"reference","name":"Aurelia.loader"}},{"id":64,"name":"resources","kind":1024,"kindString":"Property","flags":{},"comment":{"shortText":"The global view resources used by the application."},"sources":[{"fileName":"node_modules/aurelia-framework/dist/aurelia-framework.d.ts","line":49,"character":11}],"type":{"type":"reference","name":"ViewResources"},"inheritedFrom":{"type":"reference","name":"Aurelia.resources"}},{"id":60,"name":"root","kind":1024,"kindString":"Property","flags":{},"sources":[{"fileName":"src/component-tester.ts","line":6,"character":6}],"type":{"type":"reference","name":"ViewWithControllers","id":81}},{"id":65,"name":"use","kind":1024,"kindString":"Property","flags":{},"comment":{"shortText":"The configuration used during application startup."},"sources":[{"fileName":"node_modules/aurelia-framework/dist/aurelia-framework.d.ts","line":54,"character":5}],"type":{"type":"reference","name":"FrameworkConfiguration"},"inheritedFrom":{"type":"reference","name":"Aurelia.use"}},{"id":73,"name":"enhance","kind":2048,"kindString":"Method","flags":{},"signatures":[{"id":74,"name":"enhance","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Enhances the host's existing elements with behaviors and bindings.","returns":"Returns a Promise for the current Aurelia instance.\n"},"parameters":[{"id":75,"name":"bindingContext","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"A binding context for the enhanced elements."},"type":{"type":"reference","name":"Object"}},{"id":76,"name":"applicationHost","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"The DOM object that Aurelia will enhance."},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"reference","name":"Element"}]}}],"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"reference","name":"Aurelia"}]},"inheritedFrom":{"type":"reference","name":"Aurelia.enhance"}}],"sources":[{"fileName":"node_modules/aurelia-framework/dist/aurelia-framework.d.ts","line":76,"character":9}],"inheritedFrom":{"type":"reference","name":"Aurelia.enhance"}},{"id":77,"name":"setRoot","kind":2048,"kindString":"Method","flags":{},"signatures":[{"id":78,"name":"setRoot","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Instantiates the root component and adds it to the DOM.","returns":"Returns a Promise of the current Aurelia instance.\n"},"parameters":[{"id":79,"name":"root","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"The root component to load upon bootstrap."},"type":{"type":"union","types":[{"type":"intrinsic","name":"undefined"},{"type":"intrinsic","name":"string"}]}},{"id":80,"name":"applicationHost","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"The DOM object that Aurelia will attach to."},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"reference","name":"Element"}]}}],"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"reference","name":"Aurelia"}]},"inheritedFrom":{"type":"reference","name":"Aurelia.setRoot"}}],"sources":[{"fileName":"node_modules/aurelia-framework/dist/aurelia-framework.d.ts","line":84,"character":9}],"inheritedFrom":{"type":"reference","name":"Aurelia.setRoot"}},{"id":71,"name":"start","kind":2048,"kindString":"Method","flags":{},"signatures":[{"id":72,"name":"start","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Loads plugins, then resources, and then starts the Aurelia instance.","returns":"Returns a Promise with the started Aurelia instance.\n"},"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"reference","name":"Aurelia"}]},"inheritedFrom":{"type":"reference","name":"Aurelia.start"}}],"sources":[{"fileName":"node_modules/aurelia-framework/dist/aurelia-framework.d.ts","line":68,"character":7}],"inheritedFrom":{"type":"reference","name":"Aurelia.start"}}],"groups":[{"title":"Constructors","kind":512,"children":[66]},{"title":"Properties","kind":1024,"children":[63,61,62,64,60,65]},{"title":"Methods","kind":2048,"children":[73,77,71]}],"sources":[{"fileName":"src/component-tester.ts","line":5,"character":25}],"extendedTypes":[{"type":"reference","name":"Aurelia"}]},{"id":81,"name":"ViewWithControllers","kind":256,"kindString":"Interface","flags":{},"children":[{"id":91,"name":"constructor","kind":512,"kindString":"Constructor","flags":{},"comment":{"shortText":"Creates a View instance."},"signatures":[{"id":92,"name":"new ViewWithControllers","kind":16384,"kindString":"Constructor signature","flags":{},"comment":{"shortText":"Creates a View instance."},"parameters":[{"id":93,"name":"container","kind":32768,"kindString":"Parameter","flags":{},"comment":{"shortText":"The container from which the view was created."},"type":{"type":"reference","name":"Container"}},{"id":94,"name":"viewFactory","kind":32768,"kindString":"Parameter","flags":{},"comment":{"shortText":"The factory that created this view."},"type":{"type":"reference","name":"ViewFactory"}},{"id":95,"name":"fragment","kind":32768,"kindString":"Parameter","flags":{},"comment":{"shortText":"The DOM fragement representing the view."},"type":{"type":"reference","name":"DocumentFragment"}},{"id":96,"name":"controllers","kind":32768,"kindString":"Parameter","flags":{},"comment":{"shortText":"The controllers inside this view."},"type":{"type":"array","elementType":{"type":"reference","name":"Controller"}}},{"id":97,"name":"bindings","kind":32768,"kindString":"Parameter","flags":{},"comment":{"shortText":"The bindings inside this view."},"type":{"type":"array","elementType":{"type":"reference","name":"Binding"}}},{"id":98,"name":"children","kind":32768,"kindString":"Parameter","flags":{},"comment":{"shortText":"The children of this view.\n"},"type":{"type":"array","elementType":{"type":"reference","name":"ViewNode"}}},{"id":99,"name":"slots","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Object"}}],"type":{"type":"reference","name":"ViewWithControllers","id":81},"inheritedFrom":{"type":"reference","name":"View.__constructor"}}],"sources":[{"fileName":"node_modules/aurelia-templating/dist/aurelia-templating.d.ts","line":1110,"character":25}],"inheritedFrom":{"type":"reference","name":"View.__constructor"}},{"id":88,"name":"bindingContext","kind":1024,"kindString":"Property","flags":{},"comment":{"shortText":"The primary binding context that this view is data-bound to."},"sources":[{"fileName":"node_modules/aurelia-templating/dist/aurelia-templating.d.ts","line":1100,"character":16}],"type":{"type":"reference","name":"Object"},"inheritedFrom":{"type":"reference","name":"View.bindingContext"}},{"id":85,"name":"container","kind":1024,"kindString":"Property","flags":{},"comment":{"shortText":"The Dependency Injection Container that was used to create this View instance."},"sources":[{"fileName":"node_modules/aurelia-templating/dist/aurelia-templating.d.ts","line":1085,"character":11}],"type":{"type":"reference","name":"Container"},"inheritedFrom":{"type":"reference","name":"View.container"}},{"id":90,"name":"controller","kind":1024,"kindString":"Property","flags":{},"comment":{"shortText":"The Controller instance that owns this View."},"sources":[{"fileName":"node_modules/aurelia-templating/dist/aurelia-templating.d.ts","line":1110,"character":12}],"type":{"type":"reference","name":"Controller"},"inheritedFrom":{"type":"reference","name":"View.controller"}},{"id":82,"name":"controllers","kind":1024,"kindString":"Property","flags":{},"sources":[{"fileName":"src/component-tester.ts","line":10,"character":13}],"type":{"type":"array","elementType":{"type":"reflection","declaration":{"id":83,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"children":[{"id":84,"name":"viewModel","kind":32,"kindString":"Variable","flags":{},"sources":[{"fileName":"src/component-tester.ts","line":10,"character":25}],"type":{"type":"intrinsic","name":"any"}}],"groups":[{"title":"Variables","kind":32,"children":[84]}],"sources":[{"fileName":"src/component-tester.ts","line":10,"character":14}]}}}},{"id":87,"name":"fragment","kind":1024,"kindString":"Property","flags":{},"comment":{"shortText":"Contains the DOM Nodes which represent this View. If the view was created via the \"enhance\" API, this will be an Element, otherwise it will be a DocumentFragment. If not created via \"enhance\" then the fragment will only contain nodes when the View is detached from the DOM."},"sources":[{"fileName":"node_modules/aurelia-templating/dist/aurelia-templating.d.ts","line":1095,"character":10}],"type":{"type":"union","types":[{"type":"reference","name":"DocumentFragment"},{"type":"reference","name":"Element"}]},"inheritedFrom":{"type":"reference","name":"View.fragment"}},{"id":89,"name":"overrideContext","kind":1024,"kindString":"Property","flags":{},"comment":{"shortText":"The override context which contains properties capable of overriding those found on the binding context."},"sources":[{"fileName":"node_modules/aurelia-templating/dist/aurelia-templating.d.ts","line":1105,"character":17}],"type":{"type":"reference","name":"Object"},"inheritedFrom":{"type":"reference","name":"View.overrideContext"}},{"id":86,"name":"viewFactory","kind":1024,"kindString":"Property","flags":{},"comment":{"shortText":"The ViewFactory that built this View instance."},"sources":[{"fileName":"node_modules/aurelia-templating/dist/aurelia-templating.d.ts","line":1090,"character":13}],"type":{"type":"reference","name":"ViewFactory"},"inheritedFrom":{"type":"reference","name":"View.viewFactory"}},{"id":109,"name":"addBinding","kind":2048,"kindString":"Method","flags":{},"signatures":[{"id":110,"name":"addBinding","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Adds a binding instance to this view."},"parameters":[{"id":111,"name":"binding","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The binding instance.\n"},"type":{"type":"reference","name":"Object"}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"View.addBinding"}}],"sources":[{"fileName":"node_modules/aurelia-templating/dist/aurelia-templating.d.ts","line":1144,"character":12}],"inheritedFrom":{"type":"reference","name":"View.addBinding"}},{"id":117,"name":"appendNodesTo","kind":2048,"kindString":"Method","flags":{},"signatures":[{"id":118,"name":"appendNodesTo","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Appends this view's to the specified DOM node."},"parameters":[{"id":119,"name":"parent","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The parent element to append this view's nodes to.\n"},"type":{"type":"reference","name":"Element"}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"View.appendNodesTo"}}],"sources":[{"fileName":"node_modules/aurelia-templating/dist/aurelia-templating.d.ts","line":1161,"character":15}],"inheritedFrom":{"type":"reference","name":"View.appendNodesTo"}},{"id":122,"name":"attached","kind":2048,"kindString":"Method","flags":{},"signatures":[{"id":123,"name":"attached","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Triggers the attach for the view and its children."},"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"View.attached"}}],"sources":[{"fileName":"node_modules/aurelia-templating/dist/aurelia-templating.d.ts","line":1171,"character":10}],"inheritedFrom":{"type":"reference","name":"View.attached"}},{"id":104,"name":"bind","kind":2048,"kindString":"Method","flags":{},"signatures":[{"id":105,"name":"bind","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Binds the view and it's children."},"parameters":[{"id":106,"name":"bindingContext","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The binding context to bind to."},"type":{"type":"reference","name":"Object"}},{"id":107,"name":"overrideContext","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"text":"A secondary binding context that can override the standard context.\n"},"type":{"type":"reference","name":"Object"}},{"id":108,"name":"_systemUpdate","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"undefined"},{"type":"intrinsic","name":"true"},{"type":"intrinsic","name":"false"}]}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"View.bind"}}],"sources":[{"fileName":"node_modules/aurelia-templating/dist/aurelia-templating.d.ts","line":1138,"character":6}],"inheritedFrom":{"type":"reference","name":"View.bind"}},{"id":102,"name":"created","kind":2048,"kindString":"Method","flags":{},"signatures":[{"id":103,"name":"created","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Triggers the created callback for this view and its children."},"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"View.created"}}],"sources":[{"fileName":"node_modules/aurelia-templating/dist/aurelia-templating.d.ts","line":1131,"character":9}],"inheritedFrom":{"type":"reference","name":"View.created"}},{"id":124,"name":"detached","kind":2048,"kindString":"Method","flags":{},"signatures":[{"id":125,"name":"detached","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Triggers the detach for the view and its children."},"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"View.detached"}}],"sources":[{"fileName":"node_modules/aurelia-templating/dist/aurelia-templating.d.ts","line":1176,"character":10}],"inheritedFrom":{"type":"reference","name":"View.detached"}},{"id":114,"name":"insertNodesBefore","kind":2048,"kindString":"Method","flags":{},"signatures":[{"id":115,"name":"insertNodesBefore","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Inserts this view's nodes before the specified DOM node."},"parameters":[{"id":116,"name":"refNode","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The node to insert this view's nodes before.\n"},"type":{"type":"reference","name":"Node"}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"View.insertNodesBefore"}}],"sources":[{"fileName":"node_modules/aurelia-templating/dist/aurelia-templating.d.ts","line":1155,"character":19}],"inheritedFrom":{"type":"reference","name":"View.insertNodesBefore"}},{"id":120,"name":"removeNodes","kind":2048,"kindString":"Method","flags":{},"signatures":[{"id":121,"name":"removeNodes","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Removes this view's nodes from the DOM."},"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"View.removeNodes"}}],"sources":[{"fileName":"node_modules/aurelia-templating/dist/aurelia-templating.d.ts","line":1166,"character":13}],"inheritedFrom":{"type":"reference","name":"View.removeNodes"}},{"id":100,"name":"returnToCache","kind":2048,"kindString":"Method","flags":{},"signatures":[{"id":101,"name":"returnToCache","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Returns this view to the appropriate view cache."},"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"View.returnToCache"}}],"sources":[{"fileName":"node_modules/aurelia-templating/dist/aurelia-templating.d.ts","line":1126,"character":15}],"inheritedFrom":{"type":"reference","name":"View.returnToCache"}},{"id":112,"name":"unbind","kind":2048,"kindString":"Method","flags":{},"signatures":[{"id":113,"name":"unbind","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Unbinds the view and its children."},"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"View.unbind"}}],"sources":[{"fileName":"node_modules/aurelia-templating/dist/aurelia-templating.d.ts","line":1149,"character":8}],"inheritedFrom":{"type":"reference","name":"View.unbind"}}],"groups":[{"title":"Constructors","kind":512,"children":[91]},{"title":"Properties","kind":1024,"children":[88,85,90,82,87,89,86]},{"title":"Methods","kind":2048,"children":[109,117,122,104,102,124,114,120,100,112]}],"sources":[{"fileName":"src/component-tester.ts","line":9,"character":29}],"extendedTypes":[{"type":"reference","name":"View"}]}],"groups":[{"title":"Classes","kind":128,"children":[131,126]},{"title":"Interfaces","kind":256,"children":[59,81]}]},{"name":"\"src/view-spy\"","children":[{"id":8,"name":"ViewSpy","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"Attribute to be placed on any HTML element in a view to emit the View instance\nto the debug console, giving you insight into the live View instance, including\nall child views, live bindings, behaviors and more."},"decorators":[{"name":"customAttribute","type":{"type":"reference","name":"customAttribute"},"arguments":{"name":"'view-spy'"}}],"children":[{"id":12,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"comment":{"shortText":"Creates a new instance of ViewSpy."},"signatures":[{"id":13,"name":"new ViewSpy","kind":16384,"kindString":"Constructor signature","flags":{},"comment":{"shortText":"Creates a new instance of ViewSpy."},"type":{"type":"reference","name":"ViewSpy","id":8}}],"sources":[{"fileName":"src/view-spy.ts","line":13,"character":20}]},{"id":9,"name":"logger","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"src/view-spy.ts","line":11,"character":16}],"type":{"type":"reference","name":"Logger"}},{"id":10,"name":"value","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"src/view-spy.ts","line":12,"character":15}],"type":{"type":"intrinsic","name":"any"}},{"id":11,"name":"view","kind":1024,"kindString":"Property","flags":{"isPrivate":true,"isExported":true},"sources":[{"fileName":"src/view-spy.ts","line":13,"character":14}],"type":{"type":"intrinsic","name":"any"}},{"id":14,"name":"_log","kind":2048,"kindString":"Method","flags":{"isPrivate":true,"isExported":true},"signatures":[{"id":15,"name":"_log","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":16,"name":"lifecycleName","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":17,"name":"context","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"undefined"},{"type":"reference","name":"__type"}]}}],"type":{"type":"intrinsic","name":"void"}}],"sources":[{"fileName":"src/view-spy.ts","line":22,"character":14}]},{"id":24,"name":"attached","kind":2048,"kindString":"Method","flags":{"isExported":true,"isPublic":true},"signatures":[{"id":25,"name":"attached","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Invoked when the target element is attached to the DOM."},"type":{"type":"intrinsic","name":"void"}}],"sources":[{"fileName":"src/view-spy.ts","line":50,"character":17}]},{"id":21,"name":"bind","kind":2048,"kindString":"Method","flags":{"isExported":true,"isPublic":true},"signatures":[{"id":22,"name":"bind","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Invoked when the target view is bound."},"parameters":[{"id":23,"name":"bindingContext","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The target view's binding context.\n"},"type":{"type":"reference","name":"__type"}}],"type":{"type":"intrinsic","name":"void"}}],"sources":[{"fileName":"src/view-spy.ts","line":43,"character":13}]},{"id":18,"name":"created","kind":2048,"kindString":"Method","flags":{"isExported":true,"isPublic":true},"signatures":[{"id":19,"name":"created","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Invoked when the target view is created."},"parameters":[{"id":20,"name":"view","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The target view.\n"},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"intrinsic","name":"void"}}],"sources":[{"fileName":"src/view-spy.ts","line":34,"character":16}]},{"id":26,"name":"detached","kind":2048,"kindString":"Method","flags":{"isExported":true,"isPublic":true},"signatures":[{"id":27,"name":"detached","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Invoked when the target element is detached from the DOM."},"type":{"type":"intrinsic","name":"void"}}],"sources":[{"fileName":"src/view-spy.ts","line":57,"character":17}]},{"id":28,"name":"unbind","kind":2048,"kindString":"Method","flags":{"isExported":true,"isPublic":true},"signatures":[{"id":29,"name":"unbind","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Invoked when the target element is unbound."},"type":{"type":"intrinsic","name":"void"}}],"sources":[{"fileName":"src/view-spy.ts","line":64,"character":15}]}],"groups":[{"title":"Constructors","kind":512,"children":[12]},{"title":"Properties","kind":1024,"children":[9,10,11]},{"title":"Methods","kind":2048,"children":[14,24,21,18,26,28]}],"sources":[{"fileName":"src/view-spy.ts","line":10,"character":20}]}],"groups":[{"title":"Classes","kind":128,"children":[8]}]},{"name":"\"src/wait\"","children":[{"id":31,"name":"waitFor","kind":64,"kindString":"Function","flags":{"isExported":true},"signatures":[{"id":32,"name":"waitFor","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Generic function to wait for something to happen. Uses polling"},"typeParameter":[{"id":33,"name":"T","kind":131072,"kindString":"Type parameter","flags":{}}],"parameters":[{"id":34,"name":"getter","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reflection","declaration":{"id":35,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":36,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"typeParameter","name":"T"}}],"sources":[{"fileName":"src/wait.ts","line":9,"character":34}]}}},{"id":37,"name":"options","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reflection","declaration":{"id":38,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"children":[{"id":40,"name":"interval","kind":32,"kindString":"Variable","flags":{"isOptional":true},"sources":[{"fileName":"src/wait.ts","line":11,"character":10}],"type":{"type":"union","types":[{"type":"intrinsic","name":"undefined"},{"type":"intrinsic","name":"number"}]}},{"id":39,"name":"present","kind":32,"kindString":"Variable","flags":{"isOptional":true},"sources":[{"fileName":"src/wait.ts","line":10,"character":9}],"type":{"type":"union","types":[{"type":"intrinsic","name":"undefined"},{"type":"intrinsic","name":"true"},{"type":"intrinsic","name":"false"}]}},{"id":41,"name":"timeout","kind":32,"kindString":"Variable","flags":{"isOptional":true},"sources":[{"fileName":"src/wait.ts","line":12,"character":9}],"type":{"type":"union","types":[{"type":"intrinsic","name":"undefined"},{"type":"intrinsic","name":"number"}]}}],"groups":[{"title":"Variables","kind":32,"children":[40,39,41]}],"sources":[{"fileName":"src/wait.ts","line":9,"character":52}]}},"defaultValue":" {present: true, interval: 50, timeout: 5000}"}],"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"typeParameter","name":"T"}]}}],"sources":[{"fileName":"src/wait.ts","line":9,"character":23}]},{"id":42,"name":"waitForDocumentElement","kind":64,"kindString":"Function","flags":{"isExported":true},"signatures":[{"id":43,"name":"waitForDocumentElement","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":44,"name":"selector","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":45,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"undefined"},{"type":"reflection","declaration":{"id":46,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"children":[{"id":48,"name":"interval","kind":32,"kindString":"Variable","flags":{"isOptional":true},"sources":[{"fileName":"src/wait.ts","line":50,"character":10}],"type":{"type":"union","types":[{"type":"intrinsic","name":"undefined"},{"type":"intrinsic","name":"number"}]}},{"id":47,"name":"present","kind":32,"kindString":"Variable","flags":{"isOptional":true},"sources":[{"fileName":"src/wait.ts","line":49,"character":9}],"type":{"type":"union","types":[{"type":"intrinsic","name":"undefined"},{"type":"intrinsic","name":"true"},{"type":"intrinsic","name":"false"}]}},{"id":49,"name":"timeout","kind":32,"kindString":"Variable","flags":{"isOptional":true},"sources":[{"fileName":"src/wait.ts","line":51,"character":9}],"type":{"type":"union","types":[{"type":"intrinsic","name":"undefined"},{"type":"intrinsic","name":"number"}]}}],"groups":[{"title":"Variables","kind":32,"children":[48,47,49]}]}}]}}],"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"reference","name":"Element"}]}}],"sources":[{"fileName":"src/wait.ts","line":48,"character":38}]},{"id":50,"name":"waitForDocumentElements","kind":64,"kindString":"Function","flags":{"isExported":true},"signatures":[{"id":51,"name":"waitForDocumentElements","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":52,"name":"selector","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":53,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"undefined"},{"type":"reflection","declaration":{"id":54,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"children":[{"id":56,"name":"interval","kind":32,"kindString":"Variable","flags":{"isOptional":true},"sources":[{"fileName":"src/wait.ts","line":58,"character":10}],"type":{"type":"union","types":[{"type":"intrinsic","name":"undefined"},{"type":"intrinsic","name":"number"}]}},{"id":55,"name":"present","kind":32,"kindString":"Variable","flags":{"isOptional":true},"sources":[{"fileName":"src/wait.ts","line":57,"character":9}],"type":{"type":"union","types":[{"type":"intrinsic","name":"undefined"},{"type":"intrinsic","name":"true"},{"type":"intrinsic","name":"false"}]}},{"id":57,"name":"timeout","kind":32,"kindString":"Variable","flags":{"isOptional":true},"sources":[{"fileName":"src/wait.ts","line":59,"character":9}],"type":{"type":"union","types":[{"type":"intrinsic","name":"undefined"},{"type":"intrinsic","name":"number"}]}}],"groups":[{"title":"Variables","kind":32,"children":[56,55,57]}]}}]}}],"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"reference","name":"NodeListOf","typeArguments":[{"type":"reference","name":"Element"}]}]}}],"sources":[{"fileName":"src/wait.ts","line":56,"character":39}]}],"groups":[{"title":"Functions","kind":64,"children":[31,42,50]}]}],"groups":[{"title":"External modules","kind":1,"children":[202,1,58,7,30,206,207,208,270,284,258]}]} |
@@ -111,3 +111,4 @@ --- | ||
> Note: If you are using `karma` and your configuration already has a path for `'*': 'src/*'` set you may not need to use `src/`, and just `my-component`. | ||
> Info | ||
> If you are using `karma` and your configuration already has a path for `'*': 'src/*'` set you may not need to use `src/`, and just `my-component`. | ||
@@ -232,3 +233,3 @@ Next, we come to the actual test where we call `create` on the `ComponentTester`. Create will kick everything off and bootstrap the mini Aurelia application, configure it with `standardConfiguration` (we will take a look later at how you can run with your own configuration), register provided resources as global resources, start the application and finally render your component so you can assert the expected behavior. In this case, we want to make sure our `firstName` property gets rendered correctly in the HTML by selecting the `div` tag via it's class name. We use `document.querySelector('.firstName');` to grab that and then check that its innerHTML is `Bob`. Next we call Jasmine's `done` function to tell Jasmine that the test is complete. Calling `done` is needed since the `create` method is asynchronous and returns a Promise. | ||
## [Testing custom component with a real view-model](aurelia-doc://section/?/version/1.0.0) | ||
## [Testing custom component with a real view-model](aurelia-doc://section/6/version/1.0.0) | ||
@@ -241,2 +242,4 @@ If you want to test a custom component with a real view-model, mocking | ||
<code-listing heading="A Custom Component with a Real View-model"> | ||
<source-code lang="JavaScript"> | ||
export class MockService { | ||
@@ -247,28 +250,28 @@ firstName; | ||
} | ||
describe('MyComponent', () => { | ||
let component; | ||
let service = new MockService(); | ||
beforeEach(() => { | ||
service.firstName = undefined; | ||
component = StageComponent | ||
.withResources('src/component') | ||
.inView('<component></component>'); | ||
component.bootstrap(aurelia => { | ||
aurelia.use.standardConfiguration(); | ||
aurelia.container.registerInstance(Service, service); | ||
}); | ||
}); | ||
it('should render first name', done => { | ||
service.firstName = 'Bob'; | ||
component.create(bootstrap).then(() => { | ||
const nameElement = document.querySelector('.first-name'); | ||
expect(nameElement.innerHTML).toBe('Bob'); | ||
done(); | ||
@@ -282,4 +285,6 @@ }); | ||
}); | ||
</source-code> | ||
</code-listing> | ||
## [Using a Real Parent View-model](aurelia-doc://section/6/version/1.0.0) | ||
## [Using a Real Parent View-model](aurelia-doc://section/7/version/1.0.0) | ||
@@ -344,3 +349,3 @@ If you want to test using a custom element inside of a real parent view-model this can be done just as easily. This can be really helpful when needing to test the state of a parent that is affected by the child custom element or attribute - | ||
## [Improving Readability with Multi-line Strings](aurelia-doc://section/7/version/1.0.0) | ||
## [Improving Readability with Multi-line Strings](aurelia-doc://section/8/version/1.0.0) | ||
@@ -375,3 +380,3 @@ You can improve the readability of your complex views by using template literals in your tests - | ||
## [Helpful Properties and Functions](aurelia-doc://section/8/version/1.0.0) | ||
## [Helpful Properties and Functions](aurelia-doc://section/9/version/1.0.0) | ||
@@ -390,3 +395,3 @@ The `ComponentTester` exposes a set of properties that can be handy when doing asserts or to stage a component in a specific way. Here's a list of what is available: | ||
## [Testing complex components](aurelia-doc://section/6/version/1.0.0) | ||
## [Testing complex components](aurelia-doc://section/10/version/1.0.0) | ||
@@ -397,3 +402,3 @@ In some cases, the tested element is not rendered yet when the `component.create()` promise is resolved, and therefore when the actual test starts. For these situations, `aurelia-testing` and `ComponentTester` expose helper methods and functions to wait for tested elements to be present in the page. | ||
If you want to wait for elements that can be looked up in the DOM using a query passed to `querySelector` or `querySelectorAll`, you can use one of the following: | ||
If you want to wait for elements that can be looked up in the DOM using a query passed to `querySelector` or `querySelectorAll`, you can use one of the following: | ||
@@ -433,3 +438,3 @@ * `ComponentTester.waitForElement` or `ComponentTester.waitForElements`: to wait for one or several HTML element(s) within the tested component. The query is carried out using `querySelector` and `querySelectorAll`, respectively. | ||
import {waitFor} from 'aurelia-testing'; | ||
waitFor(() => $('.firstName')).then((nameElement) => { | ||
@@ -436,0 +441,0 @@ expect(nameElement.html()).toBe('Bob'); |
@@ -0,1 +1,6 @@ | ||
<a name="1.0.0-beta.4.0.0"></a> | ||
# [1.0.0-beta.4.0.0](https://github.com/aurelia/testing/compare/1.0.0-beta.3.0.1...1.0.0-beta.4.0.0) (2017-11-06) | ||
This entire library was converted to TypeScript. This doesn't involve any breaking changes to the functionality, but the TypeScript definitions are now more accurate and could result in some requried code fixups for TS consumers. | ||
<a name="1.0.0-beta.3.0.1"></a> | ||
@@ -100,2 +105,1 @@ # [1.0.0-beta.3.0.1](https://github.com/aurelia/testing/compare/1.0.0-beta.3.0.0...v1.0.0-beta.3.0.1) (2017-03-25) | ||
* initial poc ([1db19514](http://github.com/aurelia/testing/commit/1db195142715503746e49e179c044c0ad39a4763)) | ||
// Karma configuration | ||
// Generated on Fri Dec 05 2014 16:49:29 GMT-0500 (EST) | ||
// Generated on Sun Aug 28 2016 19:03:27 GMT-0400 (Eastern Daylight Time) | ||
module.exports = function(config) { | ||
var TemplateServerMiddlewareFactory = function (config) { | ||
var TEMPLATE_REQUEST_REGEXP = /^\/base\/dist\/test\/.+\.html$/i; | ||
return function (req, res, next) { | ||
if(TEMPLATE_REQUEST_REGEXP.test(req.url)) { | ||
req.url = req.url.replace(/^\/base\/dist\/test\//, '/base/'); | ||
} | ||
next(); | ||
}; | ||
} | ||
module.exports = function (config) { | ||
config.set({ | ||
@@ -13,18 +24,20 @@ | ||
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter | ||
frameworks: ['jspm', 'jasmine'], | ||
frameworks: ['jasmine', 'requirejs'], | ||
jspm: { | ||
// Edit this to your needs | ||
loadFiles: ['test/setup.js', 'test/**/*.spec.js'], | ||
serveFiles: ['src/**/*.js', 'test/resources/**/*'] | ||
}, | ||
beforeMiddleware: ['template-server'], | ||
plugins: config.plugins.concat([ | ||
{'middleware:template-server': ['factory', TemplateServerMiddlewareFactory]} | ||
]), | ||
// list of files / patterns to load in the browser | ||
files: [], | ||
files: [ | ||
'dist/test/test/setup.js', | ||
{ pattern: 'dist/test/**/*.js', included: false, watched: true }, | ||
{ pattern: '**/*.html', included: false, watched: true }, | ||
{ pattern: 'node_modules/**/*.js', included: false, watched: false }, | ||
], | ||
// list of files to exclude | ||
exclude: [ | ||
], | ||
exclude: [], | ||
@@ -35,16 +48,3 @@ | ||
preprocessors: { | ||
'test/**/*.js': ['babel'], | ||
'src/**/*.js': ['babel'] | ||
}, | ||
'babelPreprocessor': { | ||
options: { | ||
sourceMap: 'inline', | ||
presets: [ 'es2015-loose', 'stage-1'], | ||
plugins: [ | ||
'syntax-flow', | ||
'transform-decorators-legacy', | ||
'transform-flow-strip-types' | ||
] | ||
} | ||
}, | ||
@@ -82,4 +82,8 @@ | ||
// if true, Karma captures browsers, runs the tests and exits | ||
singleRun: false | ||
}); | ||
}; | ||
singleRun: false, | ||
// Concurrency level | ||
// how many browser should be started simultaneous | ||
concurrency: Infinity | ||
}) | ||
} |
114
package.json
{ | ||
"name": "aurelia-testing", | ||
"version": "1.0.0-beta.3.0.1", | ||
"version": "1.0.0-beta.4.0.0", | ||
"description": "A collection of helpers for testing Aurelia apps and components.", | ||
@@ -16,3 +16,3 @@ "keywords": [ | ||
"main": "dist/commonjs/aurelia-testing.js", | ||
"typings": "dist/aurelia-testing.d.ts", | ||
"typings": "dist/commonjs/aurelia-testing.d.ts", | ||
"repository": { | ||
@@ -23,4 +23,33 @@ "type": "git", | ||
"scripts": { | ||
"test": "gulp test", | ||
"ci": "gulp ci" | ||
"lint": "cross-env tslint --project tsconfig.json", | ||
"pretest": "cross-env npm run lint", | ||
"test": "cross-env rimraf dist && tsc && karma start --single-run", | ||
"develop": "concurrently \"./node_modules/.bin/tsc --watch\" \"./node_modules/.bin/karma start\"", | ||
"prebuild:amd": "cross-env rimraf dist/amd", | ||
"build:amd": "cross-env tsc --project tsconfig.build.json --outDir dist/amd --module amd", | ||
"postbuild:amd": "cross-env copyfiles --up 1 src/**/*.html src/**/*.css dist/amd", | ||
"prebuild:commonjs": "cross-env rimraf dist/commonjs", | ||
"build:commonjs": "cross-env tsc --project tsconfig.build.json --outDir dist/commonjs --module commonjs", | ||
"postbuild:commonjs": "cross-env copyfiles --up 1 src/**/*.html src/**/*.css dist/commonjs", | ||
"prebuild:es2017": "cross-env rimraf dist/es2017", | ||
"build:es2017": "cross-env tsc --project tsconfig.build.json --outDir dist/es2017 --module es2015 --target es2017", | ||
"postbuild:es2017": "cross-env copyfiles --up 1 src/**/*.html src/**/*.css dist/es2017", | ||
"prebuild:es2015": "cross-env rimraf dist/es2015", | ||
"build:es2015": "cross-env tsc --project tsconfig.build.json --outDir dist/es2015 --module es2015 --target es2015", | ||
"postbuild:es2015": "cross-env copyfiles --up 1 src/**/*.html src/**/*.css dist/es2015", | ||
"prebuild:native-modules": "cross-env rimraf dist/native-modules", | ||
"build:native-modules": "cross-env tsc --project tsconfig.build.json --outDir dist/native-modules --module es2015", | ||
"postbuild:native-modules": "cross-env copyfiles --up 1 src/**/*.html src/**/*.css dist/native-modules", | ||
"prebuild:system": "cross-env rimraf dist/system", | ||
"build:system": "cross-env tsc --project tsconfig.build.json --outDir dist/system --module system", | ||
"postbuild:system": "cross-env copyfiles --up 1 src/**/*.html src/**/*.css dist/system", | ||
"prebuild": "cross-env rimraf dist", | ||
"build": "concurrently \"npm run build:amd\" \"npm run build:commonjs\" \"npm run build:es2015\" \"npm run build:es2017\" \"npm run build:native-modules\" \"npm run build:system\"", | ||
"predoc": "cross-env rimraf doc/api.json && rimraf dist/doc-temp && tsc --project tsconfig.build.json --outFile dist/doc-temp/aurelia-testing.js && node doc/shape-defs && copyfiles tsconfig.json dist/doc-temp", | ||
"doc": "cross-env typedoc --json doc/api.json --excludeExternals --includeDeclarations --mode modules --target ES6 --name aurelia-testing-docs dist/doc-temp/", | ||
"postdoc": "cross-env node doc/shape-doc && rimraf dist/doc-temp", | ||
"changelog": "cross-env conventional-changelog -p angular -i doc/CHANGELOG.md -s", | ||
"bump-version": "npm --no-git-tag-version version", | ||
"preprepare-release": "cross-env npm run test", | ||
"prepare-release": "cross-env npm run changelog && npm run build && npm run doc" | ||
}, | ||
@@ -64,61 +93,22 @@ "jspmNodeConversion": false, | ||
"devDependencies": { | ||
"aurelia-tools": "^0.2.4", | ||
"babel-dts-generator": "^0.6.1", | ||
"babel-eslint": "^6.1.2", | ||
"babel-plugin-syntax-flow": "^6.8.0", | ||
"babel-plugin-transform-decorators-legacy": "^1.3.4", | ||
"babel-plugin-transform-es2015-modules-amd": "^6.8.0", | ||
"babel-plugin-transform-es2015-modules-commonjs": "^6.11.5", | ||
"babel-plugin-transform-es2015-modules-systemjs": "^6.11.6", | ||
"babel-plugin-transform-flow-strip-types": "^6.8.0", | ||
"babel-preset-es2015": "^6.9.0", | ||
"babel-preset-es2015-loose": "^7.0.0", | ||
"babel-preset-es2015-loose-native-modules": "^1.0.0", | ||
"babel-preset-stage-1": "^6.5.0", | ||
"del": "^2.2.1", | ||
"gulp": "^3.9.1", | ||
"gulp-babel": "^6.1.2", | ||
"gulp-bump": "^2.2.0", | ||
"gulp-concat": "^2.6.0", | ||
"gulp-conventional-changelog": "^1.1.0", | ||
"gulp-eslint": "^3.0.1", | ||
"gulp-ignore": "^2.0.1", | ||
"gulp-insert": "^0.5.0", | ||
"gulp-rename": "^1.2.2", | ||
"gulp-typedoc": "^2.0.0", | ||
"gulp-typedoc-extractor": "^0.0.8", | ||
"gulp-typescript": "^2.13.6", | ||
"gulp-util": "^3.0.7", | ||
"jasmine-core": "^2.4.1", | ||
"karma": "^1.1.2", | ||
"karma-babel-preprocessor": "^6.0.1", | ||
"karma-chrome-launcher": "^1.0.1", | ||
"karma-coverage": "^1.1.1", | ||
"karma-jasmine": "^1.0.2", | ||
"karma-jspm": "^2.2.0", | ||
"merge2": "^1.0.2", | ||
"object.assign": "^4.0.4", | ||
"require-dir": "^0.3.0", | ||
"run-sequence": "^1.2.2", | ||
"through2": "^2.0.1", | ||
"typedoc": "^0.4.4", | ||
"typescript": "^1.9.0-dev.20160622-1.0", | ||
"vinyl": "^1.1.1", | ||
"vinyl-paths": "^2.1.0", | ||
"yargs": "^4.8.1" | ||
}, | ||
"aurelia": { | ||
"documentation": { | ||
"articles": [ | ||
{ | ||
"title": "Testing Components", | ||
"href": "doc/article/en-US/testing-components.md" | ||
}, | ||
{ | ||
"title": "End-to-End Testing", | ||
"href": "doc/article/en-US/end-to-end-testing.md" | ||
} | ||
] | ||
} | ||
"aurelia-bootstrapper": "^2.1.1", | ||
"aurelia-pal-browser": "^1.3.0", | ||
"aurelia-polyfills": "^1.2.2", | ||
"concurrently": "^3.5.0", | ||
"conventional-changelog-cli": "^1.3.2", | ||
"copyfiles": "^1.2.0", | ||
"cross-env": "^5.0.5", | ||
"jasmine-core": "^2.7.0", | ||
"karma": "^1.7.0", | ||
"karma-chrome-launcher": "^2.2.0", | ||
"karma-ie-launcher": "^1.0.0", | ||
"karma-jasmine": "^1.1.0", | ||
"karma-requirejs": "^1.1.0", | ||
"requirejs": "^2.3.4", | ||
"requirejs-text": "^2.0.15", | ||
"rimraf": "^2.6.1", | ||
"tslint": "^5.6.0", | ||
"typedoc": "^0.8.0", | ||
"typescript": "^2.4.2" | ||
} | ||
} |
@@ -10,3 +10,3 @@ # aurelia-testing | ||
> To keep up to date on [Aurelia](http://www.aurelia.io/), please visit and subscribe to [the official blog](http://blog.aurelia.io/) and [our email list](http://eepurl.com/ces50j). We also invite you to [follow us on twitter](https://twitter.com/aureliaeffect). If you have questions, please [join our community on Gitter](https://gitter.im/aurelia/discuss) or use [stack overflow](http://stackoverflow.com/search?q=aurelia). Documentation can be found [in our developer hub](http://aurelia.io/hub.html). If you would like to have deeper insight into our development process, please install the [ZenHub](https://zenhub.io) Chrome or Firefox Extension and visit any of our repository's boards. | ||
> To keep up to date on [Aurelia](http://www.aurelia.io/), please visit and subscribe to [the official blog](http://blog.aurelia.io/) and [our email list](http://eepurl.com/ces50j). We also invite you to [follow us on twitter](https://twitter.com/aureliaeffect). If you have questions look around our [Discourse forums](https://discourse.aurelia.io/), chat in our [community on Gitter](https://gitter.im/aurelia/discuss) or use [stack overflow](http://stackoverflow.com/search?q=aurelia). Documentation can be found [in our developer hub](http://aurelia.io/docs/testing). If you would like to have deeper insight into our development process, please install the [ZenHub](https://zenhub.io) Chrome or Firefox Extension and visit any of our repository's boards. | ||
@@ -27,40 +27,18 @@ ## Platform Support | ||
``` | ||
3. Ensure that [Gulp](http://gulpjs.com/) is installed. If you need to install it, use the following command: | ||
3. To build the code, you can now run: | ||
```shell | ||
npm install -g gulp | ||
npm run build | ||
``` | ||
4. To build the code, you can now run: | ||
4. You will find the compiled code in the `dist` folder, available in six module formats: AMD, CommonJS and ES2015, ES2017, native modules, and System. | ||
```shell | ||
gulp build | ||
``` | ||
5. You will find the compiled code in the `dist` folder, available in three module formats: AMD, CommonJS and ES6. | ||
5. See `package.json` scripts section for other tasks related to generating the docs and linting. | ||
6. See `gulpfile.js` for other tasks related to generating the docs and linting. | ||
## Running The Tests | ||
To run the unit tests, first ensure that you have followed the steps above in order to install all dependencies and successfully build the library. Once you have done that, proceed with these additional steps: | ||
To run the unit tests, first ensure that you have followed the steps above in order to install all dependencies and successfully build the library. Once you have done that, you can run the tests by executing the following command: | ||
1. Ensure that the [Karma](http://karma-runner.github.io/) CLI is installed. If you need to install it, use the following command: | ||
```shell | ||
npm install -g karma-cli | ||
npm test | ||
``` | ||
2. Ensure that [jspm](http://jspm.io/) is installed. If you need to install it, use the following commnand: | ||
```shell | ||
npm install -g jspm | ||
``` | ||
3. Install the client-side dependencies with jspm: | ||
```shell | ||
jspm install | ||
``` | ||
4. You can now run the tests with this command: | ||
```shell | ||
karma start | ||
``` |
{ | ||
"compilerOptions": { | ||
"target": "es2015", | ||
"module": "es2015", | ||
"experimentalDecorators": true, | ||
"emitDecoratorMetadata": false, | ||
"module": "amd", | ||
"moduleResolution": "node", | ||
"stripInternal": true, | ||
"preserveConstEnums": true, | ||
"listFiles": true, | ||
"target": "es5", | ||
"lib": [ | ||
"es2017", | ||
"dom" | ||
], | ||
"outDir": "dist/test", | ||
"noImplicitAny": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"noImplicitReturns": true, | ||
"strictNullChecks": true, | ||
"declaration": true, | ||
"removeComments": true, | ||
"lib": ["es2015", "dom"] | ||
"forceConsistentCasingInFileNames": true, | ||
"experimentalDecorators": true, | ||
"noEmitHelpers": false, | ||
"stripInternal": true | ||
}, | ||
"exclude": [ | ||
"node_modules", | ||
".vscode", | ||
"dist", | ||
"build", | ||
"doc", | ||
"test", | ||
"config.js", | ||
"gulpfile.js", | ||
"karma.conf.js" | ||
"node_modules" | ||
] | ||
} |
{ | ||
"name": "aurelia-testing", | ||
"main": "dist/aurelia-testing.d.ts" | ||
"main": "dist/amd/aurelia-testing.d.ts" | ||
} |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
19
94
3268
321728
43
5
1