@openeuropa/bcl-heading 0.22.0 → 0.23.0
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/__snapshots__/heading.test.js.snap +8 -6
- package/heading.html.twig +9 -11
- package/heading.test.js +4 -4
- package/package.json +3 -3
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
exports[`OE - Heading renders correctly 1`] = `
|
|
4
4
|
<jest>
|
|
5
5
|
<h2
|
|
6
|
-
class="
|
|
6
|
+
class="mb-4 bcl-heading"
|
|
7
7
|
>
|
|
8
8
|
A title created by the bcl heading template
|
|
9
9
|
</h2>
|
|
@@ -13,10 +13,11 @@ exports[`OE - Heading renders correctly 1`] = `
|
|
|
13
13
|
exports[`OE - Heading renders correctly with a link 1`] = `
|
|
14
14
|
<jest>
|
|
15
15
|
<h2
|
|
16
|
-
class="
|
|
16
|
+
class="mb-4 bcl-heading"
|
|
17
17
|
>
|
|
18
18
|
<a
|
|
19
|
-
|
|
19
|
+
class="standalone"
|
|
20
|
+
href="/example.html"
|
|
20
21
|
>
|
|
21
22
|
A title created by the bcl heading template
|
|
22
23
|
</a>
|
|
@@ -27,10 +28,11 @@ exports[`OE - Heading renders correctly with a link 1`] = `
|
|
|
27
28
|
exports[`OE - Heading renders correctly with a link and a title 1`] = `
|
|
28
29
|
<jest>
|
|
29
30
|
<h2
|
|
30
|
-
class="
|
|
31
|
+
class="mb-4 bcl-heading"
|
|
31
32
|
>
|
|
32
33
|
<a
|
|
33
|
-
|
|
34
|
+
class="standalone"
|
|
35
|
+
href="/example.html"
|
|
34
36
|
>
|
|
35
37
|
A title created by the bcl heading template
|
|
36
38
|
</a>
|
|
@@ -41,7 +43,7 @@ exports[`OE - Heading renders correctly with a link and a title 1`] = `
|
|
|
41
43
|
exports[`OE - Heading renders correctly with custom tag 1`] = `
|
|
42
44
|
<jest>
|
|
43
45
|
<h3
|
|
44
|
-
class="
|
|
46
|
+
class="mb-4 bcl-heading"
|
|
45
47
|
>
|
|
46
48
|
A title created by the bcl heading template
|
|
47
49
|
</h3>
|
package/heading.html.twig
CHANGED
|
@@ -3,40 +3,38 @@
|
|
|
3
3
|
{# Parameters:
|
|
4
4
|
- title (string) (default: '')
|
|
5
5
|
- title_tag (string) (default: 'h2')
|
|
6
|
-
-
|
|
7
|
-
- link: (object) (default: {})
|
|
6
|
+
- title_link: (object) (default: {})
|
|
8
7
|
- attributes (drupal attrs)
|
|
9
8
|
#}
|
|
10
9
|
|
|
11
10
|
{% set _title = title|default('') %}
|
|
12
|
-
{% set _path = path|default('') %}
|
|
13
11
|
{% set _title_tag = title_tag|default('h2') %}
|
|
14
|
-
{% set
|
|
12
|
+
{% set _title_link = title_link|default({}) %}
|
|
15
13
|
|
|
16
14
|
{% if attributes is empty %}
|
|
17
15
|
{% set attributes = create_attribute() %}
|
|
18
16
|
{% endif %}
|
|
19
17
|
|
|
20
18
|
{% if attributes.class is empty %}
|
|
21
|
-
{% set attributes = attributes.addClass(['
|
|
19
|
+
{% set attributes = attributes.addClass(['mb-4']) %}
|
|
22
20
|
{% endif %}
|
|
23
21
|
|
|
24
22
|
{% set attributes = attributes.addClass(['bcl-heading']) %}
|
|
25
23
|
|
|
26
|
-
{% if
|
|
27
|
-
{% set
|
|
24
|
+
{% if _title_link is not empty and _title is not empty and _title_link.label is empty %}
|
|
25
|
+
{% set _title_link = _title_link|merge({ label: _title }) %}
|
|
28
26
|
{% endif %}
|
|
29
27
|
|
|
30
|
-
{% if _title is not empty or
|
|
28
|
+
{% if _title is not empty or _title_link is not empty %}
|
|
31
29
|
<{{ _title_tag }}
|
|
32
30
|
{{- attributes -}}
|
|
33
31
|
>
|
|
34
|
-
{%- if
|
|
35
|
-
{% include '@oe-bcl/bcl-link/link.html.twig' with
|
|
32
|
+
{%- if _title_link is not empty -%}
|
|
33
|
+
{% include '@oe-bcl/bcl-link/link.html.twig' with _title_link|merge({ standalone: true }) only %}
|
|
36
34
|
{%- else -%}
|
|
37
35
|
{{- _title -}}
|
|
38
36
|
{%- endif %}
|
|
39
37
|
</{{ _title_tag }}>
|
|
40
38
|
{% endif -%}
|
|
41
39
|
|
|
42
|
-
{% endspaceless %}
|
|
40
|
+
{% endspaceless %}
|
package/heading.test.js
CHANGED
|
@@ -27,8 +27,8 @@ describe("OE - Heading", () => {
|
|
|
27
27
|
|
|
28
28
|
return expect(
|
|
29
29
|
render({
|
|
30
|
-
|
|
31
|
-
path: "/example",
|
|
30
|
+
title_link: {
|
|
31
|
+
path: "/example.html",
|
|
32
32
|
label: "A title created by the bcl heading template",
|
|
33
33
|
},
|
|
34
34
|
})
|
|
@@ -41,8 +41,8 @@ describe("OE - Heading", () => {
|
|
|
41
41
|
return expect(
|
|
42
42
|
render({
|
|
43
43
|
title: "A title created by the bcl heading template",
|
|
44
|
-
|
|
45
|
-
path: "/example",
|
|
44
|
+
title_link: {
|
|
45
|
+
path: "/example.html",
|
|
46
46
|
},
|
|
47
47
|
})
|
|
48
48
|
).resolves.toMatchSnapshot();
|
package/package.json
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
"name": "@openeuropa/bcl-heading",
|
|
3
3
|
"author": "European Commission",
|
|
4
4
|
"license": "EUPL-1.2",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.23.0",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@openeuropa/bcl-link": "^0.
|
|
10
|
+
"@openeuropa/bcl-link": "^0.23.0"
|
|
11
11
|
},
|
|
12
12
|
"description": "OE - BCL heading",
|
|
13
13
|
"repository": {
|
|
@@ -24,5 +24,5 @@
|
|
|
24
24
|
"design-system",
|
|
25
25
|
"twig"
|
|
26
26
|
],
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "fa2097e14024989cddf6f9cd7a9115bed5886aeb"
|
|
28
28
|
}
|