| 1 | import test from 'tape';
|
|---|
| 2 |
|
|---|
| 3 | import isContentEditable from '../../../src/util/isContentEditable';
|
|---|
| 4 | import JSXAttributeMock from '../../../__mocks__/JSXAttributeMock';
|
|---|
| 5 |
|
|---|
| 6 | test('isContentEditable - HTML5', (t) => {
|
|---|
| 7 | t.equal(
|
|---|
| 8 | isContentEditable('some tag', [
|
|---|
| 9 | JSXAttributeMock('contentEditable', 'true'),
|
|---|
| 10 | ]),
|
|---|
| 11 | true,
|
|---|
| 12 | 'identifies HTML5 contentEditable elements',
|
|---|
| 13 | );
|
|---|
| 14 |
|
|---|
| 15 | t.test('not content editable', (st) => {
|
|---|
| 16 | st.equal(
|
|---|
| 17 | isContentEditable('some tag', [
|
|---|
| 18 | JSXAttributeMock('contentEditable', null),
|
|---|
| 19 | ]),
|
|---|
| 20 | false,
|
|---|
| 21 | 'does not identify HTML5 content editable elements with null as the value',
|
|---|
| 22 | );
|
|---|
| 23 |
|
|---|
| 24 | st.equal(
|
|---|
| 25 | isContentEditable('some tag', [
|
|---|
| 26 | JSXAttributeMock('contentEditable', undefined),
|
|---|
| 27 | ]),
|
|---|
| 28 | false,
|
|---|
| 29 | 'does not identify HTML5 content editable elements with undefined as the value',
|
|---|
| 30 | );
|
|---|
| 31 |
|
|---|
| 32 | st.equal(
|
|---|
| 33 | isContentEditable('some tag', [
|
|---|
| 34 | JSXAttributeMock('contentEditable', true),
|
|---|
| 35 | ]),
|
|---|
| 36 | false,
|
|---|
| 37 | 'does not identify HTML5 content editable elements with true as the value',
|
|---|
| 38 | );
|
|---|
| 39 |
|
|---|
| 40 | st.equal(
|
|---|
| 41 | isContentEditable('some tag', [
|
|---|
| 42 | JSXAttributeMock('contentEditable', 'false'),
|
|---|
| 43 | ]),
|
|---|
| 44 | false,
|
|---|
| 45 | 'does not identify HTML5 content editable elements with "false" as the value',
|
|---|
| 46 | );
|
|---|
| 47 |
|
|---|
| 48 | st.end();
|
|---|
| 49 | });
|
|---|
| 50 |
|
|---|
| 51 | t.end();
|
|---|
| 52 | });
|
|---|