@gcforms/editor 1.0.10 → 1.0.12
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 +9 -0
- package/package.json +3 -3
- package/src/tests/Editor.cy.tsx +0 -104
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,15 @@ 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.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
|
|
9
|
+
## [1.0.12] - 2025-12-08
|
|
10
|
+
|
|
11
|
+
- Move cypress component tests out to app level and port to Vitest
|
|
12
|
+
|
|
13
|
+
## [1.0.11] - 2025-10-03
|
|
14
|
+
|
|
15
|
+
- Update Lexical to version 0.36.2
|
|
16
|
+
|
|
8
17
|
## [1.0.10] - 2025-10-01
|
|
9
18
|
|
|
10
19
|
- Bump yarn
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gcforms/editor",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"author": "Canadian Digital Service",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
},
|
|
9
9
|
"packageManager": "yarn@4.10.3",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@lexical/react": "^0.
|
|
12
|
-
"lexical": "^0.
|
|
11
|
+
"@lexical/react": "^0.36.2",
|
|
12
|
+
"lexical": "^0.36.2"
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
15
|
"react": "^19.1.0",
|
package/src/tests/Editor.cy.tsx
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { Editor } from "../Editor";
|
|
4
|
-
|
|
5
|
-
describe("<RichTextEditor />", () => {
|
|
6
|
-
it("Adds and styles text", () => {
|
|
7
|
-
// see: https://on.cypress.io/mounting-react
|
|
8
|
-
cy.mount(
|
|
9
|
-
<div className="form-builder">
|
|
10
|
-
<Editor content="" ariaLabel="AriaLabel" locale="en" />
|
|
11
|
-
</div>
|
|
12
|
-
);
|
|
13
|
-
|
|
14
|
-
// Add some strings to get formatted
|
|
15
|
-
cy.get('[id^="editor-"]').type(
|
|
16
|
-
`
|
|
17
|
-
H2 heading text
|
|
18
|
-
H3 heading text
|
|
19
|
-
Let's bold part of this sentence.
|
|
20
|
-
Let's italicize part of this sentence.
|
|
21
|
-
Part of his one will be a link
|
|
22
|
-
`
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
// Add H2 heading
|
|
26
|
-
cy.get('[id^="editor-"]').setSelection("H2 heading text");
|
|
27
|
-
cy.get('[data-testid="h2-button"]').first().click();
|
|
28
|
-
cy.get('[id^="editor-"] h2').first().contains("H2 heading text");
|
|
29
|
-
cy.get('[data-testid="h2-button"]').first().should("have.attr", "aria-pressed", "true");
|
|
30
|
-
|
|
31
|
-
// Add H3 heading
|
|
32
|
-
cy.get('[id^="editor-"]').setSelection("H3 heading text");
|
|
33
|
-
cy.get('[data-testid="h3-button"]').first().click();
|
|
34
|
-
cy.get('[id^="editor-"] h3').first().contains("H3 heading text");
|
|
35
|
-
cy.get('[data-testid="h3-button"]').first().should("have.attr", "aria-pressed", "true");
|
|
36
|
-
|
|
37
|
-
// Bold part of the text
|
|
38
|
-
cy.get('[id^="editor-"]').setSelection("bold part of this");
|
|
39
|
-
cy.get('[data-testid="bold-button"]').first().click();
|
|
40
|
-
cy.get('[id^="editor-"] strong').first().contains("bold part of this");
|
|
41
|
-
cy.get('[data-testid="bold-button"]').first().should("have.attr", "aria-pressed", "true");
|
|
42
|
-
|
|
43
|
-
// Italicize part of the text
|
|
44
|
-
cy.get('[id^="editor-"]').setSelection("italicize part of this");
|
|
45
|
-
cy.get('[data-testid="italic-button"]').first().click();
|
|
46
|
-
cy.get('[id^="editor-"] em').first().contains("italicize part of this");
|
|
47
|
-
cy.get('[data-testid="italic-button"]').first().should("have.attr", "aria-pressed", "true");
|
|
48
|
-
|
|
49
|
-
// Add a bullet list
|
|
50
|
-
cy.get('[id^="editor-"]').type("{moveToEnd}This is a bullet list item");
|
|
51
|
-
cy.get('[data-testid="bullet-list-button"]').first().click();
|
|
52
|
-
|
|
53
|
-
cy.get('[id^="editor-"]')
|
|
54
|
-
.setCursorAfter("This is a bullet list item")
|
|
55
|
-
.type("{enter}This is another bullet list item");
|
|
56
|
-
cy.get('[data-testid="bullet-list-button"]')
|
|
57
|
-
.first()
|
|
58
|
-
.should("have.attr", "aria-pressed", "true");
|
|
59
|
-
cy.get('[id^="editor-"] ul li').first().contains("This is a bullet list item");
|
|
60
|
-
cy.get('[id^="editor-"] ul li').last().contains("This is another bullet list item");
|
|
61
|
-
|
|
62
|
-
// Add a numbered list - two {enter}s are needed to escape the previous list
|
|
63
|
-
cy.get('[id^="editor-"]').type("{moveToEnd}{enter}{enter}This is a numbered list item");
|
|
64
|
-
cy.get('[data-testid="numbered-list-button"]').first().click();
|
|
65
|
-
cy.get('[data-testid="numbered-list-button"]')
|
|
66
|
-
.first()
|
|
67
|
-
.should("have.attr", "aria-pressed", "true");
|
|
68
|
-
cy.get('[id^="editor-"]')
|
|
69
|
-
.setCursorAfter("This is a numbered list item")
|
|
70
|
-
.type("{enter}This is another numbered list item");
|
|
71
|
-
cy.get('[data-testid="numbered-list-button"]')
|
|
72
|
-
.first()
|
|
73
|
-
.should("have.attr", "aria-pressed", "true");
|
|
74
|
-
cy.get('[id^="editor-"] ol li').first().contains("This is a numbered list item");
|
|
75
|
-
cy.get('[id^="editor-"] ol li').last().contains("This is another numbered list item");
|
|
76
|
-
|
|
77
|
-
// Add a link
|
|
78
|
-
cy.get('[id^="editor-"]').setSelection("will be a link");
|
|
79
|
-
cy.get('[data-testid="link-button"]').first().click();
|
|
80
|
-
cy.get('[data-testid="gc-link-editor"] input').type(
|
|
81
|
-
"{selectAll}https://example.com{enter}{esc}"
|
|
82
|
-
);
|
|
83
|
-
cy.get('[id^="editor-"] a').first().contains("will be a link");
|
|
84
|
-
cy.get('[id^="editor-"] a').first().should("have.attr", "href", "https://example.com");
|
|
85
|
-
|
|
86
|
-
// Add a new numbered list to test the indent and outdent buttons
|
|
87
|
-
cy.get('[id^="editor-"]').type(
|
|
88
|
-
"{moveToEnd}{enter}{enter}{enter}This is a numbered list item 2"
|
|
89
|
-
);
|
|
90
|
-
cy.get('[data-testid="numbered-list-button"]').first().click();
|
|
91
|
-
cy.get('[id^="editor-"]')
|
|
92
|
-
.setCursorAfter("This is a numbered list item 2")
|
|
93
|
-
.type("{enter}This is another numbered list item 2");
|
|
94
|
-
cy.get('[id^="editor-"] ol li').last().contains("This is another numbered list item 2");
|
|
95
|
-
// Indent the last list item
|
|
96
|
-
cy.get('[data-testid="indent-button"]').click();
|
|
97
|
-
cy.get('[id^="editor-"] ol li').eq(2).contains("This is a numbered list item 2");
|
|
98
|
-
cy.get('[id^="editor-"] ol li ol li').last().contains("This is another numbered list item 2");
|
|
99
|
-
// Outdent the last list item (revert)
|
|
100
|
-
cy.get('[data-testid="outdent-button"]').click();
|
|
101
|
-
cy.get('[id^="editor-"] ol li').eq(2).contains("This is a numbered list item 2");
|
|
102
|
-
cy.get('[id^="editor-"] ol li').last().contains("This is another numbered list item 2");
|
|
103
|
-
});
|
|
104
|
-
});
|