-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(all): prepare release 1.0.0-beta.4.0.0
- Loading branch information
1 parent
cf6c1fc
commit afb0978
Showing
64 changed files
with
2,378 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { FrameworkConfiguration } from 'aurelia-framework'; | ||
export * from './compile-spy'; | ||
export * from './view-spy'; | ||
export * from './component-tester'; | ||
export * from './wait'; | ||
export declare function configure(config: FrameworkConfiguration): void; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
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; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { TargetInstruction } from 'aurelia-templating'; | ||
/** | ||
* 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. | ||
*/ | ||
export declare 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: Element, instruction: TargetInstruction); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
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); | ||
} | ||
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; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { Aurelia, FrameworkConfiguration } from 'aurelia-framework'; | ||
export declare class StageComponent { | ||
static withResources<T = any>(resources?: string | string[]): ComponentTester<T>; | ||
} | ||
export declare class ComponentTester<T = any> { | ||
bind: (bindingContext: {}) => Promise<void>; | ||
attached: () => Promise<void>; | ||
detached: () => Promise<void>; | ||
unbind: () => Promise<void>; | ||
element: Element; | ||
viewModel: T; | ||
private html; | ||
private resources; | ||
private bindingContext; | ||
private rootView; | ||
private host; | ||
configure(aurelia: Aurelia): FrameworkConfiguration; | ||
bootstrap(configure: (aurelia: Aurelia) => FrameworkConfiguration): void; | ||
withResources(resources: string | string[]): ComponentTester<T>; | ||
inView(html: string): ComponentTester<T>; | ||
boundTo(bindingContext: {}): ComponentTester<T>; | ||
manuallyHandleLifecycle(): ComponentTester<T>; | ||
create(bootstrap: (configure: (aurelia: Aurelia) => Promise<void>) => Promise<void>): Promise<void>; | ||
dispose(): Element; | ||
private _prepareLifecycle(); | ||
waitForElement(selector: string, options?: { | ||
present?: boolean; | ||
interval?: number; | ||
timeout?: number; | ||
}): Promise<Element>; | ||
waitForElements(selector: string, options?: { | ||
present?: boolean; | ||
interval?: number; | ||
timeout?: number; | ||
}): Promise<NodeListOf<Element>>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
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 () { | ||
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; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/** | ||
* 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. | ||
*/ | ||
export declare class ViewSpy { | ||
private logger; | ||
private value; | ||
private view; | ||
/** | ||
* Creates a new instance of ViewSpy. | ||
*/ | ||
constructor(); | ||
private _log(lifecycleName, context?); | ||
/** | ||
* Invoked when the target view is created. | ||
* @param view The target view. | ||
*/ | ||
created(view: any): void; | ||
/** | ||
* Invoked when the target view is bound. | ||
* @param bindingContext The target view's binding context. | ||
*/ | ||
bind(bindingContext: {}): void; | ||
/** | ||
* Invoked when the target element is attached to the DOM. | ||
*/ | ||
attached(): void; | ||
/** | ||
* Invoked when the target element is detached from the DOM. | ||
*/ | ||
detached(): void; | ||
/** | ||
* Invoked when the target element is unbound. | ||
*/ | ||
unbind(): void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
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'); | ||
} | ||
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; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/** | ||
* 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 declare function waitFor<T>(getter: () => T, options?: { | ||
present?: boolean; | ||
interval?: number; | ||
timeout?: number; | ||
}): Promise<T>; | ||
export declare function waitForDocumentElement(selector: string, options?: { | ||
present?: boolean; | ||
interval?: number; | ||
timeout?: number; | ||
}): Promise<Element>; | ||
export declare function waitForDocumentElements(selector: string, options?: { | ||
present?: boolean; | ||
interval?: number; | ||
timeout?: number; | ||
}): Promise<NodeListOf<Element>>; |
Oops, something went wrong.