Skip to content

Commit

Permalink
fix(tests/dummy/app): removes `application-controller.router-properti…
Browse files Browse the repository at this point in the history
…es` deprecations.
  • Loading branch information
matthewhartstonge committed Oct 29, 2024
1 parent 5b8cf57 commit 5aa21b0
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 40 deletions.
13 changes: 8 additions & 5 deletions tests/dummy/app/controllers/application.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
/* eslint-disable ember/no-actions-hash, prettier/prettier */
/* eslint-disable ember/no-actions-hash */
import { equal } from '@ember/object/computed';
import Controller from '@ember/controller';
import { computed } from '@ember/object';
import { inject as service } from '@ember/service';

export default Controller.extend({
router: service(),

actions: {
toggleExpandedItem(value, ev) {
if (this.expandedItem === value) {
value = null;
}
this.set('expandedItem', value);
ev.stopPropagation();
}
},
},

expandedItem: computed('currentRouteName', function() {
if (this.currentRouteName.substr(0, 6) === 'layout') {
expandedItem: computed('router.currentRouteName', function () {
if (this.router.currentRouteName.substr(0, 6) === 'layout') {
return 'layout';
} else {
return 'demos';
}
}),

demosExpanded: equal('expandedItem', 'demos'),
layoutExpanded: equal('expandedItem', 'layout')
layoutExpanded: equal('expandedItem', 'layout'),
});
68 changes: 34 additions & 34 deletions tests/dummy/app/templates/application.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -11,54 +11,54 @@
<PaperContent>

<PaperList>
<MenuItem @active={{is-active "index" this.currentRouteName}} @href={{href-to "index"}}>Introduction</MenuItem>
<MenuItem @active={{is-active "index" this.router.currentRouteName}} @href={{href-to "index"}}>Introduction</MenuItem>

<MenuItem @onClick={{action "toggleExpandedItem" "demos"}} @expanded={{this.demosExpanded}} @canExpand={{true}}>Components</MenuItem>

<div class="submenu">
{{#liquid-if this.demosExpanded}}
<SubmenuItem @active={{is-active "demo.autocomplete" this.currentRouteName}} @href={{href-to "demo.autocomplete"}}>Autocomplete</SubmenuItem>
<SubmenuItem @active={{is-active "demo.button" this.currentRouteName}} @href={{href-to "demo.button"}}>Button</SubmenuItem>
<SubmenuItem @active={{is-active "demo.card" this.currentRouteName}} @href={{href-to "demo.card"}}>Card</SubmenuItem>
<SubmenuItem @active={{is-active "demo.checkbox" this.currentRouteName}} @href={{href-to "demo.checkbox"}}>Checkbox</SubmenuItem>
<SubmenuItem @active={{is-active "demo.chips" this.currentRouteName}} @href={{href-to "demo.chips"}}>Chips</SubmenuItem>
<SubmenuItem @active={{is-active "demo.dialog" this.currentRouteName}} @href={{href-to "demo.dialog"}}>Dialog</SubmenuItem>
<SubmenuItem @active={{is-active "demo.divider" this.currentRouteName}} @href={{href-to "demo.divider"}}>Divider</SubmenuItem>
<SubmenuItem @active={{is-active "demo.grid-list" this.currentRouteName}} @href={{href-to "demo.grid-list"}}>Grid List</SubmenuItem>
<SubmenuItem @active={{is-active "demo.icons" this.currentRouteName}} @href={{href-to "demo.icons"}}>Icons</SubmenuItem>
<SubmenuItem @active={{is-active "demo.input" this.currentRouteName}} @href={{href-to "demo.input"}}>Input</SubmenuItem>
<SubmenuItem @active={{is-active "demo.list" this.currentRouteName}} @href={{href-to "demo.list"}}>List</SubmenuItem>
<SubmenuItem @active={{is-active "demo.menu" this.currentRouteName}} @href={{href-to "demo.menu"}}>Menu</SubmenuItem>
<SubmenuItem @active={{is-active "demo.progress-circular" this.currentRouteName}} @href={{href-to "demo.progress-circular"}}>Progress Circular</SubmenuItem>
<SubmenuItem @active={{is-active "demo.progress-linear" this.currentRouteName}} @href={{href-to "demo.progress-linear"}}>Progress Linear</SubmenuItem>
<SubmenuItem @active={{is-active "demo.radio" this.currentRouteName}} @href={{href-to "demo.radio"}}>Radio</SubmenuItem>
<SubmenuItem @active={{is-active "demo.select" this.currentRouteName}} @href={{href-to "demo.select"}}>Select</SubmenuItem>
<SubmenuItem @active={{is-active "demo.sidenav" this.currentRouteName}} @href={{href-to "demo.sidenav"}}>Sidenav</SubmenuItem>
<SubmenuItem @active={{is-active "demo.slider" this.currentRouteName}} @href={{href-to "demo.slider"}}>Slider</SubmenuItem>
<SubmenuItem @active={{is-active "demo.speed-dial" this.currentRouteName}} @href={{href-to "demo.speed-dial"}}>Speed Dial</SubmenuItem>
<SubmenuItem @active={{is-active "demo.switch" this.currentRouteName}} @href={{href-to "demo.switch"}}>Switch</SubmenuItem>
<SubmenuItem @active={{is-active "demo.tabs.index" this.currentRouteName}} @href={{href-to "demo.tabs"}}>Tabs</SubmenuItem>
<SubmenuItem @active={{is-active "demo.toast" this.currentRouteName}} @href={{href-to "demo.toast"}}>Toast</SubmenuItem>
<SubmenuItem @active={{is-active "demo.toolbar" this.currentRouteName}} @href={{href-to "demo.toolbar"}}>Toolbar</SubmenuItem>
<SubmenuItem @active={{is-active "demo.tooltip" this.currentRouteName}} @href={{href-to "demo.tooltip"}}>Tooltip</SubmenuItem>
<SubmenuItem @active={{is-active "demo.autocomplete" this.router.currentRouteName}} @href={{href-to "demo.autocomplete"}}>Autocomplete</SubmenuItem>
<SubmenuItem @active={{is-active "demo.button" this.router.currentRouteName}} @href={{href-to "demo.button"}}>Button</SubmenuItem>
<SubmenuItem @active={{is-active "demo.card" this.router.currentRouteName}} @href={{href-to "demo.card"}}>Card</SubmenuItem>
<SubmenuItem @active={{is-active "demo.checkbox" this.router.currentRouteName}} @href={{href-to "demo.checkbox"}}>Checkbox</SubmenuItem>
<SubmenuItem @active={{is-active "demo.chips" this.router.currentRouteName}} @href={{href-to "demo.chips"}}>Chips</SubmenuItem>
<SubmenuItem @active={{is-active "demo.dialog" this.router.currentRouteName}} @href={{href-to "demo.dialog"}}>Dialog</SubmenuItem>
<SubmenuItem @active={{is-active "demo.divider" this.router.currentRouteName}} @href={{href-to "demo.divider"}}>Divider</SubmenuItem>
<SubmenuItem @active={{is-active "demo.grid-list" this.router.currentRouteName}} @href={{href-to "demo.grid-list"}}>Grid List</SubmenuItem>
<SubmenuItem @active={{is-active "demo.icons" this.router.currentRouteName}} @href={{href-to "demo.icons"}}>Icons</SubmenuItem>
<SubmenuItem @active={{is-active "demo.input" this.router.currentRouteName}} @href={{href-to "demo.input"}}>Input</SubmenuItem>
<SubmenuItem @active={{is-active "demo.list" this.router.currentRouteName}} @href={{href-to "demo.list"}}>List</SubmenuItem>
<SubmenuItem @active={{is-active "demo.menu" this.router.currentRouteName}} @href={{href-to "demo.menu"}}>Menu</SubmenuItem>
<SubmenuItem @active={{is-active "demo.progress-circular" this.router.currentRouteName}} @href={{href-to "demo.progress-circular"}}>Progress Circular</SubmenuItem>
<SubmenuItem @active={{is-active "demo.progress-linear" this.router.currentRouteName}} @href={{href-to "demo.progress-linear"}}>Progress Linear</SubmenuItem>
<SubmenuItem @active={{is-active "demo.radio" this.router.currentRouteName}} @href={{href-to "demo.radio"}}>Radio</SubmenuItem>
<SubmenuItem @active={{is-active "demo.select" this.router.currentRouteName}} @href={{href-to "demo.select"}}>Select</SubmenuItem>
<SubmenuItem @active={{is-active "demo.sidenav" this.router.currentRouteName}} @href={{href-to "demo.sidenav"}}>Sidenav</SubmenuItem>
<SubmenuItem @active={{is-active "demo.slider" this.router.currentRouteName}} @href={{href-to "demo.slider"}}>Slider</SubmenuItem>
<SubmenuItem @active={{is-active "demo.speed-dial" this.router.currentRouteName}} @href={{href-to "demo.speed-dial"}}>Speed Dial</SubmenuItem>
<SubmenuItem @active={{is-active "demo.switch" this.router.currentRouteName}} @href={{href-to "demo.switch"}}>Switch</SubmenuItem>
<SubmenuItem @active={{is-active "demo.tabs.index" this.router.currentRouteName}} @href={{href-to "demo.tabs"}}>Tabs</SubmenuItem>
<SubmenuItem @active={{is-active "demo.toast" this.router.currentRouteName}} @href={{href-to "demo.toast"}}>Toast</SubmenuItem>
<SubmenuItem @active={{is-active "demo.toolbar" this.router.currentRouteName}} @href={{href-to "demo.toolbar"}}>Toolbar</SubmenuItem>
<SubmenuItem @active={{is-active "demo.tooltip" this.router.currentRouteName}} @href={{href-to "demo.tooltip"}}>Tooltip</SubmenuItem>
{{/liquid-if}}
</div>
<MenuItem @active={{is-active "forms" this.currentRouteName}} @href={{href-to "forms"}}>Forms</MenuItem>
<MenuItem @active={{is-active "typography" this.currentRouteName}} @href={{href-to "typography"}}>Typography</MenuItem>
<MenuItem @active={{is-active "theme" this.currentRouteName}} @href={{href-to "theme"}}>Color & Theme</MenuItem>
<MenuItem @active={{is-active "forms" this.router.currentRouteName}} @href={{href-to "forms"}}>Forms</MenuItem>
<MenuItem @active={{is-active "typography" this.router.currentRouteName}} @href={{href-to "typography"}}>Typography</MenuItem>
<MenuItem @active={{is-active "theme" this.router.currentRouteName}} @href={{href-to "theme"}}>Color & Theme</MenuItem>

<MenuItem @onClick={{action "toggleExpandedItem" "layout"}} @expanded={{this.layoutExpanded}} @canExpand={{true}}>Layout</MenuItem>
<div class="submenu">
{{#liquid-if this.layoutExpanded}}
<SubmenuItem @active={{is-active "layout.introduction" this.currentRouteName}} @href={{href-to "layout.introduction"}}>Introduction</SubmenuItem>
<SubmenuItem @active={{is-active "layout.layout-containers" this.currentRouteName}} @href={{href-to "layout.layout-containers"}}>Layout Containers</SubmenuItem>
<SubmenuItem @active={{is-active "layout.layout-children" this.currentRouteName}} @href={{href-to "layout.layout-children"}}>Layout Children</SubmenuItem>
<SubmenuItem @active={{is-active "layout.child-alignment" this.currentRouteName}} @href={{href-to "layout.child-alignment"}}>Child Alignment</SubmenuItem>
<SubmenuItem @active={{is-active "layout.introduction" this.router.currentRouteName}} @href={{href-to "layout.introduction"}}>Introduction</SubmenuItem>
<SubmenuItem @active={{is-active "layout.layout-containers" this.router.currentRouteName}} @href={{href-to "layout.layout-containers"}}>Layout Containers</SubmenuItem>
<SubmenuItem @active={{is-active "layout.layout-children" this.router.currentRouteName}} @href={{href-to "layout.layout-children"}}>Layout Children</SubmenuItem>
<SubmenuItem @active={{is-active "layout.child-alignment" this.router.currentRouteName}} @href={{href-to "layout.child-alignment"}}>Child Alignment</SubmenuItem>
{{/liquid-if}}
</div>

<MenuItem @active={{is-active "cookbook" this.currentRouteName}} @href={{href-to "cookbook"}}>Cookbook</MenuItem>
<MenuItem @active={{is-active "addons" this.currentRouteName}} @href={{href-to "addons"}}>Addons</MenuItem>
<MenuItem @active={{is-active "cookbook" this.router.currentRouteName}} @href={{href-to "cookbook"}}>Cookbook</MenuItem>
<MenuItem @active={{is-active "addons" this.router.currentRouteName}} @href={{href-to "addons"}}>Addons</MenuItem>
</PaperList>

</PaperContent>
Expand Down
2 changes: 1 addition & 1 deletion tests/dummy/app/templates/demo/tabs.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
<div class="doc-content-example">
<PaperContent>
{{! BEGIN-SNIPPET routable-usage}}
<PaperTabs @selected={{this.currentRouteName}} @borderBottom={{true}} @onChange={{action "noop"}} as |tabs|>
<PaperTabs @selected={{this.router.currentRouteName}} @borderBottom={{true}} @onChange={{action "noop"}} as |tabs|>
<tabs.tab @value="demo.tabs.index" @href={{href-to "demo.tabs.index"}}>
Index
</tabs.tab>
Expand Down

0 comments on commit 5aa21b0

Please sign in to comment.