-
Notifications
You must be signed in to change notification settings - Fork 18
Percy Ember Example: Dependencies Update #328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,19 @@ | ||
| # unconventional js | ||
| /blueprints/*/files/ | ||
| /vendor/ | ||
|
|
||
| # compiled output | ||
| # Compiled output | ||
| /dist/ | ||
| /tmp/ | ||
| /coverage/ | ||
|
|
||
| # dependencies | ||
| /bower_components/ | ||
| # Dependencies | ||
| /node_modules/ | ||
|
|
||
| # misc | ||
| /coverage/ | ||
| !.* | ||
| .eslintcache | ||
| # Testing output | ||
| /.nyc_output/ | ||
|
|
||
| # Build artifacts | ||
| /build/ | ||
| /public/robots.txt | ||
|
|
||
| # ember-try | ||
| /.node_modules.ember-try/ | ||
| /bower.json.ember-try | ||
| /package.json.ember-try | ||
| # Misc | ||
| .env* | ||
| .pnp* | ||
| .yarn/* |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| { | ||
| "singleQuote": true, | ||
| printWidth: 110 | ||
| "printWidth": 110 | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,10 @@ | ||
| 'use strict'; | ||
|
|
||
| module.exports = { | ||
| extends: 'octane', | ||
| extends: 'recommended', | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need to change from octane to recommended?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ember-template-lint v7.9.3 removed the 'octane' preset. Available presets are: 'recommended', '5-x-recommended', 'a11y', 'stylistic'. Octane is now the default in Ember, so 'recommended' includes all Octane rules. Using 'octane' would cause linting to FAIL with "preset not found" error |
||
| rules: { | ||
| 'no-duplicate-landmark-elements': 'off', | ||
| 'require-input-label': 'off', | ||
| 'no-autofocus-attribute': 'off', | ||
| }, | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| import { service } from '@ember/service'; | ||
| import Route from '@ember/routing/route'; | ||
|
|
||
| export default class IndexRoute extends Route { | ||
| @service repo; | ||
|
|
||
| model() { | ||
| return this.repo.findAll(); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -6,11 +6,19 @@ export default class RepoService extends Service { | |||||||||||||||||||
| data = null; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| findAll() { | ||||||||||||||||||||
| this.data ||= A(JSON.parse(window.localStorage.getItem('todos') || '[]')); | ||||||||||||||||||||
| if (!this.data) { | ||||||||||||||||||||
| this.data = A(JSON.parse(window.localStorage.getItem('todos') || '[]')); | ||||||||||||||||||||
| // Set lastId to be higher than any existing todo id | ||||||||||||||||||||
| if (this.data.length > 0) { | ||||||||||||||||||||
| this.lastId = Math.max(...this.data.map((todo) => todo.id || 0)) + 1; | ||||||||||||||||||||
| } | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
Comment on lines
+9
to
+15
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tried this change. But the tests are failing with this changes |
||||||||||||||||||||
| return this.data; | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| add(attrs) { | ||||||||||||||||||||
| // Ensure data is initialized | ||||||||||||||||||||
| this.findAll(); | ||||||||||||||||||||
| let todo = Object.assign({ id: this.lastId++ }, attrs); | ||||||||||||||||||||
| this.data.pushObject(todo); | ||||||||||||||||||||
| this.persist(); | ||||||||||||||||||||
|
|
@@ -25,4 +33,11 @@ export default class RepoService extends Service { | |||||||||||||||||||
| persist() { | ||||||||||||||||||||
| window.localStorage.setItem('todos', JSON.stringify(this.data)); | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| // Add method to reset data (useful for tests) | ||||||||||||||||||||
| reset() { | ||||||||||||||||||||
| this.data = null; | ||||||||||||||||||||
| this.lastId = 0; | ||||||||||||||||||||
| window.localStorage.removeItem('todos'); | ||||||||||||||||||||
| } | ||||||||||||||||||||
| } | ||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| /* Application styles */ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| <TodoList @todos={{this.todos}}/> | ||
| <TodoList @todos={{this.todos}} /> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,40 +1,33 @@ | ||
| <section class="todoapp"> | ||
| <header class="header"> | ||
| <section class='todoapp'> | ||
| <header class='header'> | ||
| <h1>todos</h1> | ||
| <input | ||
| class="new-todo" | ||
| {{on "keyup" this.createTodo}} | ||
| placeholder="What needs to be done?" | ||
| autofocus | ||
| > | ||
| <input class='new-todo' {{on 'keyup' this.createTodo}} placeholder='What needs to be done?' autofocus /> | ||
| </header> | ||
| {{outlet}} | ||
| {{#if (gt @model.length 0)}} | ||
| <footer class="footer"> | ||
| <span class="todo-count"><strong>{{this.remaining.length}}</strong> {{pluralize "item" this.remaining.length}} left</span> | ||
| <ul class="filters"> | ||
| <li><LinkTo @route="index" @activeClass="selected">All</LinkTo></li> | ||
| <li><LinkTo @route="active" @activeClass="selected">Active</LinkTo></li> | ||
| <li><LinkTo @route="completed" @activeClass="selected">Completed</LinkTo></li> | ||
| {{#if (gt this.model.length 0)}} | ||
| <footer class='footer'> | ||
| <span class='todo-count'><strong>{{this.remaining.length}}</strong> | ||
| {{pluralize 'item' this.remaining.length}} | ||
| left</span> | ||
| <ul class='filters'> | ||
| <li><LinkTo @route='index' @activeClass='selected'>All</LinkTo></li> | ||
| <li><LinkTo @route='active' @activeClass='selected'>Active</LinkTo></li> | ||
| <li><LinkTo @route='completed' @activeClass='selected'>Completed</LinkTo></li> | ||
| </ul> | ||
| {{#if this.completed.length}} | ||
| <button | ||
| type="button" | ||
| class="clear-completed" | ||
| {{on "click" this.clearCompleted}} | ||
| > | ||
| <button type='button' class='clear-completed' {{on 'click' this.clearCompleted}}> | ||
| Clear completed | ||
| </button> | ||
| {{/if}} | ||
| </footer> | ||
| {{/if}} | ||
| </section> | ||
| <footer class="info"> | ||
| <footer class='info'> | ||
| <p>Double-click to edit a todo</p> | ||
| <p> | ||
| Created by | ||
| <a href="http://github.com/cibernox">Miguel Camba</a>, | ||
| <a href="http://github.com/addyosmani">Addy Osmani</a> | ||
| <a href='http://github.com/cibernox'>Miguel Camba</a>, | ||
| <a href='http://github.com/addyosmani'>Addy Osmani</a> | ||
| </p> | ||
| <p>Part of <a href="http://todomvc.com">TodoMVC</a></p> | ||
| <p>Part of <a href='http://todomvc.com'>TodoMVC</a></p> | ||
| </footer> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| <TodoList @todos={{this.todos}}/> | ||
| <TodoList @todos={{this.todos}} /> |
Uh oh!
There was an error while loading. Please reload this page.