mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-17 21:41:54 +00:00
0.2.0 - Mid migration
This commit is contained in:
parent
139e6a915e
commit
7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions
42
web/node_modules/jsx-ast-utils/__tests__/src/propName-test.js
generated
vendored
Normal file
42
web/node_modules/jsx-ast-utils/__tests__/src/propName-test.js
generated
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
/* eslint-env mocha */
|
||||
import assert from 'assert';
|
||||
import { extractProp, setParserName } from '../helper';
|
||||
import propName from '../../src/propName';
|
||||
|
||||
describe('propName', () => {
|
||||
beforeEach(() => {
|
||||
setParserName('babel');
|
||||
});
|
||||
it('should export a function', () => {
|
||||
const expected = 'function';
|
||||
const actual = typeof propName;
|
||||
|
||||
assert.equal(actual, expected);
|
||||
});
|
||||
|
||||
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(actual, expected);
|
||||
});
|
||||
|
||||
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(actual, expected);
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue