@@ -3,6 +3,8 @@ import {html} from 'lit';
3
3
import './chromedash-link' ;
4
4
import { _dateTimeFormat } from './chromedash-link' ;
5
5
6
+ const DAY = 24 * 60 * 60 * 1000 ;
7
+
6
8
it ( 'shows a plain link for non-cached links' , async ( ) => {
7
9
const el = await fixture ( html `< chromedash-link
8
10
href ="https://github.com/GoogleChrome/chromium-dashboard/issues/3007 "
@@ -27,8 +29,11 @@ it('wraps the text in sl-tag when requested', async () => {
27
29
} ) ;
28
30
29
31
describe ( 'Github issue links' , ( ) => {
32
+ // Get the 'information' object by running
33
+ // `curl -L https://api.github.com/repos/OWNER/REPO/issues/ISSUE_NUMBER`
34
+
30
35
it ( 'shows tooltip, open state, and title' , async ( ) => {
31
- const yesterday = new Date ( Date . now ( ) - 24 * 60 * 60 * 1000 ) ;
36
+ const yesterday = new Date ( Date . now ( ) - DAY ) ;
32
37
const featureLinks = [ {
33
38
url : 'https://github.com/GoogleChrome/chromium-dashboard/issues/3007' ,
34
39
type : 'github_issue' ,
@@ -94,7 +99,10 @@ describe('Github issue links', () => {
94
99
class="icon"
95
100
src="https://docs.github.com/assets/cb-600/images/site/favicon.png">
96
101
<sl-badge size="small" variant="success">
97
- open
102
+ Opened
103
+ <sl-relative-time date="${ yesterday . toISOString ( ) } ">
104
+ on ${ _dateTimeFormat . format ( yesterday ) }
105
+ </sl-relative-time>
98
106
</sl-badge>
99
107
#3007 Issue Title
100
108
</sl-tag>
@@ -106,7 +114,7 @@ describe('Github issue links', () => {
106
114
} ) ;
107
115
108
116
it ( 'shows closed state and title' , async ( ) => {
109
- const yesterday = new Date ( Date . now ( ) - 24 * 60 * 60 * 1000 ) ;
117
+ const yesterday = new Date ( Date . now ( ) - DAY ) ;
110
118
const featureLinks = [ {
111
119
url : 'https://github.com/GoogleChrome/chromium-dashboard/issues/3007' ,
112
120
type : 'github_issue' ,
@@ -137,7 +145,7 @@ describe('Github issue links', () => {
137
145
class="icon"
138
146
src="https://docs.github.com/assets/cb-600/images/site/favicon.png">
139
147
<sl-badge size="small" variant="neutral">
140
- closed
148
+ Closed
141
149
</sl-badge>
142
150
#3007 Issue Title
143
151
</sl-tag>
@@ -148,4 +156,242 @@ describe('Github issue links', () => {
148
156
ignoreAttributes : [ 'style' , 'title' ] ,
149
157
} ) ;
150
158
} ) ;
159
+
160
+ describe ( 'external reviewers' , ( ) => {
161
+ it ( 'shows TAG position' , async ( ) => {
162
+ const featureLinks = [ {
163
+ url : 'https://github.com/w3ctag/design-reviews/issues/400' ,
164
+ type : 'github_issue' ,
165
+ information : {
166
+ 'url' : 'https://api.github.com/repos/w3ctag/design-reviews/issues/400' ,
167
+ 'number' : 400 ,
168
+ 'title' : 'Font Table Access API' ,
169
+ 'user_login' : 'user' ,
170
+ 'state' : 'closed' ,
171
+ 'assignee_login' : 'assignee' ,
172
+ 'created_at' : '2019-08-07T00:53:51Z' ,
173
+ 'updated_at' : '2022-08-15T16:40:59Z' ,
174
+ 'closed_at' : '2022-08-15T16:40:29Z' ,
175
+ 'labels' : [ 'Needs a venue' , 'Provenance: Fugu' , 'Resolution: unsatisfied' ,
176
+ 'Review type: CG early review' , 'Topic: fonts' ] ,
177
+ } ,
178
+ } ] ;
179
+ const el = await fixture ( html `< chromedash-link
180
+ href ="https://github.com/w3ctag/design-reviews/issues/400 "
181
+ .featureLinks =${ featureLinks } > Content</ chromedash-link > ` ) ;
182
+ expect ( el ) . shadowDom . to . equal (
183
+ `<a href="https://github.com/w3ctag/design-reviews/issues/400"
184
+ rel="noopener noreferrer" target="_blank">
185
+ <sl-tooltip>
186
+ <div slot="content">...</div>
187
+ <sl-tag>
188
+ <img
189
+ alt="icon"
190
+ class="icon"
191
+ src="https://avatars.githubusercontent.com/u/3874462?s=48&v=4">
192
+ <sl-badge size="small" variant="danger">
193
+ Unsatisfied
194
+ </sl-badge>
195
+ #400 Font Table Access API
196
+ </sl-tag>
197
+ </sl-tooltip>
198
+ </a>` ,
199
+ {
200
+ ignoreChildren : [ 'div' ] ,
201
+ ignoreAttributes : [ 'style' , 'title' ] ,
202
+ } ) ;
203
+ } ) ;
204
+
205
+ it ( 'shows WebKit position' , async ( ) => {
206
+ const featureLinks = [ {
207
+ url : 'https://github.com/WebKit/standards-positions/issues/268' ,
208
+ type : 'github_issue' ,
209
+ information : {
210
+ 'url' : 'https://api.github.com/repos/WebKit/standards-positions/issues/268' ,
211
+ 'number' : 268 ,
212
+ 'title' : 'Cross-Origin Embedder Policies - "credentialless"' ,
213
+ 'user_login' : 'user' ,
214
+ 'state' : 'closed' ,
215
+ 'assignee_login' : 'assignee' ,
216
+ 'created_at' : '2019-08-07T00:53:51Z' ,
217
+ 'updated_at' : '2022-08-15T16:40:59Z' ,
218
+ 'closed_at' : '2022-08-15T16:40:29Z' ,
219
+ 'labels' : [ 'from: Google' , 'position: support' , 'venue: WHATWG HTML Workstream' ] ,
220
+ } ,
221
+ } ] ;
222
+ const el = await fixture ( html `< chromedash-link
223
+ href ="https://github.com/WebKit/standards-positions/issues/268 "
224
+ .featureLinks =${ featureLinks } > Content</ chromedash-link > ` ) ;
225
+ expect ( el ) . shadowDom . to . equal (
226
+ `<a href="https://github.com/WebKit/standards-positions/issues/268"
227
+ rel="noopener noreferrer" target="_blank">
228
+ <sl-tooltip>
229
+ <div slot="content">...</div>
230
+ <sl-tag>
231
+ <img
232
+ alt="icon"
233
+ class="icon"
234
+ src="https://avatars.githubusercontent.com/u/6458?s=48&v=4">
235
+ <sl-badge size="small" variant="success">
236
+ Support
237
+ </sl-badge>
238
+ #268 Cross-Origin Embedder Policies...credentialless"
239
+ </sl-tag>
240
+ </sl-tooltip>
241
+ </a>` ,
242
+ {
243
+ ignoreChildren : [ 'div' ] ,
244
+ ignoreAttributes : [ 'style' , 'title' ] ,
245
+ } ) ;
246
+ } ) ;
247
+
248
+ function firefoxIssue ( ) {
249
+ return {
250
+ url : 'https://github.com/mozilla/standards-positions/issues/975' ,
251
+ type : 'github_issue' ,
252
+ information : {
253
+ 'url' : 'https://api.github.com/repos/mozilla/standards-positions/issues/975' ,
254
+ 'number' : 975 ,
255
+ 'title' : 'The textInput event' ,
256
+ 'user_login' : 'user' ,
257
+ 'state' : 'closed' ,
258
+ 'assignee_login' : 'assignee' ,
259
+ 'created_at' : '2019-08-07T00:53:51Z' ,
260
+ 'updated_at' : '2022-08-15T16:40:59Z' ,
261
+ 'closed_at' : '2022-08-15T16:40:29Z' ,
262
+ 'labels' : [ 'position: neutral' ] ,
263
+ } ,
264
+ } ;
265
+ }
266
+
267
+ it ( 'shows Firefox position' , async ( ) => {
268
+ const featureLinks = [ firefoxIssue ( ) ] ;
269
+ const el = await fixture ( html `< chromedash-link
270
+ href ="https://github.com/mozilla/standards-positions/issues/975 "
271
+ .featureLinks =${ featureLinks } > Content</ chromedash-link > ` ) ;
272
+ expect ( el ) . shadowDom . to . equal (
273
+ `<a href="https://github.com/mozilla/standards-positions/issues/975"
274
+ rel="noopener noreferrer" target="_blank">
275
+ <sl-tooltip>
276
+ <div slot="content">...</div>
277
+ <sl-tag>
278
+ <img
279
+ alt="icon"
280
+ class="icon"
281
+ src="https://avatars.githubusercontent.com/u/131524?s=48&v=4">
282
+ <sl-badge size="small" variant="neutral">
283
+ Neutral
284
+ </sl-badge>
285
+ #975 The textInput event
286
+ </sl-tag>
287
+ </sl-tooltip>
288
+ </a>` ,
289
+ {
290
+ ignoreChildren : [ 'div' ] ,
291
+ ignoreAttributes : [ 'style' , 'title' ] ,
292
+ } ) ;
293
+ } ) ;
294
+
295
+ it ( 'shows closed if no position' , async ( ) => {
296
+ const issue = firefoxIssue ( ) ;
297
+ issue . information . labels = [ ] ;
298
+ const featureLinks = [ issue ] ;
299
+ const el = await fixture ( html `< chromedash-link
300
+ href ="https://github.com/mozilla/standards-positions/issues/975 "
301
+ .featureLinks =${ featureLinks } > Content</ chromedash-link > ` ) ;
302
+ expect ( el ) . shadowDom . to . equal (
303
+ `<a href="https://github.com/mozilla/standards-positions/issues/975"
304
+ rel="noopener noreferrer" target="_blank">
305
+ <sl-tooltip>
306
+ <div slot="content">...</div>
307
+ <sl-tag>
308
+ <img
309
+ alt="icon"
310
+ class="icon"
311
+ src="https://avatars.githubusercontent.com/u/131524?s=48&v=4">
312
+ <sl-badge size="small" variant="neutral">
313
+ Closed
314
+ </sl-badge>
315
+ #975 The textInput event
316
+ </sl-tag>
317
+ </sl-tooltip>
318
+ </a>` ,
319
+ {
320
+ ignoreChildren : [ 'div' ] ,
321
+ ignoreAttributes : [ 'style' , 'title' ] ,
322
+ } ) ;
323
+ } ) ;
324
+
325
+ it ( 'shows warning if open too short' , async ( ) => {
326
+ const issue = firefoxIssue ( ) ;
327
+ issue . information . labels = [ ] ;
328
+ const lastWeek = new Date ( Date . now ( ) - 3 * 7 * DAY ) ;
329
+ issue . information . state = 'open' ;
330
+ issue . information . created_at = lastWeek . toISOString ( ) ;
331
+ const featureLinks = [ issue ] ;
332
+ const el = await fixture ( html `< chromedash-link
333
+ href ="https://github.com/mozilla/standards-positions/issues/975 "
334
+ .featureLinks =${ featureLinks } > Content</ chromedash-link > ` ) ;
335
+ expect ( el ) . shadowDom . to . equal (
336
+ `<a href="https://github.com/mozilla/standards-positions/issues/975"
337
+ rel="noopener noreferrer" target="_blank">
338
+ <sl-tooltip>
339
+ <div slot="content">...</div>
340
+ <sl-tag>
341
+ <img
342
+ alt="icon"
343
+ class="icon"
344
+ src="https://avatars.githubusercontent.com/u/131524?s=48&v=4">
345
+ <sl-badge size="small" variant="warning">
346
+ Opened
347
+ <sl-relative-time date="${ lastWeek . toISOString ( ) } ">
348
+ on ${ _dateTimeFormat . format ( lastWeek ) }
349
+ </sl-relative-time>
350
+ </sl-badge>
351
+ #975 The textInput event
352
+ </sl-tag>
353
+ </sl-tooltip>
354
+ </a>` ,
355
+ {
356
+ ignoreChildren : [ 'div' ] ,
357
+ ignoreAttributes : [ 'style' , 'title' ] ,
358
+ } ) ;
359
+ } ) ;
360
+
361
+ it ( 'shows neutral if open a long time' , async ( ) => {
362
+ const issue = firefoxIssue ( ) ;
363
+ issue . information . labels = [ ] ;
364
+ const twoMonths = new Date ( Date . now ( ) - 8 * 7 * DAY ) ;
365
+ issue . information . state = 'open' ;
366
+ issue . information . created_at = twoMonths . toISOString ( ) ;
367
+ const featureLinks = [ issue ] ;
368
+ const el = await fixture ( html `< chromedash-link
369
+ href ="https://github.com/mozilla/standards-positions/issues/975 "
370
+ .featureLinks =${ featureLinks } > Content</ chromedash-link > ` ) ;
371
+ expect ( el ) . shadowDom . to . equal (
372
+ `<a href="https://github.com/mozilla/standards-positions/issues/975"
373
+ rel="noopener noreferrer" target="_blank">
374
+ <sl-tooltip>
375
+ <div slot="content">...</div>
376
+ <sl-tag>
377
+ <img
378
+ alt="icon"
379
+ class="icon"
380
+ src="https://avatars.githubusercontent.com/u/131524?s=48&v=4">
381
+ <sl-badge size="small" variant="neutral">
382
+ Opened
383
+ <sl-relative-time date="${ twoMonths . toISOString ( ) } ">
384
+ on ${ _dateTimeFormat . format ( twoMonths ) }
385
+ </sl-relative-time>
386
+ </sl-badge>
387
+ #975 The textInput event
388
+ </sl-tag>
389
+ </sl-tooltip>
390
+ </a>` ,
391
+ {
392
+ ignoreChildren : [ 'div' ] ,
393
+ ignoreAttributes : [ 'style' , 'title' ] ,
394
+ } ) ;
395
+ } ) ;
396
+ } ) ;
151
397
} ) ;
0 commit comments