Skip to content

Commit 2dc1675

Browse files
committed
Merge branch 'feature/test-components' into develop
2 parents 855167b + d7e485b commit 2dc1675

File tree

7 files changed

+555
-350
lines changed

7 files changed

+555
-350
lines changed

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
],
5757
"testEnvironment": "node",
5858
"moduleNameMapper": {
59-
"aurelia-(.*)": "<rootDir>/node_modules/aurelia-$1"
59+
"^.*\\.scss$": "<rootDir>/test/unit/stubs/sass-stub.js"
6060
},
6161
"collectCoverage": true,
6262
"collectCoverageFrom": [
@@ -77,7 +77,7 @@
7777
"devDependencies": {
7878
"@types/cordova": "^0.0.34",
7979
"@types/i18next-browser-languagedetector": "^2.0.0",
80-
"@types/jest": "^20.0.8",
80+
"@types/jest": "^22.1.2",
8181
"@types/jquery": "^3.2.12",
8282
"@types/lodash": "^4.14.74",
8383
"@types/node": "^8.0.26",
@@ -104,8 +104,8 @@
104104
"http-server": "^0.11.1",
105105
"img-loader": "^2.0.0",
106106
"istanbul-instrumenter-loader": "^3.0.0",
107-
"jest": "^20.0.4",
108-
"jest-cli": "^20.0.4",
107+
"jest": "^22.3.0",
108+
"jest-cli": "^22.3.0",
109109
"json-loader": "^0.5.7",
110110
"loader-utils": "^1.1.0",
111111
"ncp": "^2.0.0",
@@ -116,7 +116,7 @@
116116
"protractor": "^5.1.2",
117117
"sass-loader": "^6.0.6",
118118
"style-loader": "^0.20.1",
119-
"ts-jest": "^20.0.14",
119+
"ts-jest": "^22.0.4",
120120
"ts-node": "^4.1.0",
121121
"tslib": "^1.7.1",
122122
"tslint": "^5.7.0",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<template class="show-name">
22
<h3>Custom global element</h3>
3-
<p>Your text: ${ someText }</p>
3+
<p>Your text: <span id="fn">${ someText }</span></p>
44
</template>

test/jest-pretest.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import 'aurelia-polyfills';
22
import 'isomorphic-fetch';
3-
import {Options} from 'aurelia-loader-nodejs';
4-
import {initialize} from 'aurelia-pal-nodejs';
3+
import { Options } from 'aurelia-loader-nodejs';
4+
import { globalize } from 'aurelia-pal-nodejs';
55
import * as path from 'path';
66
Options.relativeToDir = path.join(__dirname, 'unit');
7-
initialize();
7+
globalize();
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`ShowNameComponent should render correctly 1`] = `
4+
"<body><div><show-name some-text.bind=\\"firstName\\" class=\\"au-target show-name\\" au-target-id=\\"2\\">
5+
<h3>Custom global element</h3>
6+
<p>Your text: <span id=\\"fn\\">Bob</span></p>
7+
</show-name></div></body>"
8+
`;
Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,26 @@ import { bootstrap } from 'aurelia-bootstrapper';
22
import { StageComponent } from 'aurelia-testing';
33
import { PLATFORM } from 'aurelia-framework';
44

5-
describe('WelcomeComponent', () => {
5+
describe('ShowNameComponent', () => {
66
let component;
77

88
beforeEach(async () => {
99
component = StageComponent
1010
.withResources([
11-
PLATFORM.moduleName('../../src/app/modules/welcome/welcome.vm'),
12-
PLATFORM.moduleName('../../src/app/resources/converters/date-format.converter')
11+
PLATFORM.moduleName('../../src/app/resources/elements/show-name/show-name.element'),
1312
])
14-
.inView('<welcome-view-model></welcome-view-model>');
13+
.inView('<show-name some-text.bind="firstName"></show-name>')
14+
.boundTo({ firstName: 'Bob' });
1515
await component.create(bootstrap);
1616
});
1717

18-
if (jest) {
19-
xit('should render correctly', () => {
18+
it('should render correctly', () => {
2019
expect(document.body.outerHTML).toMatchSnapshot();
2120
});
22-
}
2321

24-
xit('should render first name', () => {
22+
it('should render first name', () => {
2523
const nameElement = document.querySelector('#fn') as HTMLInputElement;
26-
expect(nameElement.value).toBe('John');
24+
expect(nameElement.innerHTML).toBe('Bob');
2725
});
2826

2927
afterEach(() => {

test/unit/stubs/sass-stub.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = {}

0 commit comments

Comments
 (0)