DEV: Upgrade our widget handlebars compiler

Now supports subexpressions such as i18n and concat, plus automatic
attaching of widgets similar to ember.
This commit is contained in:
Robin Ward
2019-05-01 18:31:01 -04:00
parent e696903c31
commit 3cb0d27d38
9 changed files with 142 additions and 110 deletions

View File

@ -204,6 +204,45 @@ widgetTest("widget attaching", {
}
});
widgetTest("magic attaching by name", {
template: `{{mount-widget widget="attach-test"}}`,
beforeEach() {
createWidget("test-embedded", { tagName: "div.embedded" });
createWidget("attach-test", {
tagName: "div.container",
template: hbs`{{test-embedded attrs=attrs}}`
});
},
test(assert) {
assert.ok(find(".container").length, "renders container");
assert.ok(find(".container .embedded").length, "renders attached");
}
});
widgetTest("custom attrs to a magic attached widget", {
template: `{{mount-widget widget="attach-test"}}`,
beforeEach() {
createWidget("testing", {
tagName: "span.value",
template: hbs`{{attrs.value}}`
});
createWidget("attach-test", {
tagName: "div.container",
template: hbs`{{testing value=(concat "hello" " " "world")}}`
});
},
test(assert) {
assert.ok(find(".container").length, "renders container");
assert.equal(find(".container .value").text(), "hello world");
}
});
widgetTest("handlebars d-icon", {
template: `{{mount-widget widget="hbs-icon-test" args=args}}`,