|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 2 weeks ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
1.3 KB
|
| Line | |
|---|
| 1 | import test from 'tape';
|
|---|
| 2 |
|
|---|
| 3 | import getComputedRole from '../../../src/util/getComputedRole';
|
|---|
| 4 | import JSXAttributeMock from '../../../__mocks__/JSXAttributeMock';
|
|---|
| 5 |
|
|---|
| 6 | test('getComputedRole', (t) => {
|
|---|
| 7 | t.equal(
|
|---|
| 8 | getComputedRole(
|
|---|
| 9 | 'div',
|
|---|
| 10 | [JSXAttributeMock('role', 'button')],
|
|---|
| 11 | ),
|
|---|
| 12 | 'button',
|
|---|
| 13 | 'explicit role + valid role -> returns the role',
|
|---|
| 14 | );
|
|---|
| 15 |
|
|---|
| 16 | t.equal(
|
|---|
| 17 | getComputedRole(
|
|---|
| 18 | 'li',
|
|---|
| 19 | [JSXAttributeMock('role', 'beeswax')],
|
|---|
| 20 | ),
|
|---|
| 21 | 'listitem',
|
|---|
| 22 | 'explicit role + invalid role + has implicit -> returns the implicit role',
|
|---|
| 23 | );
|
|---|
| 24 |
|
|---|
| 25 | t.equal(
|
|---|
| 26 | getComputedRole(
|
|---|
| 27 | 'div',
|
|---|
| 28 | [JSXAttributeMock('role', 'beeswax')],
|
|---|
| 29 | ),
|
|---|
| 30 | null,
|
|---|
| 31 | 'explicit role + invalid role + lacks implicit -> returns null',
|
|---|
| 32 | );
|
|---|
| 33 |
|
|---|
| 34 | t.equal(
|
|---|
| 35 | getComputedRole(
|
|---|
| 36 | 'li',
|
|---|
| 37 | [],
|
|---|
| 38 | ),
|
|---|
| 39 | 'listitem',
|
|---|
| 40 | 'explicit role + no role + has implicit -> returns the implicit role',
|
|---|
| 41 | );
|
|---|
| 42 |
|
|---|
| 43 | t.equal(
|
|---|
| 44 | getComputedRole(
|
|---|
| 45 | 'div',
|
|---|
| 46 | [],
|
|---|
| 47 | ),
|
|---|
| 48 | null,
|
|---|
| 49 | 'explicit role + no role + lacks implicit -> returns null',
|
|---|
| 50 | );
|
|---|
| 51 |
|
|---|
| 52 | t.equal(
|
|---|
| 53 | getComputedRole(
|
|---|
| 54 | 'li',
|
|---|
| 55 | [JSXAttributeMock('role', 'beeswax')],
|
|---|
| 56 | ),
|
|---|
| 57 | 'listitem',
|
|---|
| 58 | 'implicit role + has implicit -> returns the implicit role',
|
|---|
| 59 | );
|
|---|
| 60 |
|
|---|
| 61 | t.equal(
|
|---|
| 62 | getComputedRole(
|
|---|
| 63 | 'div',
|
|---|
| 64 | [],
|
|---|
| 65 | ),
|
|---|
| 66 | null,
|
|---|
| 67 | 'implicit role + lacks implicit -> returns null',
|
|---|
| 68 | );
|
|---|
| 69 |
|
|---|
| 70 | t.end();
|
|---|
| 71 | });
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.