Skip to content

Commit

Permalink
Demonstrate bindable for aurelia/testing#77
Browse files Browse the repository at this point in the history
  • Loading branch information
tomtomau committed Oct 17, 2017
1 parent 9a8ed80 commit 61d0cda
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion skeleton-typescript-webpack/src/welcome.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
//import {computedFrom} from 'aurelia-framework';
import { bindable } from 'aurelia-framework';

export class Welcome {
heading: string = 'Welcome to the Aurelia Navigation App';
firstName: string = 'John';
@bindable() firstName: string = 'John';
lastName: string = 'Doe';
previousValue: string = this.fullName;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`WelcomeComponent should render correctly 1`] = `
"<body><div><welcome class=\\"au-target\\" au-target-id=\\"6\\">
"<body><div><welcome first-name.bind=\\"firstName\\" class=\\"au-target\\" au-target-id=\\"6\\">
<section class=\\"au-animate\\">
<h2>Welcome to the Aurelia Navigation App</h2>
<form role=\\"form\\" submit.delegate=\\"submit()\\" class=\\"au-target\\" au-target-id=\\"2\\">
Expand All @@ -15,7 +15,7 @@ exports[`WelcomeComponent should render correctly 1`] = `
</div>
<div class=\\"form-group\\">
<label>Full Name</label>
<p class=\\"help-block\\">JOHN DOE</p>
<p class=\\"help-block\\">PETER DOE</p>
</div>
<button type=\\"submit\\" class=\\"btn btn-default\\">Submit</button>
</form>
Expand Down
4 changes: 2 additions & 2 deletions skeleton-typescript-webpack/test/unit/welcome.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('WelcomeComponent', () => {
beforeEach(async () => {
component = StageComponent
.withResources(PLATFORM.moduleName('welcome'))
.inView('<welcome></welcome>')
.inView('<welcome first-name.bind="firstName"></welcome>')
.boundTo({
heading: 'Something else',
firstName: 'Peter'
Expand All @@ -25,7 +25,7 @@ describe('WelcomeComponent', () => {

it('should render first name', () => {
const nameElement = document.querySelector('#fn') as HTMLInputElement;
expect(nameElement.value).toBe('John');
expect(nameElement.value).toBe('Peter');
});

afterEach(() => {
Expand Down

0 comments on commit 61d0cda

Please sign in to comment.