@gov-cy/dsf-email-templates 2.0.2 → 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [v2.0.4] - 2024-07-24
9
+
10
+ ### Changed
11
+ - Update to fix braces vulnerability issue
12
+
13
+ ## [v2.0.3] - 2024-05-14
14
+
15
+ ### Added
16
+ - unit test for `bodyList`
17
+
8
18
  ## [v2.0.2] - 2024-05-01
9
19
 
10
20
  ### Changed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gov-cy/dsf-email-templates",
3
- "version": "2.0.2",
3
+ "version": "2.0.4",
4
4
  "description": "This project can be used to produce html email templates to be used by DSF.",
5
5
  "author": "DMRID - DSF Team",
6
6
  "license": "MIT",
@@ -21,7 +21,9 @@ describe('1. Testing `DSFEmailRenderer.renderFromString`, use of `govcyBase.njk`
21
21
  {% call govcyEmailElement('bodyHeading',{headingLevel:2}) -%}Heading 2{%- endcall %}
22
22
  {% call govcyEmailElement('bodyHeading',{headingLevel:3}) -%}Heading 3{%- endcall %}
23
23
  {% call govcyEmailElement('bodyHeading',{headingLevel:4}) -%}Heading 4{%- endcall %}
24
- {% endcall %}
24
+ {{ govcyEmailElement ('bodyList',{type:'ol', items: ["item 1", "item 2", "item 3"]}) }}
25
+ {{ govcyEmailElement ('bodyList',{type:'ul', items: ["item 1", "item 2", "item 3"]}) }}
26
+ {% endcall %}
25
27
  {% endblock %}
26
28
  {% block footer -%}
27
29
  {{ govcyEmailElement ('footer',{footerText:'Όνομα υπηρεσίας'}) }}
@@ -45,6 +47,8 @@ describe('2. Testing `DSFEmailRenderer.renderFromJson`', () => {
45
47
  {"component": "bodyHeading",params: {"headingLevel":2},body:"Heading 2"},
46
48
  {"component": "bodyHeading",params: {"headingLevel":3},body:"Heading 3"},
47
49
  {"component": "bodyHeading",params: {"headingLevel":4},body:"Heading 4"},
50
+ {"component": "bodyList", params:{type:'ol', items: ["item 1", "item 2", "item 3"]}},
51
+ {"component": "bodyList", params:{type:'ul', items: ["item 1", "item 2", "item 3"]}},
48
52
  ],
49
53
  footer: {
50
54
  footerText: "Name of service"
@@ -167,4 +171,20 @@ function renderChecks(renderedHTML, checksNum){
167
171
  expectedRegex = /<body>([\s\S]*?)<div style="font-family:Arial;font-size:16px;text-align:left;margin-bottom: 10px;line-height:1;" >/;
168
172
  expect(renderedHTML).to.match(expectedRegex);
169
173
  });
174
+ //check for bodyList.njk macro render as expected
175
+ it(checksNum+'12 `bodyList` macro render as expected', async () => {
176
+ //check for structure of `ol` block
177
+ let expectedRegex = /<body>([\s\S]*?)<ol style="margin:0; margin-left: 16px; padding:0; line-height:22px;" align="left">([\s\S]*?)<\/ol>/;
178
+ expect(renderedHTML).to.match(expectedRegex);
179
+ //check for structure of `ol` `li` block
180
+ expectedRegex = /<body>([\s\S]*?)<ol([\s\S]*?)>\s*<li>([\s\S]*?)item 1\s*<\/li>\s*<li>([\s\S]*?)item 2\s*<\/li>\s*<li>([\s\S]*?)item 3\s*<\/li>\s*<\/ol>/;
181
+ expect(renderedHTML).to.match(expectedRegex);
182
+ //check for structure of `ul` block
183
+ expectedRegex = /<body>([\s\S]*?)<ul style="margin:0; margin-left: 16px; padding:0; line-height:22px;" align="left" type="disc">([\s\S]*?)<\/ul>/;
184
+ expect(renderedHTML).to.match(expectedRegex);
185
+ //check for structure of `ul` `li` block
186
+ expectedRegex = /<body>([\s\S]*?)<ul([\s\S]*?)>\s*<li>([\s\S]*?)item 1\s*<\/li>\s*<li>([\s\S]*?)item 2\s*<\/li>\s*<li>([\s\S]*?)item 3\s*<\/li>\s*<\/ul>/;
187
+ expect(renderedHTML).to.match(expectedRegex);
188
+ })
189
+
170
190
  }