8000 add test suite (#15) · json-api-dotnet/TodoListExample@3c71991 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3c71991

Browse files
add test suite (#15)
1 parent c56be6c commit 3c71991

File tree

29 files changed

+544
-153
lines changed

29 files changed

+544
-153
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ docker run --name TodoListSampleDb \
5555

5656
In case you haven't watched the videos: the default username/password is `guest`/`Guest1!`.
5757

58+
## Running Client Tests
59+
60+
* `ember test`
61+
* `ember test --server`
62+
5863
## Updating to the latest version of Ember
5964

6065
Usually the following commands are sufficient

TodoListClient/.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
!.*
1616
.*/
1717
.eslintcache
18+
/mirage/mirage
1819

1920
# ember-try
2021
/.node_modules.ember-try/

TodoListClient/.eslintrc.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,14 @@ module.exports = {
2222
env: {
2323
browser: true,
2424
},
25-
rules: {},
25+
rules: {
26+
'prettier/prettier': [
27+
'error',
28+
{
29+
endOfLine: 'auto',
30+
},
31+
],
32+
},
2633
overrides: [
2734
// node files
2835
{

TodoListClient/.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
!.*
1616
.eslintcache
1717
.lint-todo/
18+
server
1819

1920
# ember-try
2021
/.node_modules.ember-try/

TodoListClient/app/components/forms/login-form/template.hbs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
<img class="mb-4" src="assets/images/logo.png" alt="" role="presentation" width="108" height="108">
44
<h1 class="h3 mb-3 fw-normal">Please sign in</h1>
55
<div class="form-floating">
6-
<Input id="identification" @type="text" class="form-control" placeholder="Enter Login"
6+
<Input data-test-username id="identification" @type="text" class="form-control" placeholder="Enter Login"
77
@value={{this.identification}} autocomplete="username" />
88
<label for="identification">Login</label>
99
</div>
1010
<div class="form-floating mb-3">
11-
<Input id="password" @type="password" class="form-control" placeholder="Enter Password" @value={{this.password}}
11+
<Input data-test-password id="password" @type="password" class="form-control" placeholder="Enter Password" @value={{this.password}}
1212
autocomplete="current-password" />
1313
<label for="password">Password</label>
1414
</div>
15-
<button type="submit" class="w-100 btn btn-lg btn-primary">Login</button>
15+
<button data-test-submit type="submit" class="w-100 btn btn-lg btn-primary">Login</button>
1616
</form>
1717
</main>

TodoListClient/app/components/forms/todo-item-form/template.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<form {{on "submit" this.save}}>
33
<div class="mb-3">
44
<label for="description" class="form-label">Description</label>
5-
<Input id="description" class="form-control" placeholder="description" @value={{@todoItem.description}} />
5+
<Input data-test-description-input id="description" class="form-control" placeholder="description" @value={{@todoItem.description}} />
66
</div>
7-
<button class="btn btn-primary" type="submit">Add Todo Item</button>
7+
<button data-test-submit class="btn btn-primary" type="submit">Add Todo Item</button>
88
</form>

TodoListClient/app/components/navbar.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Todo List Client
55
</span>
66
<div class="d-flex">
7-
<a href="#" {{on "click" @invalidateSession}} class="btn btn-outline-primary">Logout</a>
7+
<a data-test-logout href="#" {{on "click" @invalidateSession}} class="btn btn-outline-primary">Logout</a>
88
</div>
99
</div>
1010
</nav>

TodoListClient/app/models/person.js

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 2 add 2851 itions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import Model, { belongsTo, attr } from '@ember-data/model';
1+
import Model, { attr } from '@ember-data/model';
22

33
export default class TodoItemModel extends Model {
4-
@attr description;
5-
@belongsTo('person', { async: true, inverse: null }) person;
4+
@attr('string') description;
65
}

TodoListClient/app/templates/s/todo-items/index.hbs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
<tr>
55
<th>Description</th>
66
<th class="text-end">
7-
<LinkTo @route="s.todo-items.add" class="btn btn-primary">Add Todo Item</LinkTo>
7+
<LinkTo data-test-add @route="s.todo-items.add" class="btn btn-primary">Add Todo Item</LinkTo>
88
</th>
99
</tr>
1010
</thead>
1111
<tbody>
1212
{{#each this.model as |todoItem|}}
13-
<tr>
14-
<td colspan="2">{{todoItem.description}}</td>
13+
<tr data-test-item={{todoItem.id}}>
14+
<td data-test-description colspan="2">{{todoItem.description}}</td>
1515
</tr>
1616
{{/each}}
1717
</tbody>

0 commit comments

Comments
 (0)
0