Skip to content

Commit

Permalink
chore(Example): Add Jest as test runner for example tests (ngrx#371)
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonroberts authored and MikeRyanDev committed Sep 16, 2017
1 parent 5c60cba commit c31573f
Show file tree
Hide file tree
Showing 24 changed files with 2,214 additions and 115 deletions.
2 changes: 1 addition & 1 deletion docs/entity/adapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ returned adapter provides many [methods](#adapter-methods) for performing operat
against the collection type. The method takes an object for configuration with 2 properties.

- `selectId`: A `method` for selecting the primary id for the collection
- `sortComparer`: A compare function used to [sort](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) the collection. The comparer function is only needed if the collection needs to be sorted before being displayed. Set to `false` to use leave the collection unsorted, which is more performant during CRUD operations.
- `sortComparer`: A compare function used to [sort](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) the collection. The comparer function is only needed if the collection needs to be sorted before being displayed. Set to `false` to leave the collection unsorted, which is more performant during CRUD operations.

Usage:

Expand Down
1 change: 1 addition & 0 deletions example-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Built with [@angular/cli](https://github.com/angular/angular-cli)
- [@angular/router](https://github.com/angular/angular) - Angular Router
- [@ngrx/db](https://github.com/ngrx/db) - RxJS powered IndexedDB for Angular apps
- [@ngrx/store-devtools](https://github.com/ngrx/store-devtools) - Instrumentation for @ngrx/store enabling time-travel debugging
- [jest](https://facebook.github.io/jest/) - JavaScript test runner with easy setup, isolated browser testing and snapshot testing

### Quick start

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

exports[`Login Page should compile 1`] = `
<bc-login-form
form={[Function FormGroup]}
submitted={[Function EventEmitter]}
>
<md-card
_ngcontent-c0=""
>
<md-card-title
_ngcontent-c0=""
>
Login
</md-card-title>
<md-card-content
_ngcontent-c0=""
>
<form
_ngcontent-c0=""
class="ng-untouched ng-pristine ng-valid"
ng-reflect-form="[object Object]"
novalidate=""
>
<p
_ngcontent-c0=""
>
<md-input-container
_ngcontent-c0=""
>
<input
_ngcontent-c0=""
class="ng-untouched ng-pristine ng-valid"
formcontrolname="username"
mdinput=""
ng-reflect-name="username"
placeholder="Username"
type="text"
/>
</md-input-container>
</p>
<p
_ngcontent-c0=""
>
<md-input-container
_ngcontent-c0=""
>
<input
_ngcontent-c0=""
class="ng-untouched ng-pristine ng-valid"
formcontrolname="password"
mdinput=""
ng-reflect-name="password"
placeholder="Password"
type="password"
/>
</md-input-container>
</p>
<p
_ngcontent-c0=""
class="loginButtons"
>
<button
_ngcontent-c0=""
md-button=""
type="submit"
>
Login
</button>
</p>
</form>
</md-card-content>
</md-card>
</bc-login-form>
`;

exports[`Login Page should disable the form if pending 1`] = `
<bc-login-form
form={[Function FormGroup]}
submitted={[Function EventEmitter]}
>
<md-card
_ngcontent-c1=""
>
<md-card-title
_ngcontent-c1=""
>
Login
</md-card-title>
<md-card-content
_ngcontent-c1=""
>
<form
_ngcontent-c1=""
class="ng-untouched ng-pristine"
ng-reflect-form="[object Object]"
novalidate=""
>
<p
_ngcontent-c1=""
>
<md-input-container
_ngcontent-c1=""
>
<input
_ngcontent-c1=""
class="ng-untouched ng-pristine"
disabled=""
formcontrolname="username"
mdinput=""
ng-reflect-name="username"
placeholder="Username"
type="text"
/>
</md-input-container>
</p>
<p
_ngcontent-c1=""
>
<md-input-container
_ngcontent-c1=""
>
<input
_ngcontent-c1=""
class="ng-untouched ng-pristine"
disabled=""
formcontrolname="password"
mdinput=""
ng-reflect-name="password"
placeholder="Password"
type="password"
/>
</md-input-container>
</p>
<p
_ngcontent-c1=""
class="loginButtons"
>
<button
_ngcontent-c1=""
md-button=""
type="submit"
>
Login
</button>
</p>
</form>
</md-card-content>
</md-card>
</bc-login-form>
`;

exports[`Login Page should display an error message if provided 1`] = `
<bc-login-form
errorMessage={[Function String]}
form={[Function FormGroup]}
submitted={[Function EventEmitter]}
>
<md-card
_ngcontent-c2=""
>
<md-card-title
_ngcontent-c2=""
>
Login
</md-card-title>
<md-card-content
_ngcontent-c2=""
>
<form
_ngcontent-c2=""
class="ng-untouched ng-pristine ng-valid"
ng-reflect-form="[object Object]"
novalidate=""
>
<p
_ngcontent-c2=""
>
<md-input-container
_ngcontent-c2=""
>
<input
_ngcontent-c2=""
class="ng-untouched ng-pristine ng-valid"
formcontrolname="username"
mdinput=""
ng-reflect-name="username"
placeholder="Username"
type="text"
/>
</md-input-container>
</p>
<p
_ngcontent-c2=""
>
<md-input-container
_ngcontent-c2=""
>
<input
_ngcontent-c2=""
class="ng-untouched ng-pristine ng-valid"
formcontrolname="password"
mdinput=""
ng-reflect-name="password"
placeholder="Password"
type="password"
/>
</md-input-container>
</p>
<p
_ngcontent-c2=""
class="loginError"
>
Invalid credentials
</p>
<p
_ngcontent-c2=""
class="loginButtons"
>
<button
_ngcontent-c2=""
md-button=""
type="submit"
>
Login
</button>
</p>
</form>
</md-card-content>
</md-card>
</bc-login-form>
`;
Loading

0 comments on commit c31573f

Please sign in to comment.