Skip to content

Commit

Permalink
Remove pointless alias
Browse files Browse the repository at this point in the history
  • Loading branch information
wycats committed Nov 3, 2024
1 parent b10d437 commit d65631b
Showing 1 changed file with 25 additions and 20 deletions.
45 changes: 25 additions & 20 deletions packages/@glimmer/compiler/test/compiler-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ function test(desc: string, template: string, ...expectedStatements: BuilderStat
});
}

const Append = BUILDER_APPEND;
const Concat = BUILDER_CONCAT;

QUnit.test(
'@arguments are on regular non-component/regular HTML nodes throws syntax error',
(assert) => {
Expand All @@ -72,8 +69,8 @@ test('HTML text content', 'content', s`content`);
test('Text curlies', '<div>{{title}}<span>{{title}}</span></div>', [
'<div>',
[
[Append, '^title'],
['<span>', [[Append, '^title']]],
[BUILDER_APPEND, '^title'],
['<span>', [[BUILDER_APPEND, '^title']]],
],
]);

Expand Down Expand Up @@ -191,7 +188,12 @@ test(
"<fake-thing><other-fake-thing data-src='extra-{{someDynamicBits}}-here' /></fake-thing>",
[
'<fake-thing>',
[['<other-fake-thing>', { 'data-src': [Concat, s`extra-`, '^someDynamicBits', s`-here`] }]],
[
[
'<other-fake-thing>',
{ 'data-src': [BUILDER_CONCAT, s`extra-`, '^someDynamicBits', s`-here`] },
],
],
]
);

Expand Down Expand Up @@ -224,22 +226,22 @@ test('empty attributes', `<div class=''>content</div>`, ['<div>', { class: s`` }

test('helpers in string attributes', `<a href="http://{{testing 123}}/index.html">linky</a>`, [
'<a>',
{ href: [Concat, s`http://`, ['(^testing)', [123]], s`/index.html`] },
{ href: [BUILDER_CONCAT, s`http://`, ['(^testing)', [123]], s`/index.html`] },
[s`linky`],
]);

test(`boolean attribute 'disabled'`, '<input disabled>', ['<input>', { disabled: true }]);

test(`string quoted attributes`, `<input disabled="{{isDisabled}}">`, [
'<input>',
{ disabled: [Concat, '^isDisabled'] },
{ disabled: [BUILDER_CONCAT, '^isDisabled'] },
]);

test(`unquoted attributes`, `<img src={{src}}>`, ['<img>', { src: '^src' }]);

test(`dynamic attr followed by static attr`, `<div foo='{{funstuff}}' name='Alice'></div>`, [
'<div>',
{ foo: [Concat, '^funstuff'], name: s`Alice` },
{ foo: [BUILDER_CONCAT, '^funstuff'], name: s`Alice` },
]);

test(
Expand Down Expand Up @@ -330,7 +332,7 @@ test(
[
'<svg>',
{ 'xmlns:xlink': s`http://www.w3.org/1999/xlink` },
[['<use>', { 'xlink:href': [Concat, '^iconLink'] }]],
[['<use>', { 'xlink:href': [BUILDER_CONCAT, '^iconLink'] }]],
]
);

Expand Down Expand Up @@ -390,19 +392,22 @@ test('whitespace', `Hello {{ foo }} `, s`Hello `, '^foo', s` `);

test('double curlies', `<div>{{title}}</div>`, ['<div>', ['^title']]);

test('triple curlies', `<div>{{{title}}}</div>`, ['<div>', [[Append, '^title', true]]]);
test('triple curlies', `<div>{{{title}}}</div>`, ['<div>', [[BUILDER_APPEND, '^title', true]]]);

test(
'triple curly helpers',
`{{{unescaped "<strong>Yolo</strong>"}}} {{escaped "<strong>Yolo</strong>"}}`,
[Append, ['(^unescaped)', [s`<strong>Yolo</strong>`]], true],
[BUILDER_APPEND, ['(^unescaped)', [s`<strong>Yolo</strong>`]], true],
s` `,
[Append, ['(^escaped)', [s`<strong>Yolo</strong>`]]]
[BUILDER_APPEND, ['(^escaped)', [s`<strong>Yolo</strong>`]]]
);

test('top level triple curlies', `{{{title}}}`, [Append, '^title', true]);
test('top level triple curlies', `{{{title}}}`, [BUILDER_APPEND, '^title', true]);

test('top level table', `<table>{{{title}}}</table>`, ['<table>', [[Append, '^title', true]]]);
test('top level table', `<table>{{{title}}}</table>`, [
'<table>',
[[BUILDER_APPEND, '^title', true]],
]);

test(
'X-TREME nesting',
Expand Down Expand Up @@ -441,7 +446,7 @@ test(

test('simple helpers', `<div>{{testing title}}</div>`, [
'<div>',
[[Append, ['(^testing)', ['^title']]]],
[[BUILDER_APPEND, ['(^testing)', ['^title']]]],
]);

test('constant negative numbers', `<div>{{testing -123321}}</div>`, [
Expand Down Expand Up @@ -510,7 +515,7 @@ test(

test('Null curly in attributes', `<div class="foo {{null}}">hello</div>`, [
'<div>',
{ class: [Concat, s`foo `, null] },
{ class: [BUILDER_CONCAT, s`foo `, null] },
[s`hello`],
]);

Expand Down Expand Up @@ -549,13 +554,13 @@ test('hash arguments', `<div>{{testing first="one" second="two"}}</div>`, [

test('params in concat attribute position', `<a href="{{testing url}}">linky</a>`, [
'<a>',
{ href: [Concat, ['(^testing)', ['^url']]] },
{ href: [BUILDER_CONCAT, ['(^testing)', ['^url']]] },
[s`linky`],
]);

test('named args in concat attribute position', `<a href="{{testing path=url}}">linky</a>`, [
'<a>',
{ href: [Concat, ['(^testing)', { path: '^url' }]] },
{ href: [BUILDER_CONCAT, ['(^testing)', { path: '^url' }]] },
[s`linky`],
]);

Expand All @@ -566,7 +571,7 @@ test(
'<a>',
{
href: [
Concat,
BUILDER_CONCAT,
s`http://`,
'^foo',
s`/`,
Expand Down

0 comments on commit d65631b

Please sign in to comment.