ep_font_size 0.4.57 → 0.4.60
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/.github/workflows/backend-tests.yml +55 -38
- package/.github/workflows/codeql.yml +41 -0
- package/.github/workflows/frontend-tests.yml +38 -54
- package/.github/workflows/npmpublish.yml +30 -78
- package/.github/workflows/test-and-release.yml +18 -0
- package/locales/lt.json +8 -0
- package/locales/zh-hant.json +2 -1
- package/package.json +6 -9
- package/static/tests/backend/specs/api/exportHTML.js +94 -103
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
name:
|
|
1
|
+
name: Backend Tests
|
|
2
2
|
|
|
3
3
|
# any branch is useful for testing before a PR is submitted
|
|
4
|
-
on:
|
|
4
|
+
on:
|
|
5
|
+
workflow_call:
|
|
5
6
|
|
|
6
7
|
jobs:
|
|
7
8
|
withplugins:
|
|
@@ -12,64 +13,80 @@ jobs:
|
|
|
12
13
|
|| (github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id)
|
|
13
14
|
name: with Plugins
|
|
14
15
|
runs-on: ubuntu-latest
|
|
15
|
-
|
|
16
16
|
steps:
|
|
17
17
|
-
|
|
18
18
|
name: Install libreoffice
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
uses: awalsh128/cache-apt-pkgs-action@v1.4.2
|
|
20
|
+
with:
|
|
21
|
+
packages: libreoffice libreoffice-pdfimport
|
|
22
|
+
version: 1.0
|
|
23
23
|
-
|
|
24
24
|
name: Install etherpad core
|
|
25
25
|
uses: actions/checkout@v3
|
|
26
26
|
with:
|
|
27
27
|
repository: ether/etherpad-lite
|
|
28
|
+
path: etherpad-lite
|
|
29
|
+
- uses: pnpm/action-setup@v3
|
|
30
|
+
name: Install pnpm
|
|
31
|
+
with:
|
|
32
|
+
version: 8
|
|
33
|
+
run_install: false
|
|
34
|
+
- name: Get pnpm store directory
|
|
35
|
+
shell: bash
|
|
36
|
+
run: |
|
|
37
|
+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
|
38
|
+
- uses: actions/cache@v4
|
|
39
|
+
name: Setup pnpm cache
|
|
40
|
+
with:
|
|
41
|
+
path: ${{ env.STORE_PATH }}
|
|
42
|
+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
43
|
+
restore-keys: |
|
|
44
|
+
${{ runner.os }}-pnpm-store-
|
|
28
45
|
-
|
|
29
46
|
name: Checkout plugin repository
|
|
30
47
|
uses: actions/checkout@v3
|
|
31
48
|
with:
|
|
32
|
-
path:
|
|
49
|
+
path: plugin
|
|
33
50
|
-
|
|
34
51
|
name: Determine plugin name
|
|
35
52
|
id: plugin_name
|
|
53
|
+
working-directory: ./plugin
|
|
36
54
|
run: |
|
|
37
|
-
cd ./node_modules/__tmp
|
|
38
55
|
npx -c 'printf %s\\n "::set-output name=plugin_name::${npm_package_name}"'
|
|
39
56
|
-
|
|
40
|
-
name:
|
|
57
|
+
name: Link plugin directory
|
|
58
|
+
working-directory: ./plugin
|
|
41
59
|
run: |
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
60
|
+
pnpm link --global
|
|
61
|
+
- name: Remove tests
|
|
62
|
+
working-directory: ./etherpad-lite
|
|
63
|
+
run: rm -rf ./src/tests/backend/specs
|
|
45
64
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
src/package-lock.json
|
|
52
|
-
src/bin/doc/package-lock.json
|
|
53
|
-
node_modules/${{ steps.plugin_name.outputs.plugin_name }}/package-lock.json
|
|
54
|
-
-
|
|
55
|
-
name: Install plugin dependencies
|
|
65
|
+
name: Install Etherpad core dependencies
|
|
66
|
+
working-directory: ./etherpad-lite
|
|
67
|
+
run: bin/installDeps.sh
|
|
68
|
+
- name: Link plugin to etherpad-lite
|
|
69
|
+
working-directory: ./etherpad-lite
|
|
56
70
|
run: |
|
|
57
|
-
|
|
58
|
-
|
|
71
|
+
pnpm link --global $PLUGIN_NAME
|
|
72
|
+
pnpm run plugins i --path ../../plugin
|
|
59
73
|
env:
|
|
60
74
|
PLUGIN_NAME: ${{ steps.plugin_name.outputs.plugin_name }}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
# rules.
|
|
70
|
-
-
|
|
71
|
-
name: Install Etherpad core dependencies
|
|
72
|
-
run: src/bin/installDeps.sh
|
|
75
|
+
- name: Link ep_etherpad-lite
|
|
76
|
+
working-directory: ./etherpad-lite/src
|
|
77
|
+
run: |
|
|
78
|
+
pnpm link --global
|
|
79
|
+
- name: Link etherpad to plugin
|
|
80
|
+
working-directory: ./plugin
|
|
81
|
+
run: |
|
|
82
|
+
pnpm link --global ep_etherpad-lite
|
|
73
83
|
-
|
|
74
84
|
name: Run the backend tests
|
|
75
|
-
|
|
85
|
+
working-directory: ./etherpad-lite
|
|
86
|
+
run: |
|
|
87
|
+
res=$(find .. -path "./node_modules/ep_*/static/tests/backend/specs/**" | wc -l)
|
|
88
|
+
if [ $res -eq 0 ]; then
|
|
89
|
+
echo "No backend tests found"
|
|
90
|
+
else
|
|
91
|
+
pnpm run test
|
|
92
|
+
fi
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
name: "CodeQL"
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ "main" ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ "main" ]
|
|
8
|
+
schedule:
|
|
9
|
+
- cron: "52 16 * * 2"
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
analyze:
|
|
13
|
+
name: Analyze
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
permissions:
|
|
16
|
+
actions: read
|
|
17
|
+
contents: read
|
|
18
|
+
security-events: write
|
|
19
|
+
|
|
20
|
+
strategy:
|
|
21
|
+
fail-fast: false
|
|
22
|
+
matrix:
|
|
23
|
+
language: [ javascript ]
|
|
24
|
+
|
|
25
|
+
steps:
|
|
26
|
+
- name: Checkout
|
|
27
|
+
uses: actions/checkout@v4
|
|
28
|
+
|
|
29
|
+
- name: Initialize CodeQL
|
|
30
|
+
uses: github/codeql-action/init@v3
|
|
31
|
+
with:
|
|
32
|
+
languages: ${{ matrix.language }}
|
|
33
|
+
queries: +security-and-quality
|
|
34
|
+
|
|
35
|
+
- name: Autobuild
|
|
36
|
+
uses: github/codeql-action/autobuild@v3
|
|
37
|
+
|
|
38
|
+
- name: Perform CodeQL Analysis
|
|
39
|
+
uses: github/codeql-action/analyze@v3
|
|
40
|
+
with:
|
|
41
|
+
category: "/language:${{ matrix.language }}"
|
|
@@ -1,44 +1,36 @@
|
|
|
1
1
|
# Publicly credit Sauce Labs because they generously support open source
|
|
2
2
|
# projects.
|
|
3
|
-
name:
|
|
3
|
+
name: Frontend Tests
|
|
4
4
|
|
|
5
|
-
on:
|
|
5
|
+
on:
|
|
6
|
+
workflow_call:
|
|
6
7
|
|
|
7
8
|
jobs:
|
|
8
|
-
test:
|
|
9
|
+
test-frontend:
|
|
9
10
|
runs-on: ubuntu-latest
|
|
10
11
|
|
|
11
12
|
steps:
|
|
12
|
-
-
|
|
13
|
-
name: Fail if Dependabot
|
|
14
|
-
if: github.actor == 'dependabot[bot]'
|
|
15
|
-
run: |
|
|
16
|
-
cat <<EOF >&2
|
|
17
|
-
Frontend tests skipped because Dependabot can't access secrets.
|
|
18
|
-
Manually re-run the jobs to run the frontend tests.
|
|
19
|
-
For more information, see:
|
|
20
|
-
https://github.blog/changelog/2021-02-19-github-actions-workflows-triggered-by-dependabot-prs-will-run-with-read-only-permissions/
|
|
21
|
-
EOF
|
|
22
|
-
exit 1
|
|
23
|
-
-
|
|
24
|
-
name: Generate Sauce Labs strings
|
|
25
|
-
id: sauce_strings
|
|
26
|
-
run: |
|
|
27
|
-
printf %s\\n '::set-output name=name::${{github.event.repository.name}} ${{ github.workflow }} - ${{ github.job }}'
|
|
28
|
-
printf %s\\n '::set-output name=tunnel_id::${{ github.run_id }}-${{ github.run_number }}-${{ github.job }}'
|
|
29
13
|
-
|
|
30
14
|
name: Check out Etherpad core
|
|
31
15
|
uses: actions/checkout@v3
|
|
32
16
|
with:
|
|
33
17
|
repository: ether/etherpad-lite
|
|
34
|
-
-
|
|
35
|
-
|
|
18
|
+
- uses: pnpm/action-setup@v3
|
|
19
|
+
name: Install pnpm
|
|
20
|
+
with:
|
|
21
|
+
version: 8
|
|
22
|
+
run_install: false
|
|
23
|
+
- name: Get pnpm store directory
|
|
24
|
+
shell: bash
|
|
25
|
+
run: |
|
|
26
|
+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
|
27
|
+
- uses: actions/cache@v4
|
|
28
|
+
name: Setup pnpm cache
|
|
36
29
|
with:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
src/bin/doc/package-lock.json
|
|
30
|
+
path: ${{ env.STORE_PATH }}
|
|
31
|
+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
32
|
+
restore-keys: |
|
|
33
|
+
${{ runner.os }}-pnpm-store-
|
|
42
34
|
-
|
|
43
35
|
name: Check out the plugin
|
|
44
36
|
uses: actions/checkout@v3
|
|
@@ -68,7 +60,7 @@ jobs:
|
|
|
68
60
|
PLUGIN_NAME: ${{ steps.plugin_name.outputs.plugin_name }}
|
|
69
61
|
run: |
|
|
70
62
|
cd ./node_modules/"${PLUGIN_NAME}"
|
|
71
|
-
|
|
63
|
+
pnpm i
|
|
72
64
|
# Etherpad core dependencies must be installed after installing the
|
|
73
65
|
# plugin's dependencies, otherwise npm will try to hoist common
|
|
74
66
|
# dependencies by removing them from src/node_modules and installing them
|
|
@@ -80,31 +72,23 @@ jobs:
|
|
|
80
72
|
# rules.
|
|
81
73
|
-
|
|
82
74
|
name: Install Etherpad core dependencies
|
|
83
|
-
run:
|
|
84
|
-
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
-
|
|
88
|
-
name: Disable import/export rate limiting
|
|
89
|
-
run: |
|
|
90
|
-
sed -e '/^ *"importExportRateLimiting":/,/^ *\}/ s/"max":.*/"max": 0/' -i settings.json
|
|
91
|
-
-
|
|
92
|
-
name: Remove standard frontend test files
|
|
93
|
-
run: rm -rf src/tests/frontend/specs
|
|
94
|
-
-
|
|
95
|
-
uses: saucelabs/sauce-connect-action@v2.1.1
|
|
96
|
-
with:
|
|
97
|
-
username: ${{ secrets.SAUCE_USERNAME }}
|
|
98
|
-
accessKey: ${{ secrets.SAUCE_ACCESS_KEY }}
|
|
99
|
-
tunnelIdentifier: ${{ steps.sauce_strings.outputs.tunnel_id }}
|
|
100
|
-
-
|
|
101
|
-
name: Run the frontend tests
|
|
75
|
+
run: bin/installDeps.sh
|
|
76
|
+
- name: Create settings.json
|
|
77
|
+
run: cp ./src/tests/settings.json settings.json
|
|
78
|
+
- name: Run the frontend tests
|
|
102
79
|
shell: bash
|
|
103
|
-
env:
|
|
104
|
-
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
|
|
105
|
-
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
|
|
106
|
-
SAUCE_NAME: ${{ steps.sauce_strings.outputs.name }}
|
|
107
|
-
TRAVIS_JOB_NUMBER: ${{ steps.sauce_strings.outputs.tunnel_id }}
|
|
108
|
-
GIT_HASH: ${{ steps.environment.outputs.sha_short }}
|
|
109
80
|
run: |
|
|
110
|
-
|
|
81
|
+
pnpm run dev &
|
|
82
|
+
connected=false
|
|
83
|
+
can_connect() {
|
|
84
|
+
curl -sSfo /dev/null http://localhost:9001/ || return 1
|
|
85
|
+
connected=true
|
|
86
|
+
}
|
|
87
|
+
now() { date +%s; }
|
|
88
|
+
start=$(now)
|
|
89
|
+
while [ $(($(now) - $start)) -le 15 ] && ! can_connect; do
|
|
90
|
+
sleep 1
|
|
91
|
+
done
|
|
92
|
+
cd src
|
|
93
|
+
pnpm exec playwright install chromium --with-deps
|
|
94
|
+
pnpm run test-ui --project=chromium
|
|
@@ -4,88 +4,40 @@
|
|
|
4
4
|
name: Node.js Package
|
|
5
5
|
|
|
6
6
|
on:
|
|
7
|
-
|
|
8
|
-
push:
|
|
9
|
-
branches:
|
|
10
|
-
- main
|
|
11
|
-
- master
|
|
7
|
+
workflow_call:
|
|
12
8
|
|
|
13
9
|
jobs:
|
|
14
|
-
|
|
10
|
+
publish-npm:
|
|
15
11
|
runs-on: ubuntu-latest
|
|
16
12
|
steps:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
# conflicts with this plugin's clone, etherpad-lite must be cloned and
|
|
23
|
-
# moved out before this plugin's repo is cloned to $GITHUB_WORKSPACE.
|
|
24
|
-
-
|
|
13
|
+
- uses: actions/setup-node@v4
|
|
14
|
+
with:
|
|
15
|
+
node-version: 20
|
|
16
|
+
registry-url: https://registry.npmjs.org/
|
|
17
|
+
- name: Check out Etherpad core
|
|
25
18
|
uses: actions/checkout@v3
|
|
26
19
|
with:
|
|
27
20
|
repository: ether/etherpad-lite
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
-
|
|
34
|
-
|
|
35
|
-
# This is necessary for actions/setup-node because '..' can't be used in
|
|
36
|
-
# cache-dependency-path.
|
|
37
|
-
-
|
|
38
|
-
name: Create ep_etherpad-lite symlink
|
|
21
|
+
- uses: pnpm/action-setup@v3
|
|
22
|
+
name: Install pnpm
|
|
23
|
+
with:
|
|
24
|
+
version: 8
|
|
25
|
+
run_install: false
|
|
26
|
+
- name: Get pnpm store directory
|
|
27
|
+
shell: bash
|
|
39
28
|
run: |
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
uses: actions/setup-node@v3
|
|
29
|
+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
|
30
|
+
- uses: actions/cache@v4
|
|
31
|
+
name: Setup pnpm cache
|
|
44
32
|
with:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
node_modules/ep_etherpad-lite/bin/doc/package-lock.json
|
|
50
|
-
package-lock.json
|
|
51
|
-
# All of ep_etherpad-lite's devDependencies are installed because the
|
|
52
|
-
# plugin might do `require('ep_etherpad-lite/node_modules/${devDep}')`.
|
|
53
|
-
# Eventually it would be nice to create an ESLint plugin that prohibits
|
|
54
|
-
# Etherpad plugins from piggybacking off of ep_etherpad-lite's
|
|
55
|
-
# devDependencies. If we had that, we could change this line to only
|
|
56
|
-
# install production dependencies.
|
|
57
|
-
-
|
|
58
|
-
run: cd ../etherpad-lite/src && npm ci
|
|
59
|
-
-
|
|
60
|
-
run: npm ci
|
|
61
|
-
# This runs some sanity checks and creates a symlink at
|
|
62
|
-
# node_modules/ep_etherpad-lite that points to ../../etherpad-lite/src.
|
|
63
|
-
# This step must be done after `npm ci` installs the plugin's dependencies
|
|
64
|
-
# because npm "helpfully" cleans up such symlinks. :( Installing
|
|
65
|
-
# ep_etherpad-lite in the plugin's node_modules prevents lint errors and
|
|
66
|
-
# unit test failures if the plugin does `require('ep_etherpad-lite/foo')`.
|
|
67
|
-
-
|
|
68
|
-
run: npm install --no-save ep_etherpad-lite@file:../etherpad-lite/src
|
|
69
|
-
-
|
|
70
|
-
run: npm test
|
|
71
|
-
-
|
|
72
|
-
run: npm run lint
|
|
73
|
-
|
|
74
|
-
publish-npm:
|
|
75
|
-
if: github.event_name == 'push'
|
|
76
|
-
needs: test
|
|
77
|
-
runs-on: ubuntu-latest
|
|
78
|
-
steps:
|
|
33
|
+
path: ${{ env.STORE_PATH }}
|
|
34
|
+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
35
|
+
restore-keys: |
|
|
36
|
+
${{ runner.os }}-pnpm-store-
|
|
79
37
|
-
|
|
80
38
|
uses: actions/checkout@v3
|
|
81
39
|
with:
|
|
82
40
|
fetch-depth: 0
|
|
83
|
-
-
|
|
84
|
-
uses: actions/setup-node@v3
|
|
85
|
-
with:
|
|
86
|
-
node-version: 12
|
|
87
|
-
registry-url: https://registry.npmjs.org/
|
|
88
|
-
cache: 'npm'
|
|
89
41
|
-
|
|
90
42
|
name: Bump version (patch)
|
|
91
43
|
run: |
|
|
@@ -94,13 +46,13 @@ jobs:
|
|
|
94
46
|
[ "${NEW_COMMITS}" -gt 0 ] || exit 0
|
|
95
47
|
git config user.name 'github-actions[bot]'
|
|
96
48
|
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
|
|
97
|
-
|
|
98
|
-
|
|
49
|
+
pnpm i
|
|
50
|
+
pnpm version patch
|
|
99
51
|
git push --follow-tags
|
|
100
52
|
# This is required if the package has a prepare script that uses something
|
|
101
53
|
# in dependencies or devDependencies.
|
|
102
54
|
-
|
|
103
|
-
run:
|
|
55
|
+
run: pnpm i
|
|
104
56
|
# `npm publish` must come after `git push` otherwise there is a race
|
|
105
57
|
# condition: If two PRs are merged back-to-back then master/main will be
|
|
106
58
|
# updated with the commits from the second PR before the first PR's
|
|
@@ -112,11 +64,11 @@ jobs:
|
|
|
112
64
|
# back-to-back merges will cause the first merge's workflow to fail but
|
|
113
65
|
# the second's will succeed.
|
|
114
66
|
-
|
|
115
|
-
run:
|
|
116
|
-
env:
|
|
117
|
-
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
|
118
|
-
-
|
|
119
|
-
name: Add package to etherpad organization
|
|
120
|
-
run: npm access grant read-write etherpad:developers
|
|
67
|
+
run: pnpm publish
|
|
121
68
|
env:
|
|
122
69
|
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
|
70
|
+
#-
|
|
71
|
+
# name: Add package to etherpad organization
|
|
72
|
+
# run: pnpm access grant read-write etherpad:developers
|
|
73
|
+
# env:
|
|
74
|
+
# NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
name: Node.js Package
|
|
2
|
+
on: [push]
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
backend:
|
|
7
|
+
uses: ./.github/workflows/backend-tests.yml
|
|
8
|
+
secrets: inherit
|
|
9
|
+
frontend:
|
|
10
|
+
uses: ./.github/workflows/frontend-tests.yml
|
|
11
|
+
secrets: inherit
|
|
12
|
+
release:
|
|
13
|
+
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
|
|
14
|
+
needs:
|
|
15
|
+
- backend
|
|
16
|
+
- frontend
|
|
17
|
+
uses: ./.github/workflows/npmpublish.yml
|
|
18
|
+
secrets: inherit
|
package/locales/lt.json
ADDED
package/locales/zh-hant.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"description": "Apply sizes to fonts",
|
|
3
3
|
"name": "ep_font_size",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.60",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "John McLear",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
],
|
|
15
15
|
"dependencies": {},
|
|
16
16
|
"engines": {
|
|
17
|
-
"node": ">=
|
|
17
|
+
"node": ">=18.0.0"
|
|
18
18
|
},
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
@@ -29,15 +29,12 @@
|
|
|
29
29
|
"url": "https://etherpad.org/"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"eslint": "^8.
|
|
33
|
-
"eslint-config-etherpad": "^
|
|
34
|
-
"typescript": "^4.
|
|
35
|
-
},
|
|
36
|
-
"peerDependencies": {
|
|
37
|
-
"ep_etherpad-lite": ">=1.8.6"
|
|
32
|
+
"eslint": "^8.57.0",
|
|
33
|
+
"eslint-config-etherpad": "^4.0.4",
|
|
34
|
+
"typescript": "^5.4.2"
|
|
38
35
|
},
|
|
39
36
|
"scripts": {
|
|
40
37
|
"lint": "eslint .",
|
|
41
38
|
"lint:fix": "eslint --fix ."
|
|
42
39
|
}
|
|
43
|
-
}
|
|
40
|
+
}
|
|
@@ -2,30 +2,32 @@
|
|
|
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
8
|
const apiVersion = 1;
|
|
8
|
-
const apiKey = common.apiKey;
|
|
9
9
|
|
|
10
10
|
// Creates a pad and returns the pad id. Calls the callback when finished.
|
|
11
|
-
const createPad = (padID, callback) => {
|
|
12
|
-
agent.get(`/api/${apiVersion}/createPad?
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
const createPad = async (padID, callback) => {
|
|
12
|
+
agent.get(`/api/${apiVersion}/createPad?padID=${padID}`)
|
|
13
|
+
.set("Authorization", await generateJWTToken())
|
|
14
|
+
.end((err, res) => {
|
|
15
|
+
if (err || (res.body.code !== 0)) callback(new Error('Unable to create new Pad'));
|
|
16
|
+
callback(padID);
|
|
17
|
+
});
|
|
17
18
|
};
|
|
18
19
|
|
|
19
|
-
const setHTML = (padID, html, callback) => {
|
|
20
|
-
agent.get(`/api/${apiVersion}/setHTML?
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
const setHTML = async (padID, html, callback) => {
|
|
21
|
+
agent.get(`/api/${apiVersion}/setHTML?padID=${padID}&html=${html}`)
|
|
22
|
+
.set("Authorization", await generateJWTToken())
|
|
23
|
+
.end((err, res) => {
|
|
24
|
+
if (err || (res.body.code !== 0)) callback(new Error('Unable to set pad HTML'));
|
|
25
|
+
callback(null, padID);
|
|
26
|
+
});
|
|
25
27
|
};
|
|
26
28
|
|
|
27
29
|
const getHTMLEndPointFor =
|
|
28
|
-
(padID, callback) => `/api/${apiVersion}/getHTML
|
|
30
|
+
(padID, callback) => `/api/${apiVersion}/getHTML?&padID=${padID}`;
|
|
29
31
|
|
|
30
32
|
const codeToBe = (expectedCode, res) => {
|
|
31
33
|
if (res.body.code !== expectedCode) {
|
|
@@ -72,26 +74,25 @@ describe('ep_font_size - export size styles to HTML', function () {
|
|
|
72
74
|
html = () => buildHTML(textWithSize('8'));
|
|
73
75
|
});
|
|
74
76
|
|
|
75
|
-
it('returns ok', function (
|
|
76
|
-
agent.get(getHTMLEndPointFor(padID))
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
it('returns ok', async function () {
|
|
78
|
+
await agent.get(getHTMLEndPointFor(padID))
|
|
79
|
+
.set("Authorization", await generateJWTToken())
|
|
80
|
+
.expect(codeToBe0)
|
|
81
|
+
.expect('Content-Type', /json/)
|
|
82
|
+
.expect(200);
|
|
80
83
|
});
|
|
81
84
|
|
|
82
|
-
it('returns HTML with size class', function (
|
|
83
|
-
agent.get(getHTMLEndPointFor(padID))
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
})
|
|
94
|
-
.end(done);
|
|
85
|
+
it('returns HTML with size class', async function () {
|
|
86
|
+
const res = await agent.get(getHTMLEndPointFor(padID))
|
|
87
|
+
.set("Authorization", await generateJWTToken());
|
|
88
|
+
const expectedRegex = regexWithSize('8');
|
|
89
|
+
const expectedsizes = new RegExp(expectedRegex);
|
|
90
|
+
const html = res.body.data.html;
|
|
91
|
+
const foundsize = html.match(expectedsizes);
|
|
92
|
+
if (!foundsize) {
|
|
93
|
+
throw new Error(
|
|
94
|
+
`size not exported. Regex used: ${expectedRegex}, html exported: ${html}`);
|
|
95
|
+
}
|
|
95
96
|
});
|
|
96
97
|
});
|
|
97
98
|
|
|
@@ -100,22 +101,20 @@ describe('ep_font_size - export size styles to HTML', function () {
|
|
|
100
101
|
html = () => buildHTML(textWithSize('8') + textWithSize('9'));
|
|
101
102
|
});
|
|
102
103
|
|
|
103
|
-
it('returns HTML with two size spans', function (
|
|
104
|
-
agent.get(getHTMLEndPointFor(padID))
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
})
|
|
118
|
-
.end(done);
|
|
104
|
+
it('returns HTML with two size spans', async function () {
|
|
105
|
+
const res = await agent.get(getHTMLEndPointFor(padID))
|
|
106
|
+
.set("Authorization", await generateJWTToken());
|
|
107
|
+
const firstsize = regexWithSize('8');
|
|
108
|
+
const secondsize = regexWithSize('9');
|
|
109
|
+
const expectedRegex = `${firstsize}.*${secondsize}`;
|
|
110
|
+
const expectedsizes = new RegExp(expectedRegex);
|
|
111
|
+
|
|
112
|
+
const html = res.body.data.html;
|
|
113
|
+
const foundsize = html.match(expectedsizes);
|
|
114
|
+
if (!foundsize) {
|
|
115
|
+
throw new Error(
|
|
116
|
+
`size not exported. Regex used: ${expectedRegex}, html exported: ${html}`);
|
|
117
|
+
}
|
|
119
118
|
});
|
|
120
119
|
});
|
|
121
120
|
|
|
@@ -124,20 +123,18 @@ describe('ep_font_size - export size styles to HTML', function () {
|
|
|
124
123
|
html = () => buildHTML('empty pad');
|
|
125
124
|
});
|
|
126
125
|
|
|
127
|
-
it('returns HTML with no size', function (
|
|
128
|
-
agent.get(getHTMLEndPointFor(padID))
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
})
|
|
140
|
-
.end(done);
|
|
126
|
+
it('returns HTML with no size', async function () {
|
|
127
|
+
const res = await agent.get(getHTMLEndPointFor(padID))
|
|
128
|
+
.set("Authorization", await generateJWTToken());
|
|
129
|
+
const expectedRegex = '.*empty pad.*';
|
|
130
|
+
const nosize = new RegExp(expectedRegex);
|
|
131
|
+
|
|
132
|
+
const html = res.body.data.html;
|
|
133
|
+
const foundsize = html.match(nosize);
|
|
134
|
+
if (!foundsize) {
|
|
135
|
+
throw new Error('size exported, should not have any. ' +
|
|
136
|
+
`Regex used: ${expectedRegex}, html exported: ${html}`);
|
|
137
|
+
}
|
|
141
138
|
});
|
|
142
139
|
});
|
|
143
140
|
|
|
@@ -148,20 +145,18 @@ describe('ep_font_size - export size styles to HTML', function () {
|
|
|
148
145
|
|
|
149
146
|
// Etherpad exports tags using the order they are defined on the array (bold is always inside
|
|
150
147
|
// size)
|
|
151
|
-
it('returns HTML with strong and size, in any order', function (
|
|
152
|
-
agent.get(getHTMLEndPointFor(padID))
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
})
|
|
164
|
-
.end(done);
|
|
148
|
+
it('returns HTML with strong and size, in any order', async function () {
|
|
149
|
+
const res = await agent.get(getHTMLEndPointFor(padID))
|
|
150
|
+
.set("Authorization", await generateJWTToken());
|
|
151
|
+
const txt = 'this is size 8 and bold';
|
|
152
|
+
const strongInside = new RegExp(regexWithSize('8', `<strong>${txt}</strong>`));
|
|
153
|
+
const sizeInside = new RegExp(`<strong>${regexWithSize('8', txt)}</strong>`);
|
|
154
|
+
const html = res.body.data.html;
|
|
155
|
+
const foundsize = html.match(strongInside) || html.match(sizeInside);
|
|
156
|
+
if (!foundsize) {
|
|
157
|
+
throw new Error(`size not exported. Regex used: [${strongInside.source} || ` +
|
|
158
|
+
`${sizeInside.source}], html exported: ${html}`);
|
|
159
|
+
}
|
|
165
160
|
});
|
|
166
161
|
});
|
|
167
162
|
|
|
@@ -172,20 +167,18 @@ describe('ep_font_size - export size styles to HTML', function () {
|
|
|
172
167
|
|
|
173
168
|
// Etherpad exports tags using the order they are defined on the array (bold is always inside
|
|
174
169
|
// size)
|
|
175
|
-
it('returns HTML with strong and size, in any order', function (
|
|
176
|
-
agent.get(getHTMLEndPointFor(padID))
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
})
|
|
188
|
-
.end(done);
|
|
170
|
+
it('returns HTML with strong and size, in any order', async function () {
|
|
171
|
+
const res = await agent.get(getHTMLEndPointFor(padID))
|
|
172
|
+
.set("Authorization", await generateJWTToken())
|
|
173
|
+
const txt = 'this is size 8 and bold';
|
|
174
|
+
const strongInside = new RegExp(regexWithSize('8', `<strong>${txt}</strong>`));
|
|
175
|
+
const sizeInside = new RegExp(`<strong>${regexWithSize('8', txt)}</strong>`);
|
|
176
|
+
const html = res.body.data.html;
|
|
177
|
+
const foundsize = html.match(strongInside) || html.match(sizeInside);
|
|
178
|
+
if (!foundsize) {
|
|
179
|
+
throw new Error(`size not exported. Regex used: [${strongInside.source} || ` +
|
|
180
|
+
`${sizeInside.source}], html exported: ${html}`);
|
|
181
|
+
}
|
|
189
182
|
});
|
|
190
183
|
});
|
|
191
184
|
|
|
@@ -194,19 +187,17 @@ describe('ep_font_size - export size styles to HTML', function () {
|
|
|
194
187
|
html = () => buildHTML(`no size here ${textWithSize('8')}`);
|
|
195
188
|
});
|
|
196
189
|
|
|
197
|
-
it('returns HTML with part with size and part without it', function (
|
|
198
|
-
agent.get(getHTMLEndPointFor(padID))
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
})
|
|
209
|
-
.end(done);
|
|
190
|
+
it('returns HTML with part with size and part without it', async function () {
|
|
191
|
+
const res = await agent.get(getHTMLEndPointFor(padID))
|
|
192
|
+
.set("Authorization", await generateJWTToken());
|
|
193
|
+
const expectedRegex = `no size here ${regexWithSize('8')}`;
|
|
194
|
+
const expectedsizes = new RegExp(expectedRegex);
|
|
195
|
+
const html = res.body.data.html;
|
|
196
|
+
const foundsize = html.match(expectedsizes);
|
|
197
|
+
if (!foundsize) {
|
|
198
|
+
throw new Error(
|
|
199
|
+
`size not exported. Regex used: ${expectedRegex}, html exported: ${html}`);
|
|
200
|
+
}
|
|
210
201
|
});
|
|
211
202
|
});
|
|
212
203
|
});
|