Last active
November 23, 2015 13:51
-
-
Save amk221/ec2ad9f972c46b444724 to your computer and use it in GitHub Desktop.
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'); | |
| } | |
| }); | |
| test('localised birthday string', function(assert) { | |
| assert.expect(2); | |
| let fred = EmberObject.create({ | |
| name: 'Fred', | |
| dob: moment('2015-10-23') | |
| }); | |
| let MyObject = EmberObject.extend({ | |
| user: null, | |
| str: birthDateStrFor('user') | |
| }); | |
| let myObject = MyObject.create({ fred }); | |
| assert.equal(obj.get('str'), "Fred's birthday is on 23/10/2015", | |
| 'computes a birthday string'); | |
| localeService.set('code', 'en_US'); | |
| assert.equal(obj.get('str'), "Fred's birthday is on 10/23/2015", | |
| 'formats the date according to the locale'); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment