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