forked from trivago/prettier-plugin-twig-melody
-
-
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 branch 'rellafella:upgrade-test-system' into master
Close GH-43. Re-structure tests to allow configuration per-test basis.
- Loading branch information
Showing
102 changed files
with
1,671 additions
and
2,448 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"module": "ES2022", | ||
"moduleResolution": "Bundler" | ||
}, | ||
"exclude": ["node_modules"] | ||
} |
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
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,14 @@ | ||
<!-- I am a comment --> | ||
This is a paragraph | ||
|
||
<!-- I am a second comment --> | ||
|
||
Another paragraph | ||
|
||
<!-- I am a third comment --> | ||
|
||
A third paragraph | ||
|
||
<!-- This is the story of a little lamb | ||
that gets lost in a dark forest and | ||
struggles to find home --> |
This file was deleted.
Oops, something went wrong.
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,29 @@ | ||
{# One #} | ||
|
||
{# Two #} | ||
|
||
{# comment #} | ||
|
||
{# comment #} | ||
|
||
{# comment | ||
#} | ||
|
||
{% if searchResultFailing %} | ||
{# This is a Twig comment #} | ||
<li>No results found</li> | ||
{% endif %} | ||
|
||
{#- comment -#} | ||
|
||
{#- | ||
comment | ||
with multiple lines | ||
-#} | ||
|
||
{## | ||
# Illustration Hotel Interaction | ||
# | ||
# This image is just of decorative nature and doesn't contain relevant information | ||
# for visually impaired users. | ||
#} |
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 +1,18 @@ | ||
run_spec(__dirname, ["twig"]); | ||
import { run_spec } from "tests_config/run_spec"; | ||
import { describe, expect, it } from "vitest"; | ||
|
||
describe("Comments", () => { | ||
it("should handle html comments", async () => { | ||
const { actual, snapshotFile } = await run_spec(import.meta.url, { | ||
source: "htmlComments.twig" | ||
}); | ||
await expect(actual).toMatchFileSnapshot(snapshotFile); | ||
}); | ||
|
||
it("should handle twig comments", async () => { | ||
const { actual, snapshotFile } = await run_spec(import.meta.url, { | ||
source: "twigComments.twig" | ||
}); | ||
await expect(actual).toMatchFileSnapshot(snapshotFile); | ||
}); | ||
}); |
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 @@ | ||
123 |
This file was deleted.
Oops, something went wrong.
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,5 @@ | ||
{% if isRTL %}‎{% endif %} | ||
|
||
{% if searchResultFailing %} | ||
<li><span><!-- // --></span>No results found</li> | ||
{% endif %} |
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 @@ | ||
Test string |
File renamed without changes.
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 +1,23 @@ | ||
run_spec(__dirname, ["twig"]); | ||
import { run_spec } from "tests_config/run_spec"; | ||
import { describe, expect, it } from "vitest"; | ||
|
||
describe("Constant values", () => { | ||
it("should handle constant value int", async () => { | ||
const { actual, snapshotFile } = await run_spec(import.meta.url, { | ||
source: "int.twig" | ||
}); | ||
expect(actual).toMatchFileSnapshot(snapshotFile); | ||
}); | ||
it("should handle constant value string", async () => { | ||
const { actual, snapshotFile } = await run_spec(import.meta.url, { | ||
source: "string.twig" | ||
}); | ||
expect(actual).toMatchFileSnapshot(snapshotFile); | ||
}); | ||
it("should handle constant value special cases", async () => { | ||
const { actual, snapshotFile } = await run_spec(import.meta.url, { | ||
source: "special.twig" | ||
}); | ||
expect(actual).toMatchFileSnapshot(snapshotFile); | ||
}); | ||
}); |
File renamed without changes.
File renamed without changes.
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,15 @@ | ||
<ul> | ||
{% for item in items %} | ||
<li class="{{ loop.last ? 'last' : '' }}"> | ||
{{ loop.index0 // 2 }} {{ item.name }} {{ loop.index }} | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
|
||
<ul> | ||
{%- for item in items -%} | ||
<li class="{{ loop.last ? 'last' : '' }}"> | ||
{{ loop.index0 // 2 }} {{ item.name }} {{ loop.index }} | ||
</li> | ||
{%- endfor -%} | ||
</ul> |
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,18 @@ | ||
<ul> | ||
{% for a, b in c|slice(3, c.length) if b is even -%} | ||
<li>{{ a }} - {{ b }}</li> | ||
{%- else %} | ||
<li>No results found</li> | ||
{%- endfor %} | ||
</ul> | ||
|
||
<ul> | ||
{% for key, value in c[:c.length - 1] | ||
if value is defined and value is not even %} | ||
<li>{{ key }} - {{ value }}</li> | ||
{% else -%} | ||
{% if regionName is empty %} | ||
<li><span><!-- // --></span>No results found</li> | ||
{% endif %} | ||
{% endfor -%} | ||
</ul> |
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,6 @@ | ||
{% for foo in range(1, category) %} | ||
<span key="{{ foo }}" | ||
class="qtp-item__star icon-ic icon-icn_star--white {{ foo }}"> | ||
{% include './Star.twig' only %} | ||
</span> | ||
{% endfor %} |
12 changes: 12 additions & 0 deletions
12
tests/ControlStructures/__snapshots__/forWithBlock.snap.twig
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,12 @@ | ||
<h1> | ||
{{ title|title }} | ||
</h1> | ||
<ul> | ||
{% for item in items %} | ||
<li class="{{ loop.last ? 'last' : '' }}"> | ||
{% block title %} | ||
{{ loop.index0 }} {{ item.name|title }} {{ loop.index }} | ||
{% endblock %} | ||
</li> | ||
{% endfor %} | ||
</ul> |
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,31 @@ | ||
<div> | ||
{%- if foo %} | ||
<div class="foo"></div> | ||
{% else -%} | ||
<div class="bar"></div> | ||
{%- endif %} | ||
</div> | ||
|
||
{% if partner -%} | ||
<img class="{{ { | ||
(css.logo): not useWiderItems, | ||
(css.logoWider): useWiderItems | ||
}|classes }}" | ||
srcABC="{{ partner.logoUrl }}" | ||
alt="{{ partner.name }}" /> | ||
{%- elseif partnerName %} | ||
<b class="{{ css.name }}">{{ partnerName }}</b> | ||
{% elseif partnerImg -%} | ||
<b class="{{ css.image }}">{{ partnerImg }}</b> | ||
{%- endif -%} | ||
|
||
<!-- Don't break --> | ||
{% if isLeftToRight %}Hund{% endif %} | ||
{% if isRTL %}{{ '‎'|raw }}{% endif %} | ||
|
||
<!-- Do break --> | ||
{% if (unitAfter|length) > 0 and not withoutDisplayPattern %} | ||
<span key="unit-after" class="unit unit--after">{{ unitAfter }}</span> | ||
{% endif %} | ||
|
||
{%- if isCTestActive('WEB-50808') %} web50808{% endif -%} |
Oops, something went wrong.