Skip to content

Commit 986cc26

Browse files
committed
fix(dumber): cleanup tests, fix css-module tests
1 parent 4b5184a commit 986cc26

File tree

6 files changed

+85
-205
lines changed

6 files changed

+85
-205
lines changed

app-min/test/my-app.spec.ext

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
// @if ava
2+
import test from 'ava';
3+
// @endif
4+
// @if tape
5+
import test from 'tape';
6+
// @endif
7+
// @if mocha
8+
import { expect } from 'chai';
9+
// @endif
10+
import Aurelia, { /* @if shadow-dom-open || shadow-dom-closed || css-module */StyleConfiguration, /* @endif */CustomElement } from 'aurelia';
11+
import { MyApp } from '../src/my-app';
12+
13+
// @if babel
14+
function createAu(template, ...deps) {
15+
// @endif
16+
// @if typescript
17+
function createAu(template: string, ...deps: readonly unknown[]): Aurelia {
18+
// @endif
19+
const wrapper = CustomElement.define({name: 'wrapper', template});
20+
document.body.appendChild(document.createElement('wrapper'));
21+
return Aurelia/* @if shadow-dom-open || shadow-dom-closed */.register(StyleConfiguration.shadowDOM())/* @endif *//* @if css-module */.register(StyleConfiguration.cssModulesProcessor())/* @endif */.register(deps).app(wrapper);
22+
}
23+
24+
function cleanup() {
25+
const wrapper = document.querySelector('wrapper');
26+
if (wrapper) wrapper.remove();
27+
}
28+
29+
// @if ava || tape
30+
test('my-app: should render message', async t => {
31+
const au = createAu('<my-app></my-app>', MyApp);
32+
await au.start().wait();
33+
const node = document.querySelector('my-app');
34+
// @if shadow-dom-open
35+
const text = node.shadowRoot.textContent;
36+
// @endif
37+
// @if shadow-dom-closed
38+
const text = CustomElement.for(node).projector.shadowRoot.textContent;
39+
// @endif
40+
// @if !shadow-dom-open && !shadow-dom-closed
41+
const text = node.textContent;
42+
// @endif
43+
// @if ava
44+
t.is(text.trim(), 'Hello World!');
45+
// @endif
46+
// @if tape
47+
t.equal(text.trim(), 'Hello World!');
48+
// @endif
49+
await au.stop().wait();
50+
cleanup();
51+
// @if tape
52+
t.end();
53+
// @endif
54+
});
55+
// @endif
56+
// @if jasmine || jest || mocha
57+
describe('my-app', () => {
58+
afterEach(() => {
59+
cleanup();
60+
});
61+
62+
it('should render message', async () => {
63+
const au = createAu('<my-app></my-app>', MyApp);
64+
await au.start().wait();
65+
const node = document.querySelector('my-app');
66+
// @if shadow-dom-open
67+
const text = node.shadowRoot.textContent;
68+
// @endif
69+
// @if shadow-dom-closed
70+
const text = CustomElement.for(node).projector.shadowRoot.textContent;
71+
// @endif
72+
// @if !shadow-dom-open && !shadow-dom-closed
73+
const text = node.textContent;
74+
// @endif
75+
// @if jasmine || jest
76+
expect(text.trim()).toBe('Hello World!');
77+
// @endif
78+
// @if mocha
79+
expect(text.trim()).to.equal('Hello World!');
80+
// @endif
81+
await au.stop().wait();
82+
cleanup();
83+
});
84+
});
85+
// @endif

app-min/test__if_ava/my-app.spec.ext

Lines changed: 0 additions & 37 deletions
This file was deleted.

app-min/test__if_jasmine/my-app.spec.ext

Lines changed: 0 additions & 43 deletions
This file was deleted.

app-min/test__if_jest/my-app.spec.ext

Lines changed: 0 additions & 43 deletions
This file was deleted.

app-min/test__if_mocha/my-app.spec.ext

Lines changed: 0 additions & 44 deletions
This file was deleted.

app-min/test__if_tape/my-app.spec.ext

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)