Skip to content

Commit ce9b3e2

Browse files
committed
Update tests related to comma-separated values
Related to: <rehypejs/rehype#78>
1 parent 445988b commit ce9b3e2

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

test/matches.js

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ test('select.matches()', (t) => {
217217
'true if attribute matches (space-separated list, 2)'
218218
)
219219
t.ok(
220-
matches('[srcset=cat-big.jpg]', h('source', {srcSet: ['cat-big.jpg']})),
220+
matches('[accept=audio/*]', h('input', {type: 'file', accept: ['audio/*']})),
221221
'true if attribute matches (comma-separated list)'
222222
)
223223
t.ok(
@@ -254,7 +254,7 @@ test('select.matches()', (t) => {
254254
'false if attribute does not matches (space-separated list, 2)'
255255
)
256256
t.notOk(
257-
matches('[srcset=cat-small.jpg]', h('source', {srcSet: ['cat-big.jpg']})),
257+
matches('[accept=image/*]', h('input', {type: 'file', accept: ['audio/*']})),
258258
'false if attribute does not matches (comma-separated list)'
259259
)
260260
t.notOk(
@@ -295,7 +295,7 @@ test('select.matches()', (t) => {
295295
'true if attribute starts with (space-separated list)'
296296
)
297297
t.ok(
298-
matches('[srcset^=cat]', h('source', {srcSet: ['cat-big.jpg']})),
298+
matches('[accept^=audio]', h('input', {type: 'file', accept: ['audio/*']})),
299299
'true if attribute starts with (comma-separated list)'
300300
)
301301
t.ok(
@@ -328,7 +328,7 @@ test('select.matches()', (t) => {
328328
'false if attribute does not start with (space-separated list)'
329329
)
330330
t.notOk(
331-
matches('[srcset^=dog]', h('source', {srcSet: ['cat-big.jpg']})),
331+
matches('[accept^=video]', h('input', {type: 'file', accept: ['audio/*']})),
332332
'false if attribute does not start with (comma-separated list)'
333333
)
334334
t.notOk(
@@ -369,7 +369,7 @@ test('select.matches()', (t) => {
369369
'true if attribute ends with (space-separated list)'
370370
)
371371
t.ok(
372-
matches('[srcset$=jpg]', h('source', {srcSet: ['cat-big.jpg']})),
372+
matches('[accept$=*]', h('input', {type: 'file', accept: ['audio/*']})),
373373
'true if attribute ends with (comma-separated list)'
374374
)
375375
t.ok(
@@ -402,7 +402,7 @@ test('select.matches()', (t) => {
402402
'false if attribute does not end with (space-separated list)'
403403
)
404404
t.notOk(
405-
matches('[srcset$=png]', h('source', {srcSet: ['cat-big.jpg']})),
405+
matches('[accept$=doc]', h('input', {type: 'file', accept: ['audio/*']})),
406406
'false if attribute does not end with (comma-separated list)'
407407
)
408408
t.notOk(
@@ -443,7 +443,7 @@ test('select.matches()', (t) => {
443443
'true if attribute contains (space-separated list)'
444444
)
445445
t.ok(
446-
matches('[srcset*=big]', h('source', {srcSet: ['cat-big.jpg']})),
446+
matches('[accept*=audio/*]', h('input', {type: 'file', accept: ['audio/*']})),
447447
'true if attribute contains (comma-separated list)'
448448
)
449449
t.ok(
@@ -476,7 +476,7 @@ test('select.matches()', (t) => {
476476
'false if attribute does not contain (space-separated list)'
477477
)
478478
t.notOk(
479-
matches('[srcset*=small]', h('source', {srcSet: ['cat-big.jpg']})),
479+
matches('[accept*=video/*]', h('input', {type: 'file', accept: ['audio/*']})),
480480
'false if attribute does not contain (comma-separated list)'
481481
)
482482

@@ -521,8 +521,8 @@ test('select.matches()', (t) => {
521521
)
522522
t.ok(
523523
matches(
524-
'[srcset~=cat-big.jpg]',
525-
h('source', {srcSet: ['cat-big.jpg']})
524+
'[accept~=audio/*]',
525+
h('input', {type: 'file', accept: ['audio/*']})
526526
),
527527
'true if attribute matches (comma-separated list)'
528528
)
@@ -561,8 +561,8 @@ test('select.matches()', (t) => {
561561
)
562562
t.notOk(
563563
matches(
564-
'[srcset~=cat-small.jpg]',
565-
h('source', {srcSet: ['cat-big.jpg']})
564+
'[accept~=video/*]',
565+
h('input', {type: 'file', accept: ['audio/*']})
566566
),
567567
'false if attribute does not matches (comma-separated list)'
568568
)
@@ -618,7 +618,7 @@ test('select.matches()', (t) => {
618618
'true if attribute matches (space-separated list, 2)'
619619
)
620620
t.ok(
621-
matches('[srcset|=cat-big.jpg]', h('source', {srcSet: ['cat-big.jpg']})),
621+
matches('[accept|=audio/*]', h('input', {type: 'file', accept: ['audio/*']})),
622622
'true if attribute matches (comma-separated list)'
623623
)
624624
t.ok(
@@ -655,10 +655,7 @@ test('select.matches()', (t) => {
655655
'false if attribute does not matches (space-separated list, 2)'
656656
)
657657
t.notOk(
658-
matches(
659-
'[srcset|=cat-small.jpg]',
660-
h('source', {srcSet: ['cat-big.jpg']})
661-
),
658+
matches('[accept|=video/*]', h('input', {type: 'file', accept: ['audio/*']})),
662659
'false if attribute does not matches (comma-separated list)'
663660
)
664661
t.notOk(

0 commit comments

Comments
 (0)