-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add refresh method * fix: yarn * fix: typo * fix: add missing component * fix: link to post page * feat: add tests for the refresh method * fix: remove single quotes, add newer prettier config * fix: remove useless assertions * fix: clean up tests
- Loading branch information
Showing
20 changed files
with
18,029 additions
and
13,457 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
nodeLinker: node-modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
import type RouterService from '@ember/routing/router-service'; | ||
|
||
export default interface EnginesRouterService extends Omit< | ||
RouterService, | ||
"currentRoute" | "recognize" | "recognizeAndLoad" | ||
> { | ||
export default interface EnginesRouterService | ||
extends Omit< | ||
RouterService, | ||
'currentRoute' | 'recognize' | 'recognizeAndLoad' | ||
> { | ||
isActiveExternal: RouterService['isActive']; | ||
replaceWithExternal: RouterService['replaceWith']; | ||
transitionToExternal: RouterService['transitionTo']; | ||
refreshExternal: RouterService['refresh']; | ||
urlForExternal: RouterService['urlFor']; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
singleQuote: true, | ||
overrides: [ | ||
{ | ||
files: '*.{js,ts}', | ||
options: { | ||
singleQuote: true, | ||
}, | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import Route from '@ember/routing/route'; | ||
|
||
let count = 0; | ||
|
||
export default class extends Route { | ||
model() { | ||
return { | ||
count: count++, | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
<h1>Ember Engines Demo</h1> | ||
<span class="global-refresh-counter"> | ||
{{@model.count}} | ||
</span> | ||
|
||
<LinkTo @route="routeless-engine-demo" class="routeless-engine">Routeless Engine</LinkTo> | | ||
<LinkTo @route="routable-engine-demo" class="routeable-engine">Routeable Engine</LinkTo> | | ||
<LinkTo @route="routeless-engine-demo" class="routeless-engine">Routeless Engine</LinkTo> | ||
| | ||
<LinkTo @route="routable-engine-demo" class="routeable-engine">Routeable Engine</LinkTo> | ||
| | ||
<LinkTo @route="post" @model="1" class="non-blog-post">Non-Blog Post</LinkTo> | ||
|
||
{{outlet}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<h3 class="title">Eager engine</h3> | ||
|
||
<LinkTo @route="index" @current-when="index post" class="current-when-test-link">All Posts</LinkTo> | | ||
<LinkTo @route="post">Post 1</LinkTo> | ||
<LinkTo @route="post" @model={{1}}>Post 1</LinkTo> | ||
|
||
{{outlet}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,30 @@ | ||
<div class="hello-name" ...attributes> | ||
Hello, {{@name}}! | ||
<div class='hello-name' ...attributes> | ||
<span class='greeting'> | ||
Hello, | ||
{{@name}}! | ||
</span> | ||
|
||
<button | ||
class='refresh' | ||
type='button' | ||
{{on 'click' this.refresh}} | ||
> | ||
Refresh | ||
</button> | ||
|
||
<button | ||
class='refresh-route' | ||
type='button' | ||
{{on 'click' this.refreshRoute}} | ||
> | ||
Refresh Route | ||
</button> | ||
|
||
<button | ||
class='refresh-external' | ||
type='button' | ||
{{on 'click' this.refreshExternal}} | ||
> | ||
Refresh External | ||
</button> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { inject as service } from '@ember/service'; | ||
import Route from '@ember/routing/route'; | ||
|
||
let count = 0; | ||
|
||
export default class extends Route { | ||
@service exampleService; | ||
|
||
model() { | ||
// cause a service to be instantiated, so that our tests can | ||
// confirm that it gets cleaned up | ||
this.exampleService; | ||
|
||
return { | ||
name: 'Derek Zoolander', | ||
count: count++, | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
test-app/lib/ember-chat/addon/components/spanish-greeting.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<span class="greeting">Hola</span> from {{@name}}! | ||
<button class="clicker" type="button" {{on "click" this.click}}>Clicker</button> | ||
<span class="click-count">{{this.clickCount}}</span> |
11 changes: 11 additions & 0 deletions
11
test-app/lib/ember-chat/addon/components/spanish-greeting.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import Component from '@glimmer/component'; | ||
import { tracked } from '@glimmer/tracking'; | ||
import { action } from '@ember/object'; | ||
|
||
export default class extends Component { | ||
@tracked clickCount = 0; | ||
|
||
@action click() { | ||
this.clickCount++; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
test-app/tests/acceptance/routeable-engine-demo-refresh-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { module, test } from 'qunit'; | ||
import { setupApplicationTest } from 'ember-qunit'; | ||
import { visit, find, click } from '@ember/test-helpers'; | ||
|
||
module('Acceptance | Engine Router Service | Refresh Method', function (hooks) { | ||
setupApplicationTest(hooks); | ||
|
||
test('refresh without params triggers refresh with current route', async function (assert) { | ||
await visit('/routable-engine-demo/ember-blog/new'); | ||
|
||
let counter = await find('.route-refresh-counter').textContent; | ||
await click('.refresh'); | ||
|
||
counter = parseInt(counter, 10); | ||
counter = ++counter; | ||
counter = counter.toString(); | ||
assert.dom('.route-refresh-counter').hasText(counter); | ||
}); | ||
|
||
test('refresh with params triggers refresh on provided route', async function (assert) { | ||
await visit('/routable-engine-demo/ember-blog/new'); | ||
|
||
let counter = await find('.route-refresh-counter').textContent; | ||
await click('.refresh-route'); | ||
|
||
counter = parseInt(counter, 10); | ||
counter = ++counter; | ||
counter = counter.toString(); | ||
assert.dom('.route-refresh-counter').hasText(counter); | ||
}); | ||
|
||
test('refresh external route', async function (assert) { | ||
await visit('/routable-engine-demo/ember-blog/new'); | ||
|
||
let counter = await find('.route-refresh-counter').textContent; | ||
await click('.refresh-external'); | ||
|
||
counter = parseInt(counter, 10); | ||
counter = ++counter; | ||
counter = counter.toString(); | ||
assert.dom('.global-refresh-counter').hasText(counter); | ||
}); | ||
}); |
Oops, something went wrong.