-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE default helper manager] Add the default helper manager
This updates the Glimmer VM to version 0.84.1 which includes the default helper manager and a feature flag to conditionally enable that feature in Ember.
- Loading branch information
Showing
6 changed files
with
228 additions
and
171 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
79 changes: 79 additions & 0 deletions
79
packages/@ember/-internals/glimmer/tests/integration/helpers/default-helper-manager-test.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import { RenderingTestCase, moduleFor, runTask } from 'internal-test-helpers'; | ||
import { Component } from '@ember/-internals/glimmer'; | ||
|
||
moduleFor( | ||
'Helpers test: default helper manager', | ||
class extends RenderingTestCase { | ||
'@feature(EMBER_DEFAULT_HELPER_MANAGER) plain functions can be used as a helper'() { | ||
function hello() { | ||
return 'hello'; | ||
} | ||
|
||
this.render('{{(this.hello)}}', { | ||
hello, | ||
}); | ||
|
||
this.assertText('hello'); | ||
|
||
runTask(() => this.rerender()); | ||
|
||
this.assertText('hello'); | ||
} | ||
|
||
'@feature(EMBER_DEFAULT_HELPER_MANAGER) plain functions passed as component arguments can be used as helpers'() { | ||
function hello() { | ||
return 'hello'; | ||
} | ||
|
||
this.registerComponent('foo-bar', { template: '{{(@hello)}}' }); | ||
|
||
this.render(`<FooBar @hello={{this.hello}} />`, { | ||
hello, | ||
}); | ||
|
||
this.assertText('hello'); | ||
|
||
runTask(() => this.rerender()); | ||
|
||
this.assertText('hello'); | ||
} | ||
|
||
'@feature(EMBER_DEFAULT_HELPER_MANAGER) plain functions stored on component properties can be used as helpers'() { | ||
this.registerComponent('foo-bar', { | ||
template: '{{(this.hello)}}', | ||
ComponentClass: class extends Component { | ||
hello = () => { | ||
return 'hello'; | ||
}; | ||
}, | ||
}); | ||
|
||
this.render(`<FooBar />`); | ||
|
||
this.assertText('hello'); | ||
|
||
runTask(() => this.rerender()); | ||
|
||
this.assertText('hello'); | ||
} | ||
|
||
'@feature(EMBER_DEFAULT_HELPER_MANAGER) Class methods can be used as helpers'() { | ||
this.registerComponent('foo-bar', { | ||
template: '{{(this.hello)}}', | ||
ComponentClass: class extends Component { | ||
hello() { | ||
return 'hello'; | ||
} | ||
}, | ||
}); | ||
|
||
this.render(`<FooBar />`); | ||
|
||
this.assertText('hello'); | ||
|
||
runTask(() => this.rerender()); | ||
|
||
this.assertText('hello'); | ||
} | ||
} | ||
); |
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
Oops, something went wrong.