Sha256: 8e945c7a9677780447c20714d169232587f7743c939f11b6a69a4fd9aa972e92
Contents?: true
Size: 1.02 KB
Versions: 28
Compression:
Stored size: 1.02 KB
Contents
/* eslint-env mocha */ import assert from 'assert'; import { extractProp } from '../helper'; import propName from '../../src/propName'; describe('propName', () => { it('should export a function', () => { const expected = 'function'; const actual = typeof propName; assert.equal(expected, actual); }); it('should throw an error if the argument is missing', () => { assert.throws(() => { propName(); }, Error); }); it('should throw an error if the argument not a JSX node', () => { assert.throws(() => { propName({ a: 'foo' }); }, Error); }); it('should return correct name for normal prop', () => { const prop = extractProp('<div foo="bar" />'); const expected = 'foo'; const actual = propName(prop); assert.equal(expected, actual); }); it('should return correct name for namespaced prop', () => { const prop = extractProp('<div foo:bar="baz" />', 'foo:bar'); const expected = 'foo:bar'; const actual = propName(prop); assert.equal(expected, actual); }); });
Version data entries
28 entries across 28 versions & 1 rubygems