ep_subscript_and_superscript 0.3.4 → 0.3.6
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.
|
@@ -22,7 +22,7 @@ jobs:
|
|
|
22
22
|
version: 1.0
|
|
23
23
|
-
|
|
24
24
|
name: Install etherpad core
|
|
25
|
-
uses: actions/checkout@
|
|
25
|
+
uses: actions/checkout@v4
|
|
26
26
|
with:
|
|
27
27
|
repository: ether/etherpad-lite
|
|
28
28
|
path: etherpad-lite
|
|
@@ -44,7 +44,7 @@ jobs:
|
|
|
44
44
|
${{ runner.os }}-pnpm-store-
|
|
45
45
|
-
|
|
46
46
|
name: Checkout plugin repository
|
|
47
|
-
uses: actions/checkout@
|
|
47
|
+
uses: actions/checkout@v4
|
|
48
48
|
with:
|
|
49
49
|
path: plugin
|
|
50
50
|
-
|
|
@@ -12,7 +12,7 @@ jobs:
|
|
|
12
12
|
steps:
|
|
13
13
|
-
|
|
14
14
|
name: Check out Etherpad core
|
|
15
|
-
uses: actions/checkout@
|
|
15
|
+
uses: actions/checkout@v4
|
|
16
16
|
with:
|
|
17
17
|
repository: ether/etherpad-lite
|
|
18
18
|
- uses: pnpm/action-setup@v3
|
|
@@ -33,7 +33,7 @@ jobs:
|
|
|
33
33
|
${{ runner.os }}-pnpm-store-
|
|
34
34
|
-
|
|
35
35
|
name: Check out the plugin
|
|
36
|
-
uses: actions/checkout@
|
|
36
|
+
uses: actions/checkout@v4
|
|
37
37
|
with:
|
|
38
38
|
path: ./node_modules/__tmp
|
|
39
39
|
-
|
|
@@ -15,7 +15,7 @@ jobs:
|
|
|
15
15
|
node-version: 20
|
|
16
16
|
registry-url: https://registry.npmjs.org/
|
|
17
17
|
- name: Check out Etherpad core
|
|
18
|
-
uses: actions/checkout@
|
|
18
|
+
uses: actions/checkout@v4
|
|
19
19
|
with:
|
|
20
20
|
repository: ether/etherpad-lite
|
|
21
21
|
- uses: pnpm/action-setup@v3
|
|
@@ -35,7 +35,7 @@ jobs:
|
|
|
35
35
|
restore-keys: |
|
|
36
36
|
${{ runner.os }}-pnpm-store-
|
|
37
37
|
-
|
|
38
|
-
uses: actions/checkout@
|
|
38
|
+
uses: actions/checkout@v4
|
|
39
39
|
with:
|
|
40
40
|
fetch-depth: 0
|
|
41
41
|
-
|
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"type": "git",
|
|
21
21
|
"url": "git+https://github.com/ether/ep_subscript_and_superscript.git"
|
|
22
22
|
},
|
|
23
|
-
"version": "0.3.
|
|
23
|
+
"version": "0.3.6",
|
|
24
24
|
"funding": {
|
|
25
25
|
"type": "individual",
|
|
26
26
|
"url": "https://etherpad.org/"
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"eslint": "^8.57.0",
|
|
30
30
|
"eslint-config-etherpad": "^4.0.4",
|
|
31
|
-
"typescript": "^5.4.
|
|
31
|
+
"typescript": "^5.4.3"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
34
|
"lint": "eslint .",
|
|
@@ -2,32 +2,34 @@
|
|
|
2
2
|
|
|
3
3
|
const common = require('ep_etherpad-lite/tests/backend/common');
|
|
4
4
|
const randomString = require('ep_etherpad-lite/static/js/pad_utils').randomString;
|
|
5
|
+
import {generateJWTToken, generateJWTTokenUser} from "ep_etherpad-lite/tests/backend/common";
|
|
5
6
|
|
|
6
7
|
let agent;
|
|
7
|
-
const apiKey = common.apiKey;
|
|
8
8
|
const apiVersion = 1;
|
|
9
9
|
|
|
10
10
|
const buildHTML = (body) => `<html><body>${body}</body></html>`;
|
|
11
11
|
const getHTMLEndPointFor =
|
|
12
|
-
(padID, callback) => `/api/${apiVersion}/getHTML?
|
|
12
|
+
(padID, callback) => `/api/${apiVersion}/getHTML?padID=${padID}`;
|
|
13
13
|
|
|
14
14
|
// Creates a pad and returns the pad id. Calls the callback when finished.
|
|
15
|
-
const createPad = (padID, callback) => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
const createPad = async (padID, callback) => {
|
|
16
|
+
agent.get(`/api/${apiVersion}/createPad?padID=${padID}`)
|
|
17
|
+
.set("Authorization", await generateJWTToken())
|
|
18
|
+
.end((err, res) => {
|
|
19
|
+
if (err || (res.body.code !== 0)) callback(new Error('Unable to create new Pad'));
|
|
20
|
+
|
|
21
|
+
callback(padID);
|
|
22
|
+
});
|
|
22
23
|
};
|
|
23
24
|
|
|
24
|
-
const setHTML = (padID, html, callback) => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
const setHTML = async (padID, html, callback) => {
|
|
26
|
+
agent.get(`/api/${apiVersion}/setHTML?padID=${padID}&html=${html}`)
|
|
27
|
+
.set("Authorization", await generateJWTToken())
|
|
28
|
+
.end((err, res) => {
|
|
29
|
+
if (err || (res.body.code !== 0)) callback(new Error('Unable to set pad HTML'));
|
|
28
30
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
callback(null, padID);
|
|
32
|
+
});
|
|
31
33
|
};
|
|
32
34
|
|
|
33
35
|
describe('export Subscript to HTML', function () {
|
|
@@ -37,12 +39,12 @@ describe('export Subscript to HTML', function () {
|
|
|
37
39
|
before(async function () { agent = await common.init(); });
|
|
38
40
|
|
|
39
41
|
// create a new pad before each test run
|
|
40
|
-
beforeEach(function (done) {
|
|
41
|
-
|
|
42
|
+
beforeEach(async function (done) {
|
|
43
|
+
padID = randomString(5);
|
|
42
44
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
await createPad(padID, async () => {
|
|
46
|
+
await setHTML(padID, html(), done);
|
|
47
|
+
});
|
|
46
48
|
});
|
|
47
49
|
|
|
48
50
|
context('when pad text has one Subscript', function () {
|
|
@@ -50,21 +52,23 @@ describe('export Subscript to HTML', function () {
|
|
|
50
52
|
html = () => buildHTML('<sub>Hello world</sub>');
|
|
51
53
|
});
|
|
52
54
|
|
|
53
|
-
it('returns ok', function (done) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
it('returns ok', async function (done) {
|
|
56
|
+
agent.get(getHTMLEndPointFor(padID))
|
|
57
|
+
.set("Authorization", await generateJWTToken())
|
|
58
|
+
.expect('Content-Type', /json/)
|
|
59
|
+
.expect(200, done);
|
|
57
60
|
});
|
|
58
61
|
|
|
59
|
-
it('returns HTML with Subscript HTML tags', function (done) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
62
|
+
it('returns HTML with Subscript HTML tags', async function (done) {
|
|
63
|
+
agent.get(getHTMLEndPointFor(padID))
|
|
64
|
+
.set("Authorization", await generateJWTToken())
|
|
65
|
+
.expect((res) => {
|
|
66
|
+
const html = res.body.data.html;
|
|
67
|
+
if (html.indexOf('<sub>Hello world</sub>') === -1) {
|
|
68
|
+
throw new Error('No sub tag detected');
|
|
69
|
+
}
|
|
70
|
+
})
|
|
71
|
+
.end(done);
|
|
68
72
|
});
|
|
69
73
|
});
|
|
70
74
|
|
|
@@ -74,22 +78,24 @@ describe('export Subscript to HTML', function () {
|
|
|
74
78
|
});
|
|
75
79
|
|
|
76
80
|
|
|
77
|
-
it('returns ok', function (done) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
+
it('returns ok', async function (done) {
|
|
82
|
+
agent.get(getHTMLEndPointFor(padID))
|
|
83
|
+
.set("Authorization", await generateJWTToken())
|
|
84
|
+
.expect('Content-Type', /json/)
|
|
85
|
+
.expect(200, done);
|
|
81
86
|
});
|
|
82
87
|
|
|
83
|
-
it('returns HTML with Multiple Subscripts HTML tags', function (done) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
88
|
+
it('returns HTML with Multiple Subscripts HTML tags', async function (done) {
|
|
89
|
+
agent.get(getHTMLEndPointFor(padID))
|
|
90
|
+
.set("Authorization", await generateJWTToken())
|
|
91
|
+
.expect((res) => {
|
|
92
|
+
const html = res.body.data.html;
|
|
93
|
+
if (html.indexOf('<sub>Hello world</sub>') === -1) {
|
|
94
|
+
throw new Error('No sub tag detected');
|
|
95
|
+
}
|
|
96
|
+
if (html.indexOf('<sub>Foo</sub>') === -1) throw new Error('No sub tag detected');
|
|
97
|
+
})
|
|
98
|
+
.end(done);
|
|
93
99
|
});
|
|
94
100
|
});
|
|
95
101
|
});
|
|
@@ -113,21 +119,23 @@ describe('export Superscript to HTML', function () {
|
|
|
113
119
|
});
|
|
114
120
|
|
|
115
121
|
|
|
116
|
-
it('returns ok', function (done) {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
122
|
+
it('returns ok', async function (done) {
|
|
123
|
+
agent.get(getHTMLEndPointFor(padID))
|
|
124
|
+
.set("Authorization", await generateJWTToken())
|
|
125
|
+
.expect('Content-Type', /json/)
|
|
126
|
+
.expect(200, done);
|
|
120
127
|
});
|
|
121
128
|
|
|
122
|
-
it('returns HTML with Suberscript HTML tags', function (done) {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
it('returns HTML with Suberscript HTML tags', async function (done) {
|
|
130
|
+
agent.get(getHTMLEndPointFor(padID))
|
|
131
|
+
.set("Authorization", await generateJWTToken())
|
|
132
|
+
.expect((res) => {
|
|
133
|
+
const html = res.body.data.html;
|
|
134
|
+
if (html.indexOf('<sup>Hello world</sup>') === -1) {
|
|
135
|
+
throw new Error('No sup tag detected');
|
|
136
|
+
}
|
|
137
|
+
})
|
|
138
|
+
.end(done);
|
|
131
139
|
});
|
|
132
140
|
});
|
|
133
141
|
|
|
@@ -136,24 +144,26 @@ describe('export Superscript to HTML', function () {
|
|
|
136
144
|
html = () => buildHTML('<sup>Hello world</sup><br/><sup>Foo</sup>');
|
|
137
145
|
});
|
|
138
146
|
|
|
139
|
-
it('returns ok', function (done) {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
147
|
+
it('returns ok', async function (done) {
|
|
148
|
+
agent.get(getHTMLEndPointFor(padID))
|
|
149
|
+
.set("Authorization", await generateJWTToken())
|
|
150
|
+
.expect('Content-Type', /json/)
|
|
151
|
+
.expect(200, done);
|
|
143
152
|
});
|
|
144
153
|
|
|
145
|
-
it('returns HTML with Multiple Superscripts HTML tags', function (done) {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
154
|
+
it('returns HTML with Multiple Superscripts HTML tags', async function (done) {
|
|
155
|
+
agent.get(getHTMLEndPointFor(padID))
|
|
156
|
+
.set("Authorization", await generateJWTToken())
|
|
157
|
+
.expect((res) => {
|
|
158
|
+
const html = res.body.data.html;
|
|
159
|
+
if (html.indexOf('<sup>Hello world</sup>') === -1) {
|
|
160
|
+
throw new Error('No sup tag detected');
|
|
161
|
+
}
|
|
162
|
+
if (html.indexOf('<sup>Foo</sup>') === -1) {
|
|
163
|
+
throw new Error('No sup tag detected');
|
|
164
|
+
}
|
|
165
|
+
})
|
|
166
|
+
.end(done);
|
|
157
167
|
});
|
|
158
168
|
});
|
|
159
169
|
});
|