Skip to content

Instantly share code, notes, and snippets.

@amk221
Last active November 23, 2015 13:51
Show Gist options
  • Save amk221/ec2ad9f972c46b444724 to your computer and use it in GitHub Desktop.
Save amk221/ec2ad9f972c46b444724 to your computer and use it in GitHub Desktop.
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