ep_comments_page 0.1.98 → 1.0.2
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/index.js +3 -9
- package/package.json +6 -6
- package/static/js/index.js +10 -11
- package/static/js/newComment.js +26 -23
- package/static/tests/frontend/specs/commentDelete.js +61 -121
- package/static/tests/frontend/specs/commentIcons.js +270 -306
- package/static/tests/frontend/specs/commentSuggestion.js +67 -50
- package/static/tests/frontend/specs/comment_l10n.js +127 -127
- package/static/tests/frontend/specs/newComment.js +18 -0
- package/static/tests/frontend/specs/timeFormat.js +202 -202
- package/static/tests/frontend/utils.js +14 -0
- package/templates/comments.html +1 -4
- package/locales/pt-BR.json +0 -26
|
@@ -1,266 +1,266 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
let moment;
|
|
5
|
-
let originalLanguage = null;
|
|
3
|
+
const utils = require('../utils');
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
await new Promise((resolve) => helper.newPad(resolve));
|
|
10
|
-
moment = helper.padChrome$.window.require('ep_comments_page/static/js/moment-with-locales.min');
|
|
11
|
-
moment.relativeTimeThreshold('ss', 0);
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
after(async function () {
|
|
15
|
-
// Restore the language to avoid breaking other tests.
|
|
16
|
-
if (originalLanguage != null) await changeLanguageTo(originalLanguage);
|
|
17
|
-
});
|
|
5
|
+
let moment;
|
|
6
|
+
let originalLanguage = null;
|
|
18
7
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
before(async function () {
|
|
26
|
-
// First switch to a supported language that is not 'en' so that we know when the language
|
|
27
|
-
// change has taken effect. (This is important because using an unsupported language will
|
|
28
|
-
// cause moment.js to fall back to 'en'.)
|
|
29
|
-
await changeLanguageTo('pt-br');
|
|
30
|
-
await changeLanguageTo(lang);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('returns "12 seconds ago" when time is 12 seconds in the past', async function () {
|
|
34
|
-
expect(moment(secondsInThePast(12)).fromNow()).to.be('12 seconds ago');
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it('returns "in 12 seconds" when time is 12 seconds in the future', async function () {
|
|
38
|
-
expect(moment(secondsInTheFuture(12)).fromNow()).to.be('in 12 seconds');
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it('returns "a minute ago" when time is 75 seconds in the past', async function () {
|
|
42
|
-
expect(moment(secondsInThePast(75)).fromNow()).to.be('a minute ago');
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it('returns "in a minute" when time is 75 seconds in the future', async function () {
|
|
46
|
-
expect(moment(secondsInTheFuture(75)).fromNow()).to.be('in a minute');
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it('returns "17 minutes ago" when time is 17+ε minutes in the past', async function () {
|
|
50
|
-
expect(moment(secondsInThePast(minutes(17) + 2)).fromNow()).to.be('17 minutes ago');
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it('returns "in 17 minutes" when time is 17+ε minutes in the future', async function () {
|
|
54
|
-
expect(moment(secondsInTheFuture(minutes(17) + 2)).fromNow()).to.be('in 17 minutes');
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
it('returns "an hour ago" when time is 1+ε hour in the past', async function () {
|
|
58
|
-
expect(moment(secondsInThePast(hours(1) + 3)).fromNow()).to.be('an hour ago');
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
it('returns "in an hour" when time is 1+ε hour in the future', async function () {
|
|
62
|
-
expect(moment(secondsInTheFuture(hours(1) + 3)).fromNow()).to.be('in an hour');
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it('returns "2 hours ago" when time is 2+ε hours in the past', async function () {
|
|
66
|
-
expect(moment(secondsInThePast(hours(2) + 4)).fromNow()).to.be('2 hours ago');
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it('returns "in 2 hours" when time is 2+ε hours in the future', async function () {
|
|
70
|
-
expect(moment(secondsInTheFuture(hours(2) + 4)).fromNow()).to.be('in 2 hours');
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
it('returns "a day ago" when time is 24+ε hours in the past', async function () {
|
|
74
|
-
expect(moment(secondsInThePast(hours(24) + 5)).fromNow()).to.be('a day ago');
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
it('returns "in a day" when time is 24+ε hours in the future', async function () {
|
|
78
|
-
expect(moment(secondsInTheFuture(hours(24) + 5)).fromNow()).to.be('in a day');
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
it('returns "6 days ago" when time is 6+ε days in the past', async function () {
|
|
82
|
-
expect(moment(secondsInThePast(days(6) + 6)).fromNow()).to.be('6 days ago');
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
it('returns "in 6 days" when time is 6+ε days in the future', async function () {
|
|
86
|
-
expect(moment(secondsInTheFuture(days(6) + 6)).fromNow()).to.be('in 6 days');
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
it('returns "7 days ago" when time is 7+ε days in the past', async function () {
|
|
90
|
-
expect(moment(secondsInThePast(days(7) + 7)).fromNow()).to.be('7 days ago');
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
it('returns "in 7 days" when time is 7+ε days in the future', async function () {
|
|
94
|
-
expect(moment(secondsInTheFuture(days(7) + 7)).fromNow()).to.be('in 7 days');
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
it('returns "14 days ago" when time is 2+ε weeks in the past', async function () {
|
|
98
|
-
expect(moment(secondsInThePast(weeks(2) + 8)).fromNow()).to.be('14 days ago');
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
it('returns "in 14 days" when time is 2+ε weeks in the future', async function () {
|
|
102
|
-
expect(moment(secondsInTheFuture(weeks(2) + 8)).fromNow()).to.be('in 14 days');
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
it('returns "a month ago" when time is 4+ε weeks in the past', async function () {
|
|
106
|
-
expect(moment(secondsInThePast(weeks(4) + 9)).fromNow()).to.be('a month ago');
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
it('returns "in a month" when time is 4+ε weeks in the future', async function () {
|
|
110
|
-
expect(moment(secondsInTheFuture(weeks(4) + 9)).fromNow()).to.be('in a month');
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
it('returns "8 months ago" when time is 9+ε months in the past', async function () {
|
|
114
|
-
expect(moment(secondsInThePast(months(9) + 10)).fromNow()).to.be('8 months ago');
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
it('returns "in 8 months" when time is 9+ε months in the future', async function () {
|
|
118
|
-
expect(moment(secondsInTheFuture(months(9) + 10)).fromNow()).to.be('in 8 months');
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
it('returns "a year ago" when time is 12+ε months in the past', async function () {
|
|
122
|
-
expect(moment(secondsInThePast(months(12) + 11)).fromNow()).to.be('a year ago');
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
it('returns "in a year" when time is 12+ε months in the future', async function () {
|
|
126
|
-
expect(moment(secondsInTheFuture(months(12) + 11)).fromNow()).to.be('in a year');
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
it('returns "14 years ago" when time is 15+ε years in the past', async function () {
|
|
130
|
-
expect(moment(secondsInThePast(years(15) + 12)).fromNow()).to.be('14 years ago');
|
|
131
|
-
});
|
|
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
|
+
});
|
|
132
14
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}
|
|
15
|
+
after(async function () {
|
|
16
|
+
// Restore the language to avoid breaking other tests.
|
|
17
|
+
if (originalLanguage != null) await changeLanguageTo(originalLanguage);
|
|
18
|
+
});
|
|
138
19
|
|
|
139
|
-
|
|
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 () {
|
|
140
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'.)
|
|
141
30
|
await changeLanguageTo('pt-br');
|
|
31
|
+
await changeLanguageTo(lang);
|
|
142
32
|
});
|
|
143
33
|
|
|
144
|
-
it('returns "
|
|
145
|
-
expect(moment(secondsInThePast(12)).fromNow()).to.be('
|
|
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');
|
|
146
36
|
});
|
|
147
37
|
|
|
148
|
-
it('returns "
|
|
149
|
-
expect(moment(secondsInTheFuture(12)).fromNow()).to.be('
|
|
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');
|
|
150
40
|
});
|
|
151
41
|
|
|
152
|
-
it('returns "
|
|
153
|
-
expect(moment(secondsInThePast(75)).fromNow()).to.be('
|
|
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');
|
|
154
44
|
});
|
|
155
45
|
|
|
156
|
-
it('returns "
|
|
157
|
-
expect(moment(secondsInTheFuture(75)).fromNow()).to.be('
|
|
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');
|
|
158
48
|
});
|
|
159
49
|
|
|
160
|
-
it('returns "
|
|
161
|
-
expect(moment(secondsInThePast(minutes(17) + 2)).fromNow()).to.be('
|
|
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');
|
|
162
52
|
});
|
|
163
53
|
|
|
164
|
-
it('returns "
|
|
165
|
-
expect(moment(secondsInTheFuture(minutes(17) + 2)).fromNow()).to.be('
|
|
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');
|
|
166
56
|
});
|
|
167
57
|
|
|
168
|
-
it('returns "
|
|
169
|
-
expect(moment(secondsInThePast(hours(1) + 3)).fromNow()).to.be('
|
|
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');
|
|
170
60
|
});
|
|
171
61
|
|
|
172
|
-
it('returns "
|
|
173
|
-
expect(moment(secondsInTheFuture(hours(1) + 3)).fromNow()).to.be('
|
|
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');
|
|
174
64
|
});
|
|
175
65
|
|
|
176
|
-
it('returns "
|
|
177
|
-
expect(moment(secondsInThePast(hours(2) + 4)).fromNow()).to.be('
|
|
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');
|
|
178
68
|
});
|
|
179
69
|
|
|
180
|
-
it('returns "
|
|
181
|
-
expect(moment(secondsInTheFuture(hours(2) + 4)).fromNow()).to.be('
|
|
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');
|
|
182
72
|
});
|
|
183
73
|
|
|
184
|
-
it('returns "
|
|
185
|
-
expect(moment(secondsInThePast(hours(24) + 5)).fromNow()).to.be('
|
|
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');
|
|
186
76
|
});
|
|
187
77
|
|
|
188
|
-
it('returns "
|
|
189
|
-
expect(moment(secondsInTheFuture(hours(24) + 5)).fromNow()).to.be('
|
|
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');
|
|
190
80
|
});
|
|
191
81
|
|
|
192
|
-
it('returns "
|
|
193
|
-
expect(moment(secondsInThePast(days(6) + 6)).fromNow()).to.be('
|
|
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');
|
|
194
84
|
});
|
|
195
85
|
|
|
196
|
-
it('returns "
|
|
197
|
-
expect(moment(secondsInTheFuture(days(6) + 6)).fromNow()).to.be('
|
|
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');
|
|
198
88
|
});
|
|
199
89
|
|
|
200
|
-
it('returns "
|
|
201
|
-
expect(moment(secondsInThePast(days(7) + 7)).fromNow()).to.be('
|
|
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');
|
|
202
92
|
});
|
|
203
93
|
|
|
204
|
-
it('returns "
|
|
205
|
-
expect(moment(secondsInTheFuture(days(7) + 7)).fromNow()).to.be('
|
|
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');
|
|
206
96
|
});
|
|
207
97
|
|
|
208
|
-
it('returns "
|
|
209
|
-
expect(moment(secondsInThePast(weeks(2) + 8)).fromNow()).to.be('
|
|
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');
|
|
210
100
|
});
|
|
211
101
|
|
|
212
|
-
it('returns "
|
|
213
|
-
expect(moment(secondsInTheFuture(weeks(2) + 8)).fromNow()).to.be('
|
|
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');
|
|
214
104
|
});
|
|
215
105
|
|
|
216
|
-
it('returns "
|
|
217
|
-
expect(moment(secondsInThePast(weeks(4) + 9)).fromNow()).to.be('
|
|
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');
|
|
218
108
|
});
|
|
219
109
|
|
|
220
|
-
it('returns "
|
|
221
|
-
expect(moment(secondsInTheFuture(weeks(4) + 9)).fromNow()).to.be('
|
|
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');
|
|
222
112
|
});
|
|
223
113
|
|
|
224
|
-
it('returns "
|
|
225
|
-
expect(moment(secondsInThePast(months(9) + 10)).fromNow()).to.be('
|
|
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');
|
|
226
116
|
});
|
|
227
117
|
|
|
228
|
-
it('returns "
|
|
229
|
-
expect(moment(secondsInTheFuture(months(9) + 10)).fromNow()).to.be('
|
|
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');
|
|
230
120
|
});
|
|
231
121
|
|
|
232
|
-
it('returns "
|
|
233
|
-
expect(moment(secondsInThePast(months(12) + 11)).fromNow()).to.be('
|
|
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');
|
|
234
124
|
});
|
|
235
125
|
|
|
236
|
-
it('returns "
|
|
237
|
-
expect(moment(secondsInTheFuture(months(12) + 11)).fromNow()).to.be('
|
|
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');
|
|
238
128
|
});
|
|
239
129
|
|
|
240
|
-
it('returns "
|
|
241
|
-
expect(moment(secondsInThePast(years(15) + 12)).fromNow()).to.be('
|
|
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');
|
|
242
132
|
});
|
|
243
133
|
|
|
244
|
-
it('returns "
|
|
245
|
-
expect(moment(secondsInTheFuture(years(15) + 12)).fromNow()).to.be('
|
|
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');
|
|
246
136
|
});
|
|
247
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
|
+
});
|
|
248
216
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
expect(
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
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
|
+
});
|
|
266
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
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
exports.aNewPad = async (...args) => {
|
|
4
|
+
const padId = await helper.aNewPad(...args);
|
|
5
|
+
// Most ep_comments_page initialization happens during postAceInit, which runs after
|
|
6
|
+
// helper.aNewPad() returns. Wait for initialization to complete to avoid race conditions.
|
|
7
|
+
await helper.waitForPromise(async () => {
|
|
8
|
+
const {plugins: {ep_comments_page: {initDone} = {}} = {}} = helper.padChrome$.window.pad;
|
|
9
|
+
if (!initDone) return false;
|
|
10
|
+
await initDone;
|
|
11
|
+
return true;
|
|
12
|
+
});
|
|
13
|
+
return padId;
|
|
14
|
+
};
|
package/templates/comments.html
CHANGED
|
@@ -97,10 +97,7 @@
|
|
|
97
97
|
{{if changeTo}}
|
|
98
98
|
<form class="comment-changeTo-form suggestion-display">
|
|
99
99
|
<div>
|
|
100
|
-
|
|
101
|
-
<!-- Using escape() is a temp fix designed to handle suggestions to "foo" -->
|
|
102
|
-
<!-- which historically would break a pad :( -->
|
|
103
|
-
<span class="from-label" data-l10n-id="ep_comments_page.comments_template.suggested_change_from" data-l10n-args='{"changeFrom": "${changeFrom}", "changeTo": "${escape(changeTo)}"}'>Suggested Change From</span>
|
|
100
|
+
<span class="from-label" data-l10n-id="ep_comments_page.comments_template.suggested_change_from">Suggested Change From</span>
|
|
104
101
|
<span class="hidden from-value">${changeFrom}</span>
|
|
105
102
|
<span class="hidden to-value">${changeTo}</span>
|
|
106
103
|
</div>
|
package/locales/pt-BR.json
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"ep_comments_page.comment" : "Comentário",
|
|
3
|
-
"ep_comments_page.comments" : "Comentários",
|
|
4
|
-
"ep_comments_page.add_comment.title" : "Adicionar novo comentário ao texto selecionado",
|
|
5
|
-
"ep_comments_page.add_comment" : "Adicionar novo comentário ao texto selecionado",
|
|
6
|
-
"ep_comments_page.add_comment.hint" : "Por favor, selecione primeiro o texto para comentar",
|
|
7
|
-
"ep_comments_page.delete_comment.title" : "Apagar este comentário",
|
|
8
|
-
"ep_comments_page.edit_comment.title" : "Editar este comentário",
|
|
9
|
-
"ep_comments_page.show_comments" : "Mostrar Comentários",
|
|
10
|
-
"ep_comments_page.comments_template.suggested_change" : "Suggested Change",
|
|
11
|
-
"ep_comments_page.comments_template.from" : "From",
|
|
12
|
-
"ep_comments_page.comments_template.accept_change.value" : "Aceitar Sugestão",
|
|
13
|
-
"ep_comments_page.comments_template.revert_change.value" : "Reverter Sugestão",
|
|
14
|
-
"ep_comments_page.comments_template.suggested_change_from" : "Alteração sugerida de",
|
|
15
|
-
"ep_comments_page.comments_template.suggest_change_from" : "Sugerir alteração de",
|
|
16
|
-
"ep_comments_page.comments_template.to" : "Para",
|
|
17
|
-
"ep_comments_page.comments_template.include_suggestion" : "Incluir alteração sugerida",
|
|
18
|
-
"ep_comments_page.comments_template.comment.value" : "Comentário",
|
|
19
|
-
"ep_comments_page.comments_template.cancel.value" : "Cancelar",
|
|
20
|
-
"ep_comments_page.comments_template.reply.value":"Responder",
|
|
21
|
-
"ep_comments_page.comments_template.reply.placeholder":"Responder",
|
|
22
|
-
"ep_comments_page.comments_template.edit_comment.save" : "salvar",
|
|
23
|
-
"ep_comments_page.comments_template.edit_comment.cancel" :"cancelar",
|
|
24
|
-
"ep_comments_page.error.edit_unauth": "You cannot edit other users comments!",
|
|
25
|
-
"ep_comments_page.error.delete_unauth": "You cannot delete other users comments!"
|
|
26
|
-
}
|