aurelia-testing
Advanced tools
Comparing version 1.0.0-beta.1.0.3 to 1.0.0-beta.2.0.0
{ | ||
"name": "aurelia-testing", | ||
"version": "1.0.0-beta.1.0.3", | ||
"version": "1.0.0-beta.2.0.0", | ||
"description": "A collection of helpers for testing Aurelia apps and components.", | ||
@@ -21,8 +21,8 @@ "keywords": [ | ||
"dependencies": { | ||
"aurelia-templating": "^1.0.0-rc.1.0.0", | ||
"aurelia-framework": "^1.0.0-rc.1.0.0", | ||
"aurelia-dependency-injection": "^1.0.0-rc.1.0.0", | ||
"aurelia-logging": "^1.0.0-rc.1.0.0", | ||
"aurelia-pal": "^1.0.0-rc.1.0.0" | ||
"aurelia-templating": "^1.0.0", | ||
"aurelia-framework": "^1.0.0", | ||
"aurelia-dependency-injection": "^1.0.0", | ||
"aurelia-logging": "^1.0.0", | ||
"aurelia-pal": "^1.0.0" | ||
} | ||
} |
100
config.js
@@ -10,10 +10,10 @@ System.config({ | ||
"aurelia-bootstrapper": "npm:aurelia-bootstrapper@1.0.0-beta.2.0.0", | ||
"aurelia-dependency-injection": "npm:aurelia-dependency-injection@1.0.0-rc.1.0.0", | ||
"aurelia-framework": "npm:aurelia-framework@1.0.0-rc.1.0.0", | ||
"aurelia-logging": "npm:aurelia-logging@1.0.0-rc.1.0.0", | ||
"aurelia-pal": "npm:aurelia-pal@1.0.0-rc.1.0.0", | ||
"aurelia-templating": "npm:aurelia-templating@1.0.0-rc.1.0.0", | ||
"aurelia-dependency-injection": "npm:aurelia-dependency-injection@1.0.0", | ||
"aurelia-framework": "npm:aurelia-framework@1.0.0", | ||
"aurelia-logging": "npm:aurelia-logging@1.0.0", | ||
"aurelia-pal": "npm:aurelia-pal@1.0.0", | ||
"aurelia-templating": "npm:aurelia-templating@1.0.0", | ||
"babel": "npm:babel-core@5.8.38", | ||
"babel-runtime": "npm:babel-runtime@5.8.38", | ||
"core-js": "npm:core-js@1.2.6", | ||
"core-js": "npm:core-js@1.2.7", | ||
"github:jspm/nodelibs-assert@0.1.0": { | ||
@@ -29,3 +29,3 @@ "assert": "npm:assert@1.4.1" | ||
"github:jspm/nodelibs-process@0.1.2": { | ||
"process": "npm:process@0.11.5" | ||
"process": "npm:process@0.11.6" | ||
}, | ||
@@ -44,2 +44,8 @@ "github:jspm/nodelibs-util@0.1.0": { | ||
}, | ||
"npm:aurelia-binding@1.0.0": { | ||
"aurelia-logging": "npm:aurelia-logging@1.0.0", | ||
"aurelia-metadata": "npm:aurelia-metadata@1.0.0", | ||
"aurelia-pal": "npm:aurelia-pal@1.0.0", | ||
"aurelia-task-queue": "npm:aurelia-task-queue@1.0.0" | ||
}, | ||
"npm:aurelia-binding@1.0.0-beta.2.0.5": { | ||
@@ -51,8 +57,2 @@ "aurelia-logging": "npm:aurelia-logging@1.0.0-beta.2.0.0", | ||
}, | ||
"npm:aurelia-binding@1.0.0-rc.1.0.0": { | ||
"aurelia-logging": "npm:aurelia-logging@1.0.0-rc.1.0.0", | ||
"aurelia-metadata": "npm:aurelia-metadata@1.0.0-rc.1.0.0", | ||
"aurelia-pal": "npm:aurelia-pal@1.0.0-rc.1.0.0", | ||
"aurelia-task-queue": "npm:aurelia-task-queue@1.0.0-rc.1.0.0" | ||
}, | ||
"npm:aurelia-bootstrapper@1.0.0-beta.2.0.0": { | ||
@@ -74,2 +74,6 @@ "aurelia-event-aggregator": "npm:aurelia-event-aggregator@1.0.0-beta.2.0.0", | ||
}, | ||
"npm:aurelia-dependency-injection@1.0.0": { | ||
"aurelia-metadata": "npm:aurelia-metadata@1.0.0", | ||
"aurelia-pal": "npm:aurelia-pal@1.0.0" | ||
}, | ||
"npm:aurelia-dependency-injection@1.0.0-beta.2.1.0": { | ||
@@ -79,9 +83,16 @@ "aurelia-metadata": "npm:aurelia-metadata@1.0.0-beta.2.0.0", | ||
}, | ||
"npm:aurelia-dependency-injection@1.0.0-rc.1.0.0": { | ||
"aurelia-metadata": "npm:aurelia-metadata@1.0.0-rc.1.0.0", | ||
"aurelia-pal": "npm:aurelia-pal@1.0.0-rc.1.0.0" | ||
}, | ||
"npm:aurelia-event-aggregator@1.0.0-beta.2.0.0": { | ||
"aurelia-logging": "npm:aurelia-logging@1.0.0-beta.2.0.0" | ||
}, | ||
"npm:aurelia-framework@1.0.0": { | ||
"aurelia-binding": "npm:aurelia-binding@1.0.0", | ||
"aurelia-dependency-injection": "npm:aurelia-dependency-injection@1.0.0", | ||
"aurelia-loader": "npm:aurelia-loader@1.0.0", | ||
"aurelia-logging": "npm:aurelia-logging@1.0.0", | ||
"aurelia-metadata": "npm:aurelia-metadata@1.0.0", | ||
"aurelia-pal": "npm:aurelia-pal@1.0.0", | ||
"aurelia-path": "npm:aurelia-path@1.0.0", | ||
"aurelia-task-queue": "npm:aurelia-task-queue@1.0.0", | ||
"aurelia-templating": "npm:aurelia-templating@1.0.0" | ||
}, | ||
"npm:aurelia-framework@1.0.0-beta.2.0.0": { | ||
@@ -98,13 +109,2 @@ "aurelia-binding": "npm:aurelia-binding@1.0.0-beta.2.0.5", | ||
}, | ||
"npm:aurelia-framework@1.0.0-rc.1.0.0": { | ||
"aurelia-binding": "npm:aurelia-binding@1.0.0-rc.1.0.0", | ||
"aurelia-dependency-injection": "npm:aurelia-dependency-injection@1.0.0-rc.1.0.0", | ||
"aurelia-loader": "npm:aurelia-loader@1.0.0-rc.1.0.0", | ||
"aurelia-logging": "npm:aurelia-logging@1.0.0-rc.1.0.0", | ||
"aurelia-metadata": "npm:aurelia-metadata@1.0.0-rc.1.0.0", | ||
"aurelia-pal": "npm:aurelia-pal@1.0.0-rc.1.0.0", | ||
"aurelia-path": "npm:aurelia-path@1.0.0-rc.1.0.0", | ||
"aurelia-task-queue": "npm:aurelia-task-queue@1.0.0-rc.1.0.0", | ||
"aurelia-templating": "npm:aurelia-templating@1.0.0-rc.1.0.0" | ||
}, | ||
"npm:aurelia-history-browser@1.0.0-beta.2.0.0": { | ||
@@ -119,2 +119,6 @@ "aurelia-history": "npm:aurelia-history@1.0.0-beta.2.0.0", | ||
}, | ||
"npm:aurelia-loader@1.0.0": { | ||
"aurelia-metadata": "npm:aurelia-metadata@1.0.0", | ||
"aurelia-path": "npm:aurelia-path@1.0.0" | ||
}, | ||
"npm:aurelia-loader@1.0.0-beta.2.0.0": { | ||
@@ -124,15 +128,11 @@ "aurelia-metadata": "npm:aurelia-metadata@1.0.0-beta.2.0.0", | ||
}, | ||
"npm:aurelia-loader@1.0.0-rc.1.0.0": { | ||
"aurelia-metadata": "npm:aurelia-metadata@1.0.0-rc.1.0.0", | ||
"aurelia-path": "npm:aurelia-path@1.0.0-rc.1.0.0" | ||
}, | ||
"npm:aurelia-logging-console@1.0.0-beta.2.0.0": { | ||
"aurelia-logging": "npm:aurelia-logging@1.0.0-beta.2.0.0" | ||
}, | ||
"npm:aurelia-metadata@1.0.0": { | ||
"aurelia-pal": "npm:aurelia-pal@1.0.0" | ||
}, | ||
"npm:aurelia-metadata@1.0.0-beta.2.0.0": { | ||
"aurelia-pal": "npm:aurelia-pal@1.0.0-beta.1.3.0" | ||
}, | ||
"npm:aurelia-metadata@1.0.0-rc.1.0.0": { | ||
"aurelia-pal": "npm:aurelia-pal@1.0.0-rc.1.0.0" | ||
}, | ||
"npm:aurelia-pal-browser@1.0.0-beta.3.0.0": { | ||
@@ -155,8 +155,8 @@ "aurelia-pal": "npm:aurelia-pal@1.0.0-beta.1.3.0" | ||
}, | ||
"npm:aurelia-task-queue@1.0.0": { | ||
"aurelia-pal": "npm:aurelia-pal@1.0.0" | ||
}, | ||
"npm:aurelia-task-queue@1.0.0-beta.2.0.0": { | ||
"aurelia-pal": "npm:aurelia-pal@1.0.0-beta.1.3.0" | ||
}, | ||
"npm:aurelia-task-queue@1.0.0-rc.1.0.0": { | ||
"aurelia-pal": "npm:aurelia-pal@1.0.0-rc.1.0.0" | ||
}, | ||
"npm:aurelia-templating-binding@1.0.0-beta.2.0.0": { | ||
@@ -187,2 +187,12 @@ "aurelia-binding": "npm:aurelia-binding@1.0.0-beta.2.0.5", | ||
}, | ||
"npm:aurelia-templating@1.0.0": { | ||
"aurelia-binding": "npm:aurelia-binding@1.0.0", | ||
"aurelia-dependency-injection": "npm:aurelia-dependency-injection@1.0.0", | ||
"aurelia-loader": "npm:aurelia-loader@1.0.0", | ||
"aurelia-logging": "npm:aurelia-logging@1.0.0", | ||
"aurelia-metadata": "npm:aurelia-metadata@1.0.0", | ||
"aurelia-pal": "npm:aurelia-pal@1.0.0", | ||
"aurelia-path": "npm:aurelia-path@1.0.0", | ||
"aurelia-task-queue": "npm:aurelia-task-queue@1.0.0" | ||
}, | ||
"npm:aurelia-templating@1.0.0-beta.3.0.2": { | ||
@@ -198,12 +208,2 @@ "aurelia-binding": "npm:aurelia-binding@1.0.0-beta.2.0.5", | ||
}, | ||
"npm:aurelia-templating@1.0.0-rc.1.0.0": { | ||
"aurelia-binding": "npm:aurelia-binding@1.0.0-rc.1.0.0", | ||
"aurelia-dependency-injection": "npm:aurelia-dependency-injection@1.0.0-rc.1.0.0", | ||
"aurelia-loader": "npm:aurelia-loader@1.0.0-rc.1.0.0", | ||
"aurelia-logging": "npm:aurelia-logging@1.0.0-rc.1.0.0", | ||
"aurelia-metadata": "npm:aurelia-metadata@1.0.0-rc.1.0.0", | ||
"aurelia-pal": "npm:aurelia-pal@1.0.0-rc.1.0.0", | ||
"aurelia-path": "npm:aurelia-path@1.0.0-rc.1.0.0", | ||
"aurelia-task-queue": "npm:aurelia-task-queue@1.0.0-rc.1.0.0" | ||
}, | ||
"npm:babel-runtime@5.8.38": { | ||
@@ -220,3 +220,3 @@ "process": "github:jspm/nodelibs-process@0.1.2" | ||
}, | ||
"npm:core-js@1.2.6": { | ||
"npm:core-js@1.2.7": { | ||
"fs": "github:jspm/nodelibs-fs@0.1.2", | ||
@@ -233,3 +233,3 @@ "path": "github:jspm/nodelibs-path@0.1.0", | ||
}, | ||
"npm:process@0.11.5": { | ||
"npm:process@0.11.6": { | ||
"assert": "github:jspm/nodelibs-assert@0.1.0", | ||
@@ -236,0 +236,0 @@ "fs": "github:jspm/nodelibs-fs@0.1.2", |
@@ -60,19 +60,22 @@ define(['exports', 'aurelia-templating', 'aurelia-framework'], function (exports, _aureliaTemplating, _aureliaFramework) { | ||
} | ||
return aurelia.start().then(function (a) { | ||
var host = document.createElement('div'); | ||
host.innerHTML = _this._html; | ||
document.body.appendChild(host); | ||
aurelia.enhance(_this._bindingContext, host); | ||
_this._rootView = aurelia.root; | ||
_this.element = host.firstElementChild; | ||
if (aurelia.root.controllers.length) { | ||
_this.viewModel = aurelia.root.controllers[0].viewModel; | ||
} | ||
_this.dispose = function () { | ||
return host.parentNode.removeChild(host); | ||
}; | ||
return new Promise(function (resolve) { | ||
return setTimeout(function () { | ||
return resolve(); | ||
}, 0); | ||
_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); | ||
}); | ||
}); | ||
@@ -84,2 +87,13 @@ }); | ||
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() { | ||
@@ -86,0 +100,0 @@ var _this2 = this; |
@@ -8,3 +8,3 @@ define(['exports', './aurelia-testing'], function (exports, _aureliaTesting) { | ||
Object.keys(_aureliaTesting).forEach(function (key) { | ||
if (key === "default") return; | ||
if (key === "default" || key === "__esModule") return; | ||
Object.defineProperty(exports, key, { | ||
@@ -11,0 +11,0 @@ enumerable: true, |
@@ -21,3 +21,2 @@ import * as LogManager from 'aurelia-logging'; | ||
unbind: (() => void); | ||
dispose: (() => Promise<any>); | ||
element: Element; | ||
@@ -32,2 +31,3 @@ viewModel: any; | ||
create(bootstrap: ((aurelia: Aurelia) => Promise<void>)): Promise<void>; | ||
dispose(): any; | ||
} | ||
@@ -34,0 +34,0 @@ |
@@ -17,3 +17,2 @@ import * as LogManager from 'aurelia-logging'; | ||
unbind: () => void; | ||
dispose: () => Promise<any>; | ||
element: Element; | ||
@@ -57,14 +56,19 @@ viewModel: any; | ||
} | ||
return aurelia.start().then(a => { | ||
let host = document.createElement('div'); | ||
host.innerHTML = this._html; | ||
document.body.appendChild(host); | ||
aurelia.enhance(this._bindingContext, host); | ||
this._rootView = aurelia.root; | ||
this.element = host.firstElementChild; | ||
if (aurelia.root.controllers.length) { | ||
this.viewModel = aurelia.root.controllers[0].viewModel; | ||
} | ||
this.dispose = () => host.parentNode.removeChild(host); | ||
return new Promise(resolve => setTimeout(() => resolve(), 0)); | ||
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)); | ||
}); | ||
}); | ||
@@ -75,2 +79,15 @@ }); | ||
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); | ||
} | ||
_prepareLifecycle() { | ||
@@ -77,0 +94,0 @@ // bind |
@@ -63,19 +63,22 @@ 'use strict'; | ||
} | ||
return aurelia.start().then(function (a) { | ||
var host = document.createElement('div'); | ||
host.innerHTML = _this._html; | ||
document.body.appendChild(host); | ||
aurelia.enhance(_this._bindingContext, host); | ||
_this._rootView = aurelia.root; | ||
_this.element = host.firstElementChild; | ||
if (aurelia.root.controllers.length) { | ||
_this.viewModel = aurelia.root.controllers[0].viewModel; | ||
} | ||
_this.dispose = function () { | ||
return host.parentNode.removeChild(host); | ||
}; | ||
return new Promise(function (resolve) { | ||
return setTimeout(function () { | ||
return resolve(); | ||
}, 0); | ||
_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); | ||
}); | ||
}); | ||
@@ -87,2 +90,13 @@ }); | ||
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() { | ||
@@ -89,0 +103,0 @@ var _this2 = this; |
@@ -10,3 +10,3 @@ 'use strict'; | ||
Object.keys(_aureliaTesting).forEach(function (key) { | ||
if (key === "default") return; | ||
if (key === "default" || key === "__esModule") return; | ||
Object.defineProperty(exports, key, { | ||
@@ -13,0 +13,0 @@ enumerable: true, |
@@ -47,14 +47,19 @@ import { View } from 'aurelia-templating'; | ||
} | ||
return aurelia.start().then(a => { | ||
let host = document.createElement('div'); | ||
host.innerHTML = this._html; | ||
document.body.appendChild(host); | ||
aurelia.enhance(this._bindingContext, host); | ||
this._rootView = aurelia.root; | ||
this.element = host.firstElementChild; | ||
if (aurelia.root.controllers.length) { | ||
this.viewModel = aurelia.root.controllers[0].viewModel; | ||
} | ||
this.dispose = () => host.parentNode.removeChild(host); | ||
return new Promise(resolve => setTimeout(() => resolve(), 0)); | ||
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)); | ||
}); | ||
}); | ||
@@ -65,2 +70,13 @@ }); | ||
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); | ||
} | ||
_prepareLifecycle() { | ||
@@ -67,0 +83,0 @@ const bindPrototype = View.prototype.bind; |
@@ -55,19 +55,22 @@ | ||
} | ||
return aurelia.start().then(function (a) { | ||
var host = document.createElement('div'); | ||
host.innerHTML = _this._html; | ||
document.body.appendChild(host); | ||
aurelia.enhance(_this._bindingContext, host); | ||
_this._rootView = aurelia.root; | ||
_this.element = host.firstElementChild; | ||
if (aurelia.root.controllers.length) { | ||
_this.viewModel = aurelia.root.controllers[0].viewModel; | ||
} | ||
_this.dispose = function () { | ||
return host.parentNode.removeChild(host); | ||
}; | ||
return new Promise(function (resolve) { | ||
return setTimeout(function () { | ||
return resolve(); | ||
}, 0); | ||
_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); | ||
}); | ||
}); | ||
@@ -79,2 +82,13 @@ }); | ||
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() { | ||
@@ -81,0 +95,0 @@ var _this2 = this; |
@@ -68,19 +68,22 @@ 'use strict'; | ||
} | ||
return aurelia.start().then(function (a) { | ||
var host = document.createElement('div'); | ||
host.innerHTML = _this._html; | ||
document.body.appendChild(host); | ||
aurelia.enhance(_this._bindingContext, host); | ||
_this._rootView = aurelia.root; | ||
_this.element = host.firstElementChild; | ||
if (aurelia.root.controllers.length) { | ||
_this.viewModel = aurelia.root.controllers[0].viewModel; | ||
} | ||
_this.dispose = function () { | ||
return host.parentNode.removeChild(host); | ||
}; | ||
return new Promise(function (resolve) { | ||
return setTimeout(function () { | ||
return resolve(); | ||
}, 0); | ||
_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); | ||
}); | ||
}); | ||
@@ -92,2 +95,13 @@ }); | ||
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() { | ||
@@ -94,0 +108,0 @@ var _this2 = this; |
@@ -11,3 +11,3 @@ 'use strict'; | ||
for (var _key in _aureliaTesting) { | ||
if (_key !== "default") _exportObj[_key] = _aureliaTesting[_key]; | ||
if (_key !== "default" && key !== "__esModule") _exportObj[_key] = _aureliaTesting[_key]; | ||
} | ||
@@ -14,0 +14,0 @@ |
@@ -75,19 +75,22 @@ 'use strict'; | ||
} | ||
return aurelia.start().then(function (a) { | ||
var host = document.createElement('div'); | ||
host.innerHTML = _this._html; | ||
document.body.appendChild(host); | ||
aurelia.enhance(_this._bindingContext, host); | ||
_this._rootView = aurelia.root; | ||
_this.element = host.firstElementChild; | ||
if (aurelia.root.controllers.length) { | ||
_this.viewModel = aurelia.root.controllers[0].viewModel; | ||
} | ||
_this.dispose = function () { | ||
return host.parentNode.removeChild(host); | ||
}; | ||
return new Promise(function (resolve) { | ||
return setTimeout(function () { | ||
return resolve(); | ||
}, 0); | ||
_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); | ||
}); | ||
}); | ||
@@ -99,2 +102,13 @@ }); | ||
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() { | ||
@@ -101,0 +115,0 @@ var _this2 = this; |
@@ -1,1 +0,1 @@ | ||
{"name":"aurelia-testing","children":[{"id":57,"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":58,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"comment":{"shortText":"Creates and instanse of CompileSpy."},"signatures":[{"id":59,"name":"new CompileSpy","kind":16384,"kindString":"Constructor signature","flags":{},"comment":{"shortText":"Creates and instanse of CompileSpy."},"parameters":[{"id":60,"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":61,"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":57}}]}],"groups":[{"title":"Constructors","kind":512,"children":[58]}]},{"id":2,"name":"ComponentTester","kind":128,"kindString":"Class","flags":{"isExported":true},"children":[{"id":7,"name":"attached","kind":1024,"kindString":"Property","flags":{"isExported":true},"type":{"type":"reflection","declaration":{"id":8,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":9,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"instrinct","name":"void"}}]}}},{"id":3,"name":"bind","kind":1024,"kindString":"Property","flags":{"isExported":true},"type":{"type":"reflection","declaration":{"id":4,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":5,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":6,"name":"bindingContext","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"}}]}}},{"id":18,"name":"configure","kind":1024,"kindString":"Property","flags":{"isExported":true},"type":{"type":"instrinct","name":"any"}},{"id":13,"name":"dispose","kind":1024,"kindString":"Property","flags":{"isExported":true},"type":{"type":"reflection","declaration":{"id":14,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":15,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"reference","name":"Promise","typeArguments":[{"type":"instrinct","name":"any"}]}}]}}},{"id":16,"name":"element","kind":1024,"kindString":"Property","flags":{"isExported":true},"type":{"type":"reference","name":"Element"}},{"id":10,"name":"unbind","kind":1024,"kindString":"Property","flags":{"isExported":true},"type":{"type":"reflection","declaration":{"id":11,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":12,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"instrinct","name":"void"}}]}}},{"id":17,"name":"viewModel","kind":1024,"kindString":"Property","flags":{"isExported":true},"type":{"type":"instrinct","name":"any"}},{"id":19,"name":"bootstrap","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":20,"name":"bootstrap","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":21,"name":"configure","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reflection","declaration":{"id":22,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":23,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":24,"name":"aurelia","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Aurelia"}}],"type":{"type":"instrinct","name":"void"}}]}}}],"type":{"type":"instrinct","name":"any"}}]},{"id":31,"name":"boundTo","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":32,"name":"boundTo","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":33,"name":"bindingContext","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"reference","name":"ComponentTester","id":2}}]},{"id":36,"name":"create","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":37,"name":"create","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":38,"name":"bootstrap","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reflection","declaration":{"id":39,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":40,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":41,"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"}]}}]},{"id":28,"name":"inView","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":29,"name":"inView","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":30,"name":"html","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"reference","name":"ComponentTester","id":2}}]},{"id":34,"name":"manuallyHandleLifecycle","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":35,"name":"manuallyHandleLifecycle","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"reference","name":"ComponentTester","id":2}}]},{"id":25,"name":"withResources","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":26,"name":"withResources","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":27,"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":2}}]}],"groups":[{"title":"Properties","kind":1024,"children":[7,3,18,13,16,10,17]},{"title":"Methods","kind":2048,"children":[19,31,36,28,34,25]}]},{"id":42,"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":43,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"comment":{"shortText":"Creates a new instance of ViewSpy."},"signatures":[{"id":44,"name":"new ViewSpy","kind":16384,"kindString":"Constructor signature","flags":{},"comment":{"shortText":"Creates a new instance of ViewSpy."},"type":{"type":"reference","name":"ViewSpy","id":42}}]},{"id":51,"name":"attached","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":52,"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":48,"name":"bind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":49,"name":"bind","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Invoked when the target view is bound."},"parameters":[{"id":50,"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":45,"name":"created","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":46,"name":"created","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Invoked when the target view is created."},"parameters":[{"id":47,"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":53,"name":"detached","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":54,"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":55,"name":"unbind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":56,"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":[43]},{"title":"Methods","kind":2048,"children":[51,48,45,53,55]}]},{"id":62,"name":"StageComponent","kind":32,"kindString":"Variable","flags":{"isExported":true},"type":{"type":"instrinct","name":"any"}}],"groups":[{"title":"Classes","kind":128,"children":[57,2,42]},{"title":"Variables","kind":32,"children":[62]}]} | ||
{"name":"aurelia-testing","children":[{"id":56,"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":57,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"comment":{"shortText":"Creates and instanse of CompileSpy."},"signatures":[{"id":58,"name":"new CompileSpy","kind":16384,"kindString":"Constructor signature","flags":{},"comment":{"shortText":"Creates and instanse of CompileSpy."},"parameters":[{"id":59,"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":60,"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":56}}]}],"groups":[{"title":"Constructors","kind":512,"children":[57]}]},{"id":2,"name":"ComponentTester","kind":128,"kindString":"Class","flags":{"isExported":true},"children":[{"id":7,"name":"attached","kind":1024,"kindString":"Property","flags":{"isExported":true},"type":{"type":"reflection","declaration":{"id":8,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":9,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"instrinct","name":"void"}}]}}},{"id":3,"name":"bind","kind":1024,"kindString":"Property","flags":{"isExported":true},"type":{"type":"reflection","declaration":{"id":4,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":5,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":6,"name":"bindingContext","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"instrinct","name":"void"}}]}}},{"id":15,"name":"configure","kind":1024,"kindString":"Property","flags":{"isExported":true},"type":{"type":"instrinct","name":"any"}},{"id":13,"name":"element","kind":1024,"kindString":"Property","flags":{"isExported":true},"type":{"type":"reference","name":"Element"}},{"id":10,"name":"unbind","kind":1024,"kindString":"Property","flags":{"isExported":true},"type":{"type":"reflection","declaration":{"id":11,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":12,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"instrinct","name":"void"}}]}}},{"id":14,"name":"viewModel","kind":1024,"kindString":"Property","flags":{"isExported":true},"type":{"type":"instrinct","name":"any"}},{"id":16,"name":"bootstrap","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":17,"name":"bootstrap","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":18,"name":"configure","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reflection","declaration":{"id":19,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":20,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":21,"name":"aurelia","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Aurelia"}}],"type":{"type":"instrinct","name":"void"}}]}}}],"type":{"type":"instrinct","name":"any"}}]},{"id":28,"name":"boundTo","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":29,"name":"boundTo","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":30,"name":"bindingContext","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"any"}}],"type":{"type":"reference","name":"ComponentTester","id":2}}]},{"id":33,"name":"create","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":34,"name":"create","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":35,"name":"bootstrap","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reflection","declaration":{"id":36,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"signatures":[{"id":37,"name":"__call","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":38,"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"}]}}]},{"id":39,"name":"dispose","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":40,"name":"dispose","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"instrinct","name":"any"}}]},{"id":25,"name":"inView","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":26,"name":"inView","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":27,"name":"html","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"reference","name":"ComponentTester","id":2}}]},{"id":31,"name":"manuallyHandleLifecycle","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":32,"name":"manuallyHandleLifecycle","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"reference","name":"ComponentTester","id":2}}]},{"id":22,"name":"withResources","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":23,"name":"withResources","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":24,"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":2}}]}],"groups":[{"title":"Properties","kind":1024,"children":[7,3,15,13,10,14]},{"title":"Methods","kind":2048,"children":[16,28,33,39,25,31,22]}]},{"id":41,"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":42,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"comment":{"shortText":"Creates a new instance of ViewSpy."},"signatures":[{"id":43,"name":"new ViewSpy","kind":16384,"kindString":"Constructor signature","flags":{},"comment":{"shortText":"Creates a new instance of ViewSpy."},"type":{"type":"reference","name":"ViewSpy","id":41}}]},{"id":50,"name":"attached","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":51,"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":47,"name":"bind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":48,"name":"bind","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Invoked when the target view is bound."},"parameters":[{"id":49,"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":44,"name":"created","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":45,"name":"created","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Invoked when the target view is created."},"parameters":[{"id":46,"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":52,"name":"detached","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":53,"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":54,"name":"unbind","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":55,"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":[42]},{"title":"Methods","kind":2048,"children":[50,47,44,52,54]}]},{"id":61,"name":"StageComponent","kind":32,"kindString":"Variable","flags":{"isExported":true},"type":{"type":"instrinct","name":"any"}}],"groups":[{"title":"Classes","kind":128,"children":[56,2,41]},{"title":"Variables","kind":32,"children":[61]}]} |
@@ -104,8 +104,8 @@ --- | ||
.withResources('src/my-component') | ||
.inView('<my-component name.bind="name"></my-component>') | ||
.boundTo({ name: 'Bob' }); | ||
.inView('<my-component first-name.bind="firstName"></my-component>') | ||
.boundTo({ firstName: 'Bob' }); | ||
</source-code> | ||
</code-listing> | ||
`StageCompnent` comes with one property, `withResources`, that lets you start off the staging with a fluent API. `withResources` lets you specify which resource or resources for Aurelia to register. It takes either a string for registering one single resource or an Array of strings for registering multiple resources. `inView` lets you provide the html markup to be run. This is just a standard Aurelia view where you can do all the data binding you are used to in a full-blown Aurelia application. `boundTo` lets you provide a test `viewModel` with the data that the view will get bound to. In this example, the staging of the component id done in Jasmine's `beforeEach` method in order to reuse the same setup for multiple tests. | ||
`StageComponent` comes with one property, `withResources`, that lets you start off the staging with a fluent API. `withResources` lets you specify which resource or resources for Aurelia to register. It takes either a string for registering one single resource or an Array of strings for registering multiple resources. `inView` lets you provide the html markup to be run. This is just a standard Aurelia view where you can do all the data binding you are used to in a full-blown Aurelia application. `boundTo` lets you provide a test `viewModel` with the data that the view will get bound to. In this example, the staging of the component is done in Jasmine's `beforeEach` method in order to reuse the same setup for multiple tests. | ||
@@ -112,0 +112,0 @@ 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. |
@@ -0,1 +1,12 @@ | ||
<a name="1.0.0-beta.2.0.0"></a> | ||
# [1.0.0-beta.2.0.0](https://github.com/aurelia/testing/compare/1.0.0-beta.1.0.3...v1.0.0-beta.2.0.0) (2016-07-27) | ||
### Bug Fixes | ||
* **component-tester:** call detached and unbind when disposing of tested component ([#27](https://github.com/aurelia/testing/issues/27)) ([f1585cc](https://github.com/aurelia/testing/commit/f1585cc)) | ||
* **component-tester:** handle enhance promise ([681cff2](https://github.com/aurelia/testing/commit/681cff2)) | ||
<a name="1.0.0-beta.1.0.0"></a> | ||
@@ -2,0 +13,0 @@ # [1.0.0-beta.1.0.0](https://github.com/aurelia/testing/compare/0.5.0...v1.0.0-beta.1.0.0) (2016-06-22) |
{ | ||
"name": "aurelia-testing", | ||
"version": "1.0.0-beta.1.0.3", | ||
"version": "1.0.0-beta.2.0.0", | ||
"description": "A collection of helpers for testing Aurelia apps and components.", | ||
@@ -31,14 +31,14 @@ "keywords": [ | ||
"peerDependencies": { | ||
"aurelia-templating": "^1.0.0-rc.1.0.0", | ||
"aurelia-framework": "^1.0.0-rc.1.0.0", | ||
"aurelia-dependency-injection": "^1.0.0-rc.1.0.0", | ||
"aurelia-logging": "^1.0.0-rc.1.0.0", | ||
"aurelia-pal": "^1.0.0-rc.1.0.0" | ||
"aurelia-templating": "^1.0.0", | ||
"aurelia-framework": "^1.0.0", | ||
"aurelia-dependency-injection": "^1.0.0", | ||
"aurelia-logging": "^1.0.0", | ||
"aurelia-pal": "^1.0.0" | ||
}, | ||
"dependencies": { | ||
"aurelia-dependency-injection": "^1.0.0-rc.1.0.0", | ||
"aurelia-framework": "^1.0.0-rc.1.0.0", | ||
"aurelia-logging": "^1.0.0-rc.1.0.0", | ||
"aurelia-pal": "^1.0.0-rc.1.0.0", | ||
"aurelia-templating": "^1.0.0-rc.1.0.0" | ||
"aurelia-dependency-injection": "^1.0.0", | ||
"aurelia-framework": "^1.0.0", | ||
"aurelia-logging": "^1.0.0", | ||
"aurelia-pal": "^1.0.0", | ||
"aurelia-templating": "^1.0.0" | ||
}, | ||
@@ -52,17 +52,17 @@ "devDependencies": { | ||
"dependencies": { | ||
"aurelia-templating": "^1.0.0-rc.1.0.0", | ||
"aurelia-framework": "^1.0.0-rc.1.0.0", | ||
"aurelia-dependency-injection": "^1.0.0-rc.1.0.0", | ||
"aurelia-logging": "^1.0.0-rc.1.0.0", | ||
"aurelia-pal": "^1.0.0-rc.1.0.0" | ||
"aurelia-templating": "^1.0.0", | ||
"aurelia-framework": "^1.0.0", | ||
"aurelia-dependency-injection": "^1.0.0", | ||
"aurelia-logging": "^1.0.0", | ||
"aurelia-pal": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"aurelia-tools": "^0.2.3", | ||
"babel-dts-generator": "^0.6.0", | ||
"babel-eslint": "^6.0.5", | ||
"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.10.3", | ||
"babel-plugin-transform-es2015-modules-systemjs": "^6.9.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", | ||
@@ -76,6 +76,6 @@ "babel-preset-es2015": "^6.9.0", | ||
"gulp-babel": "^6.1.2", | ||
"gulp-bump": "^2.1.0", | ||
"gulp-bump": "^2.2.0", | ||
"gulp-concat": "^2.6.0", | ||
"gulp-conventional-changelog": "^1.1.0", | ||
"gulp-eslint": "^2.0.0", | ||
"gulp-eslint": "^3.0.1", | ||
"gulp-ignore": "^2.0.1", | ||
@@ -89,12 +89,12 @@ "gulp-insert": "^0.5.0", | ||
"jasmine-core": "^2.4.1", | ||
"karma": "^0.13.22", | ||
"karma": "^1.1.2", | ||
"karma-babel-preprocessor": "^6.0.1", | ||
"karma-chrome-launcher": "^1.0.1", | ||
"karma-coverage": "^1.0.0", | ||
"karma-coverage": "^1.1.1", | ||
"karma-jasmine": "^1.0.2", | ||
"karma-jspm": "^2.1.1", | ||
"karma-jspm": "^2.2.0", | ||
"merge2": "^1.0.2", | ||
"object.assign": "^4.0.3", | ||
"object.assign": "^4.0.4", | ||
"require-dir": "^0.3.0", | ||
"run-sequence": "^1.2.1", | ||
"run-sequence": "^1.2.2", | ||
"through2": "^2.0.1", | ||
@@ -105,3 +105,3 @@ "typedoc": "^0.4.4", | ||
"vinyl-paths": "^2.1.0", | ||
"yargs": "^4.7.1" | ||
"yargs": "^4.8.1" | ||
}, | ||
@@ -108,0 +108,0 @@ "aurelia": { |
@@ -14,3 +14,2 @@ import {View} from 'aurelia-templating'; | ||
unbind: () => void; | ||
dispose: () => Promise<any>; | ||
element: Element; | ||
@@ -54,14 +53,19 @@ viewModel: any; | ||
} | ||
return aurelia.start().then(a => { | ||
let host = document.createElement('div'); | ||
host.innerHTML = this._html; | ||
document.body.appendChild(host); | ||
aurelia.enhance(this._bindingContext, host); | ||
this._rootView = aurelia.root; | ||
this.element = host.firstElementChild; | ||
if (aurelia.root.controllers.length) { | ||
this.viewModel = aurelia.root.controllers[0].viewModel; | ||
} | ||
this.dispose = () => host.parentNode.removeChild(host); | ||
return new Promise(resolve => setTimeout(() => resolve(), 0)); | ||
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)); | ||
}); | ||
}); | ||
@@ -72,2 +76,15 @@ }); | ||
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); | ||
} | ||
_prepareLifecycle() { | ||
@@ -74,0 +91,0 @@ // bind |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
344202
72
2607
Updatedaurelia-framework@^1.0.0
Updatedaurelia-logging@^1.0.0
Updatedaurelia-pal@^1.0.0
Updatedaurelia-templating@^1.0.0