ep_comments_page 11.0.26 → 11.0.28

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.
Files changed (27) hide show
  1. package/package.json +1 -1
  2. package/static/js/index.js +16 -3
  3. package/static/tests/frontend-new/helper/comments.ts +193 -0
  4. package/static/tests/frontend-new/parked/commentDelete.spec.ts +57 -0
  5. package/static/tests/frontend-new/parked/commentEdit.spec.ts +113 -0
  6. package/static/tests/frontend-new/parked/commentIcons.spec.ts +131 -0
  7. package/static/tests/frontend-new/parked/commentReply.spec.ts +92 -0
  8. package/static/tests/frontend-new/parked/commentSuggestion.spec.ts +97 -0
  9. package/static/tests/frontend-new/parked/comment_l10n.spec.ts +63 -0
  10. package/static/tests/frontend-new/parked/comment_settings.spec.ts +47 -0
  11. package/static/tests/frontend-new/parked/newComment.spec.ts +25 -0
  12. package/static/tests/frontend-new/parked/preCommentMark.spec.ts +123 -0
  13. package/static/tests/frontend-new/parked/timeFormat.spec.ts +244 -0
  14. package/static/tests/frontend-new/parked/xcommentCopyPaste.spec.ts +29 -0
  15. package/static/tests/frontend-new/specs/smoke.spec.ts +32 -0
  16. package/static/tests/frontend/specs/commentDelete.js +0 -146
  17. package/static/tests/frontend/specs/commentEdit.js +0 -291
  18. package/static/tests/frontend/specs/commentIcons.js +0 -298
  19. package/static/tests/frontend/specs/commentReply.js +0 -200
  20. package/static/tests/frontend/specs/commentSuggestion.js +0 -100
  21. package/static/tests/frontend/specs/comment_l10n.js +0 -141
  22. package/static/tests/frontend/specs/comment_settings.js +0 -132
  23. package/static/tests/frontend/specs/newComment.js +0 -18
  24. package/static/tests/frontend/specs/preCommentMark.js +0 -241
  25. package/static/tests/frontend/specs/timeFormat.js +0 -266
  26. package/static/tests/frontend/specs/xcommentCopyPaste.js +0 -480
  27. package/static/tests/frontend/utils.js +0 -14
