Created
April 16, 2016 02:18
-
-
Save offirgolan/824f78c43d35ef135269446452865a9d to your computer and use it in GitHub Desktop.
New Twiddle
This file contains 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'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle' | |
}); |
This file contains 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 Resolver from '../../resolver'; | |
import config from '../../config/environment'; | |
const resolver = Resolver.create(); | |
resolver.namespace = { | |
modulePrefix: config.modulePrefix, | |
podModulePrefix: config.podModulePrefix | |
}; | |
export default resolver; |
This file contains 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 resolver from './helpers/resolver'; | |
import { | |
setResolver | |
} from 'ember-qunit'; | |
setResolver(resolver); |
This file contains 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 { module, test } from 'qunit'; | |
import shouldCallSuper from '../../../utils/should-call-super'; | |
const { | |
computed | |
} = Ember; | |
module('Unit | Utils | shouldCallSuper'); | |
test('shouldCallSuper - true', function(assert) { | |
const Parent = Ember.Object.extend({ | |
foo: computed(function() {}) | |
}); | |
const Child = Parent.extend({ | |
foo: computed(function() { | |
assert.ok(shouldCallSuper(this, 'foo')); | |
}) | |
}); | |
const child = Child.create(); | |
child.get('foo'); | |
}); | |
test('shouldCallSuper - false', function(assert) { | |
const Parent = Ember.Object.extend(); | |
const Child = Parent.extend({ | |
foo: computed('bar', function() { | |
assert.ok(!shouldCallSuper(this, 'foo')); | |
}) | |
}); | |
const child = Child.create(); | |
child.get('foo'); | |
}); | |
This file contains 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
{ | |
"version": "0.7.2", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": true | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.4.4/ember.debug.js", | |
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.4.3/ember-data.js", | |
"ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.4.4/ember-template-compiler.js" | |
} | |
} |
This file contains 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
export default function shouldCallSuper(obj, key) { | |
let current = obj; | |
while (current) { | |
let descriptor = Object.getOwnPropertyDescriptor(current, key); | |
if (descriptor) { | |
return true; | |
} | |
current = Object.getPrototypeOf(current); | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment