-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from Ticketfly/0.2
use an exposed initializer
- Loading branch information
Showing
6 changed files
with
57 additions
and
8 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
import { hook, $hook } from './test-helpers/hook'; | ||
import HookMixin from './mixins/hook'; | ||
import { hook, $hook } from './test-helpers/hook'; | ||
import { initialize } from './initializers/ember-hook/initialize'; | ||
|
||
export { | ||
hook, | ||
HookMixin, | ||
$hook, | ||
HookMixin | ||
hook, | ||
initialize | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import Ember from 'ember'; | ||
import HookMixin from '../../mixins/hook'; | ||
|
||
const { Component } = Ember; | ||
|
||
export function initialize() { | ||
Component.reopen(HookMixin); | ||
} | ||
|
||
export default { | ||
name: 'ember-hook/initialize', | ||
initialize: initialize | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default, initialize } from 'ember-hook/initializers/ember-hook/initialize'; |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import Ember from 'ember'; | ||
import { initialize } from 'ember-hook'; | ||
import { module, test } from 'qunit'; | ||
|
||
var registry, application; | ||
|
||
module('Unit | Initializer | ember hook/initialize', { | ||
beforeEach: function() { | ||
Ember.run(function() { | ||
application = Ember.Application.create(); | ||
registry = application.registry; | ||
application.deferReadiness(); | ||
}); | ||
} | ||
}); | ||
|
||
test('applies the `HookMixin` to `Component`', function(assert) { | ||
assert.expect(2); | ||
|
||
initialize(); | ||
|
||
const { Component } = Ember; | ||
const component = Component.create({ hook: 'foo' }); | ||
|
||
assert.deepEqual(component.get('attributeBindings'), ['ariaRole:role', '_hookName:data-test'], 'adds _hookName to the attributeBindings'); | ||
assert.equal(component.get('_hookName'), 'foo', 'adds the _hookName computed'); | ||
}); |