@@ -1,266 +0,0 @@
1
- 'use strict';
2
-
3
- const utils = require('../utils');
4
-
5
- let moment;
6
- let originalLanguage = null;
7
-
8
- before(async function () {
9
- this.timeout(60000);
10
- await utils.aNewPad();
11
- moment = helper.padChrome$.window.require('ep_comments_page/static/js/moment-with-locales.min');
12
- moment.relativeTimeThreshold('ss', 0);
13
- });
14
-
15
- after(async function () {
16
- // Restore the language to avoid breaking other tests.
17
- if (originalLanguage != null) await changeLanguageTo(originalLanguage);
18
- });
19
-
20
- for (const [lang, description] of Object.entries({
21
- en: 'English',
22
- // See https://translatewiki.net/wiki/FAQ#Special_private_language_codes_qqq,_qqx.
23
- qqq: 'a language that moment.js does not support',
24
- })) {
25
- describe(`in ${description}`, function () {
26
- before(async function () {
27
- // First switch to a supported language that is not 'en' so that we know when the language
28
- // change has taken effect. (This is important because using an unsupported language will
29
- // cause moment.js to fall back to 'en'.)
30
- await changeLanguageTo('pt-br');
31
- await changeLanguageTo(lang);
32
- });
33
-
34
- it('returns "12 seconds ago" when time is 12 seconds in the past', async function () {
35
- expect(moment(secondsInThePast(12)).fromNow()).to.be('12 seconds ago');
36
- });
37
-
38
- it('returns "in 12 seconds" when time is 12 seconds in the future', async function () {
39
- expect(moment(secondsInTheFuture(12)).fromNow()).to.be('in 12 seconds');
40
- });
41
-
42
- it('returns "a minute ago" when time is 75 seconds in the past', async function () {
43
- expect(moment(secondsInThePast(75)).fromNow()).to.be('a minute ago');
44
- });
45
-
46
- it('returns "in a minute" when time is 75 seconds in the future', async function () {
47
- expect(moment(secondsInTheFuture(75)).fromNow()).to.be('in a minute');
48
- });
49
-
50
- it('returns "17 minutes ago" when time is 17+ε minutes in the past', async function () {
51
- expect(moment(secondsInThePast(minutes(17) + 2)).fromNow()).to.be('17 minutes ago');
52
- });
53
-
54
- it('returns "in 17 minutes" when time is 17+ε minutes in the future', async function () {
55
- expect(moment(secondsInTheFuture(minutes(17) + 2)).fromNow()).to.be('in 17 minutes');
56
- });
57
-
58
- it('returns "an hour ago" when time is 1+ε hour in the past', async function () {
59
- expect(moment(secondsInThePast(hours(1) + 3)).fromNow()).to.be('an hour ago');
60
- });
61
-
62
- it('returns "in an hour" when time is 1+ε hour in the future', async function () {
63
- expect(moment(secondsInTheFuture(hours(1) + 3)).fromNow()).to.be('in an hour');
64
- });
65
-
66
- it('returns "2 hours ago" when time is 2+ε hours in the past', async function () {
67
- expect(moment(secondsInThePast(hours(2) + 4)).fromNow()).to.be('2 hours ago');
68
- });
69
-
70
- it('returns "in 2 hours" when time is 2+ε hours in the future', async function () {
71
- expect(moment(secondsInTheFuture(hours(2) + 4)).fromNow()).to.be('in 2 hours');
72
- });
73
-
74
- it('returns "a day ago" when time is 24+ε hours in the past', async function () {
75
- expect(moment(secondsInThePast(hours(24) + 5)).fromNow()).to.be('a day ago');
76
- });
77
-
78
- it('returns "in a day" when time is 24+ε hours in the future', async function () {
79
- expect(moment(secondsInTheFuture(hours(24) + 5)).fromNow()).to.be('in a day');
80
- });
81
-
82
- it('returns "6 days ago" when time is 6+ε days in the past', async function () {
83
- expect(moment(secondsInThePast(days(6) + 6)).fromNow()).to.be('6 days ago');
84
- });
85
-
86
- it('returns "in 6 days" when time is 6+ε days in the future', async function () {
87
- expect(moment(secondsInTheFuture(days(6) + 6)).fromNow()).to.be('in 6 days');
88
- });
89
-
90
- it('returns "7 days ago" when time is 7+ε days in the past', async function () {
91
- expect(moment(secondsInThePast(days(7) + 7)).fromNow()).to.be('7 days ago');
92
- });
93
-
94
- it('returns "in 7 days" when time is 7+ε days in the future', async function () {
95
- expect(moment(secondsInTheFuture(days(7) + 7)).fromNow()).to.be('in 7 days');
96
- });
97
-
98
- it('returns "14 days ago" when time is 2+ε weeks in the past', async function () {
99
- expect(moment(secondsInThePast(weeks(2) + 8)).fromNow()).to.be('14 days ago');
100
- });
101
-
102
- it('returns "in 14 days" when time is 2+ε weeks in the future', async function () {
103
- expect(moment(secondsInTheFuture(weeks(2) + 8)).fromNow()).to.be('in 14 days');
104
- });
105
-
106
- it('returns "a month ago" when time is 4+ε weeks in the past', async function () {
107
- expect(moment(secondsInThePast(weeks(4) + 9)).fromNow()).to.be('a month ago');
108
- });
109
-
110
- it('returns "in a month" when time is 4+ε weeks in the future', async function () {
111
- expect(moment(secondsInTheFuture(weeks(4) + 9)).fromNow()).to.be('in a month');
112
- });
113
-
114
- it('returns "8 months ago" when time is 9+ε months in the past', async function () {
115
- expect(moment(secondsInThePast(months(9) + 10)).fromNow()).to.be('8 months ago');
116
- });
117
-
118
- it('returns "in 8 months" when time is 9+ε months in the future', async function () {
119
- expect(moment(secondsInTheFuture(months(9) + 10)).fromNow()).to.be('in 8 months');
120
- });
121
-
122
- it('returns "a year ago" when time is 12+ε months in the past', async function () {
123
- expect(moment(secondsInThePast(months(12) + 11)).fromNow()).to.be('a year ago');
124
- });
125
-
126
- it('returns "in a year" when time is 12+ε months in the future', async function () {
127
- expect(moment(secondsInTheFuture(months(12) + 11)).fromNow()).to.be('in a year');
128
- });
129
-
130
- it('returns "14 years ago" when time is 15+ε years in the past', async function () {
131
- expect(moment(secondsInThePast(years(15) + 12)).fromNow()).to.be('14 years ago');
132
- });
133
-
134
- it('returns " in 14 years" when time is 15+ε years in the future', async function () {
135
- expect(moment(secondsInTheFuture(years(15) + 12)).fromNow()).to.be('in 14 years');
136
- });
137
- });
138
- }
139
-
140
- describe('in Portuguese', function () {
141
- before(async function () {
142
- await changeLanguageTo('pt-br');
143
- });
144
-
145
- it('returns "há 12 segundos" when time is 12 seconds in the past', async function () {
146
- expect(moment(secondsInThePast(12)).fromNow()).to.be('há 12 segundos');
147
- });
148
-
149
- it('returns "em 12 segundos" when time is 12 seconds in the future', async function () {
150
- expect(moment(secondsInTheFuture(12)).fromNow()).to.be('em 12 segundos');
151
- });
152
-
153
- it('returns "há um minuto" when time is 75 seconds in the past', async function () {
154
- expect(moment(secondsInThePast(75)).fromNow()).to.be('há um minuto');
155
- });
156
-
157
- it('returns "em um minuto" when time is 75 seconds in the future', async function () {
158
- expect(moment(secondsInTheFuture(75)).fromNow()).to.be('em um minuto');
159
- });
160
-
161
- it('returns "há 17 minutos" when time is 17+ε minutes in the past', async function () {
162
- expect(moment(secondsInThePast(minutes(17) + 2)).fromNow()).to.be('há 17 minutos');
163
- });
164
-
165
- it('returns "em 17 minutos" when time is 17+ε minutes in the future', async function () {
166
- expect(moment(secondsInTheFuture(minutes(17) + 2)).fromNow()).to.be('em 17 minutos');
167
- });
168
-
169
- it('returns "há uma hora" when time is 1+ε hour in the past', async function () {
170
- expect(moment(secondsInThePast(hours(1) + 3)).fromNow()).to.be('há uma hora');
171
- });
172
-
173
- it('returns "em uma hora" when time is 1+ε hour in the future', async function () {
174
- expect(moment(secondsInTheFuture(hours(1) + 3)).fromNow()).to.be('em uma hora');
175
- });
176
-
177
- it('returns "há 2 horas" when time is 2+ε hours in the past', async function () {
178
- expect(moment(secondsInThePast(hours(2) + 4)).fromNow()).to.be('há 2 horas');
179
- });
180
-
181
- it('returns "em 2 horas" when time is 2+ε hours in the future', async function () {
182
- expect(moment(secondsInTheFuture(hours(2) + 4)).fromNow()).to.be('em 2 horas');
183
- });
184
-
185
- it('returns "há um dia" when time is 24+ε hours in the past', async function () {
186
- expect(moment(secondsInThePast(hours(24) + 5)).fromNow()).to.be('há um dia');
187
- });
188
-
189
- it('returns "em um dia" when time is 24+ε hours in the future', async function () {
190
- expect(moment(secondsInTheFuture(hours(24) + 5)).fromNow()).to.be('em um dia');
191
- });
192
-
193
- it('returns "há 6 dias" when time is 6+ε days in the past', async function () {
194
- expect(moment(secondsInThePast(days(6) + 6)).fromNow()).to.be('há 6 dias');
195
- });
196
-
197
- it('returns "em 6 dias" when time is 6+ε days in the future', async function () {
198
- expect(moment(secondsInTheFuture(days(6) + 6)).fromNow()).to.be('em 6 dias');
199
- });
200
-
201
- it('returns "há 7 dias" when time is 7+ε days in the past', async function () {
202
- expect(moment(secondsInThePast(days(7) + 7)).fromNow()).to.be('há 7 dias');
203
- });
204
-
205
- it('returns "em 7 dias" when time is 7+ε days in the future', async function () {
206
- expect(moment(secondsInTheFuture(days(7) + 7)).fromNow()).to.be('em 7 dias');
207
- });
208
-
209
- it('returns "há 14 dias" when time is 2+ε weeks in the past', async function () {
210
- expect(moment(secondsInThePast(weeks(2) + 8)).fromNow()).to.be('há 14 dias');
211
- });
212
-
213
- it('returns "em 14 dias" when time is 2+ε weeks in the future', async function () {
214
- expect(moment(secondsInTheFuture(weeks(2) + 8)).fromNow()).to.be('em 14 dias');
215
- });
216
-
217
- it('returns "há um mês" when time is 4+ε weeks in the past', async function () {
218
- expect(moment(secondsInThePast(weeks(4) + 9)).fromNow()).to.be('há um mês');
219
- });
220
-
221
- it('returns "em um mês" when time is 4+ε weeks in the future', async function () {
222
- expect(moment(secondsInTheFuture(weeks(4) + 9)).fromNow()).to.be('em um mês');
223
- });
224
-
225
- it('returns "há 8 meses" when time is 9+ε months in the past', async function () {
226
- expect(moment(secondsInThePast(months(9) + 10)).fromNow()).to.be('há 8 meses');
227
- });
228
-
229
- it('returns "em 8 meses" when time is 9+ε months in the future', async function () {
230
- expect(moment(secondsInTheFuture(months(9) + 10)).fromNow()).to.be('em 8 meses');
231
- });
232
-
233
- it('returns "há um ano" when time is 12+ε months in the past', async function () {
234
- expect(moment(secondsInThePast(months(12) + 11)).fromNow()).to.be('há um ano');
235
- });
236
-
237
- it('returns "em um ano" when time is 12+ε months in the future', async function () {
238
- expect(moment(secondsInTheFuture(months(12) + 11)).fromNow()).to.be('em um ano');
239
- });
240
-
241
- it('returns "há 14 anos" when time is 15+ε years in the past', async function () {
242
- expect(moment(secondsInThePast(years(15) + 12)).fromNow()).to.be('há 14 anos');
243
- });
244
-
245
- it('returns "em 14 anos" when time is 15+ε years in the future', async function () {
246
- expect(moment(secondsInTheFuture(years(15) + 12)).fromNow()).to.be('em 14 anos');
247
- });
248
- });
249
-
250
- /* ********** Helper functions ********** */
251
-
252
- const secondsInThePast = (seconds) => Date.now() - seconds * 1000;
253
- const secondsInTheFuture = (seconds) => Date.now() + seconds * 1000;
254
- const minutes = (count) => 60 * count;
255
- const hours = (count) => 60 * minutes(count);
256
- const days = (count) => 24 * hours(count);
257
- const weeks = (count) => 7 * days(count);
258
- const months = (count) => 4 * weeks(count);
259
- const years = (count) => 12 * months(count);
260
-
261
- const changeLanguageTo = async (lang) => {
262
- if (originalLanguage == null) originalLanguage = helper.padChrome$.window.html10n.getLanguage();
263
- expect(helper.padChrome$(`#languagemenu [value=${lang}]`).length).to.be(1);
264
- helper.padChrome$('#languagemenu').val(lang).trigger('change');
265
- await helper.waitForPromise(() => moment.locale() === (lang === 'qqq' ? 'en' : lang));
266
- };