Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing tests #49

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 25 additions & 24 deletions .dojorc
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
{
"extends": "./src/parade.json",
"build-app": {
"singleBundle": true,
"externals": {
"outputPath": ".",
"dependencies": [
{
"from": "node_modules/intern/browser/intern.js",
"to": "browser/intern.js"
},
{
"from": "node_modules/intern/browser/config.js",
"to": "browser/config.js"
},
{
"from": "node_modules/intern/loaders/default.js",
"to": "intern/loaders/default.js"
},
{
"from": "node_modules/intern/loaders/default.js",
"to": "loaders/default.js"
},
{
"from": "node_modules/intern/index.html",
"to": "intern/index.html"
},
{
"from": "intern",
"to": "intern"
}
{
"from": "node_modules/intern/browser/intern.js",
"to": "intern/browser/intern.js"
},
{
"from": "node_modules/intern/browser/config.js",
"to": "intern/browser/config.js"
},
{
"from": "node_modules/intern/loaders/default.js",
"to": "intern/loaders/default.js"
},
{
"from": "node_modules/intern/loaders/default.js",
"to": "loaders/default.js"
},
{
"from": "node_modules/intern/index.html",
"to": "intern/index.html"
},
{
"from": "intern",
"to": "intern"
}
]
}
},
Expand Down
30 changes: 21 additions & 9 deletions src/Test.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,31 @@
import { create, tsx } from '@dojo/framework/core/vdom';
import { createICacheMiddleware } from '@dojo/framework/core/middleware/icache';

const factory = create().properties<{ widgetName: string }>();
interface TestIcache {
mainUrl?: string;
}
const icache = createICacheMiddleware<TestIcache>();
const factory = create({ icache }).properties<{ widgetName: string }>();

export default factory(function Test({ properties }) {
export default factory(function Test({ properties, middleware: { icache } }) {
const { widgetName } = properties();
const fetchPromise = import('@dojo/framework/shim/fetch');
const mainUrl = icache.getOrSet('mainUrl', () => fetchPromise.then(({ default: fetch }) => fetch('manifest.json')
.then(result => result && result.ok && result.json())
.then(json => json && json['main.js'])
.catch()));
return (
<div>
<h2 classes="text-2xl mb-4">Tests</h2>
<iframe
classes="w-full iframe"
onload={
"this.style.height=(this.contentDocument.body.scrollHeight || 10000) +'px';" as any
}
src={`./intern?config=intern/intern.json&widget=${widgetName}`}
/>
{mainUrl && (
<iframe
classes="w-full iframe"
onload={
"this.style.height=(this.contentDocument.body.scrollHeight || 10000) +'px';" as any
}
src={`./intern?basePath=..&${encodeURI('plugins=./intern/reporter.js')}&widget=${widgetName}&suites=${encodeURI(mainUrl)}`}
/>
)}
</div>
);
});
5 changes: 3 additions & 2 deletions src/parade.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"build-app": {
"singleBundle": true,
"experimental": {
"speed": true
},
Expand Down Expand Up @@ -29,11 +30,11 @@
"dependencies": [
{
"from": "node_modules/intern/browser/intern.js",
"to": "browser/intern.js"
"to": "intern/browser/intern.js"
},
{
"from": "node_modules/intern/browser/config.js",
"to": "browser/config.js"
"to": "intern/browser/config.js"
},
{
"from": "node_modules/intern/loaders/default.js",
Expand Down