-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #69 from CloudCannon/fix/html-unescaping
Stop Rosey unescaping escaped HTML
- Loading branch information
Showing
5 changed files
with
65 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
Feature: Rosey Build Code Blocks | ||
Background: | ||
Given I have the environment variables: | ||
| ROSEY_SOURCE | dist/site | | ||
| ROSEY_DEST | dist/translated_site | | ||
|
||
Scenario: Rosey doesn't ruin innocent escaped code | ||
Given I have a "dist/site/index.html" file with the content: | ||
""" | ||
<html> | ||
<body> | ||
<div data-rosey="seal">Kiss From A Rose</div> | ||
<pre><code><configuration><setting v='true'/></configuration></code></pre> | ||
</body> | ||
</html> | ||
""" | ||
And I have a "rosey/locales/manuka.json" file with the content: | ||
""" | ||
{ | ||
"seal": "Pollen From A Tree" | ||
} | ||
""" | ||
When I run my program with the flags: | ||
| build | | ||
Then I should see a selector '[data-rosey="seal"]' in "dist/translated_site/manuka/index.html" with the attributes: | ||
| data-rosey | seal | | ||
| innerText | Pollen From A Tree | | ||
Then I should see a selector 'pre > code' in "dist/translated_site/manuka/index.html" with the attributes: | ||
| innerText | <configuration><setting v='true'/></configuration> | |
22 changes: 22 additions & 0 deletions
22
rosey/features/generate/rosey-generate-code-blocks.feature
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,22 @@ | ||
Feature: Rosey Generate Code Blocks | ||
Background: | ||
Given I have the environment variables: | ||
| ROSEY_SOURCE | dist/site | | ||
| ROSEY_DEST | dist/translated_site | | ||
|
||
Scenario: Rosey generates base.json files with escaped code | ||
Given I have a "dist/site/index.html" file with the content: | ||
""" | ||
<html> | ||
<body data-rosey-ns='home'> | ||
<div data-rosey="seal">Kiss From A Rose</div> | ||
<pre><code data-rosey="code"><configuration><setting v='true'/></configuration></code></pre> | ||
</body> | ||
</html> | ||
""" | ||
When I run my program with the flags: | ||
| generate | | ||
Then I should see "rosey/base.json" containing the values: | ||
| version | int:2 | | ||
| keys.home:seal.original | Kiss From A Rose | | ||
| keys.home:code.original | <configuration><setting v='true'/></configuration> | |
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