This file contains hidden or 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
| import Ember from 'ember'; | |
| import StoreService from 'ember-data/store'; | |
| import SessionService from 'my-app/pods/session/service'; | |
| import LocaleService from 'my-app/pods/locale/service'; | |
| import FooService from 'my-app/pods/foo/service'; | |
| const { Registry } = Ember; | |
| export default function buildRegistry() { | |
| let registry = new Registry(); | |
| registry.register('service:store', StoreService); |
This file contains hidden or 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
| import computed from 'ember-computed'; | |
| export function birthDateStrFor(key) { | |
| return computed(key, function() { | |
| let user = this.get(key); | |
| let format = this.get('locale.dateFormat'); | |
| let name = user.get('name'); | |
| let dob = user.get('dob').format(format); | |
| return `${name}'s birthday is on ${dob}`; | |
| }); |
This file contains hidden or 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
| import computed from 'ember-computed'; | |
| export function birthDateStrFor(key) { | |
| return computed(key, function() { | |
| let user = this.get(key); | |
| let name = user.get('name'); | |
| let dob = user.get('dob').format('DD/MM/YYYY'); | |
| return `${name}'s birthday is on ${dob}`; | |
| }); | |
| } |
This file contains hidden or 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
| import Controller from 'ember-component'; | |
| import { birthDateStrFor } from 'pods/user/utils.js' | |
| export default Controller.extend({ | |
| user: null, | |
| str: birthDateStrFor('user') | |
| }); |
This file contains hidden or 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
| module('user utils'); | |
| test('birthday string', function(assert) { | |
| assert.expect(2); | |
| let fred = EmberObject.create({ | |
| name: 'Fred', | |
| dob: moment('2015-10-23') | |
| }); | |
This file contains hidden or 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
| import { moduleFor, test } from 'ember-qunit'; | |
| // This module doesn't actually exist! | |
| moduleFor('util:user/computed', { | |
| integration: true | |
| }); |
This file contains hidden or 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
| import Ember from 'ember'; | |
| import { moduleFor, test } from 'ember-qunit'; | |
| const { getOwner } = Ember; | |
| let localeService; | |
| moduleFor('util:user/computed', { | |
| integration: true, | |
| beforeEach() { | |
| localeService = getOwner(this).lookup('service:locale'); |
This file contains hidden or 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
| import { moduleFor, test } from 'ember-qunit'; | |
| // This module MUST actually exist | |
| moduleFor('service:foo') |
This file contains hidden or 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
| <script type="text/x-handlebars" data-template-name="application"> | |
| {{#tool-tipper text='Fred Smith'}}Fred{{/tool-tipper}}<br> | |
| {{#tool-tipper text='Joe Bloggs'}}John{{/tool-tipper}}<br> | |
| {{#tool-tipper text='Jane Doe'}}Jane{{/tool-tipper}}<br> | |
| {{tool-tips}} | |
| </script> | |
| <script type="text/x-handlebars" data-template-name="components/tool-tip"> | |
| {{attrs.text}} | |
| </script> |