Last active
November 23, 2015 13:52
-
-
Save amk221/9fc8946d269a9da4b187 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
| module('user utils'); | |
| test('birthday string', function(assert) { | |
| assert.expect(2); | |
| let fred = EmberObject.create({ | |
| name: 'Fred', | |
| dob: moment('2015-10-23') | |
| }); | |
| let john = EmberObject.create({ | |
| name: 'John', | |
| dob: moment('2014-01-19') | |
| }) | |
| 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'); | |
| myObject.set('user', 'john'); | |
| assert.equal(obj.get('str'), "John's birthday is on 19/01/2014", | |
| 'string is recomputed when the dependant user changes'); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment