Closed izelnakri closed 3 years ago
Thinking again we should probably have an in-browser compiler and and pre-compilation babel transpiler plugin for hbs
template function so new glimmerx templates could be read by node.js and deno js runtimes/environments directly. Example:
in-browser compiler: https://riot.js.org/compiler/#in-browser-compilation-with-inline-templates precompiler: https://riot.js.org/compiler/#pre-compilation
As it turns on I missed to put the hbs
template function to every integration test :facepalm:. So everything works with template imports etc which is awesome! : https://github.com/izelnakri/emberx/commit/7174badcfdd10f5363b53e4088eb35252e01a8be#diff-694dacb1c70161f6edd8614dff46205525d5f04bb3464ea2105d369bd5a447a4
Only one caveat: renderComponent()
doest include properties/context so instead of:
await render(hbs`<LinkTo @route="public.index">{{this.linkText}}</LinkTo>`);
I had to do:
await render(hbs`<LinkTo @route="public.index">{{@linkText}}</LinkTo>`);
Closing this issue now, sorry for the noise!
Hi there,
I've been experimenting with implementing
emberx/router
andemberx/test-helper
library on top ofglimmerx
: https://github.com/izelnakri/emberxCurrently there is an interesting roadblock for implementing readable and maintanable ember.js like
import { render } from 'emberx/test-helpers'
, it could be a limitation of the current API. I'll explain the situation below, feel free to let me know if there are ways to implement this behavior, currently the documentation links are down.In case if it doesn't exist, I would appreciate if we could implement it. Because otherwise it is currently not possible for one to write maintainable integration tests for
glimmerx
when theynpm their way to ember from glimmer
:Intention:
Implementation and the roadblock(s):
Issues:
How can I parse an hbs file/string dynamically to get passed in static and dynamic arguments, static html attributes, yielded test or components(that can be imported where they are defined, in another file)?
renderComponent
should accept strings or TemplateOnlyComponent with state(properties, yieldedData).renderComponent
should accept yielded data to a component, behaving more like an outlet, thus this should also work: