Example #1
0
File: wrap.js Project: Guria/enzyme
import { mount, shallow } from '../../lib/';

const bemjson = {
    block: 'block',
    elem: 'elem',
    mods: {
        mod: 'val'
    },
    mix: [
        {
            block: 'block2',
            elem: 'elem2'
        }
    ]
};
const className = stringify(bemjson);
const props = {
    ...bemjson
};

const cases = {
    // no rebem for children, testing pure BEM props without className
    'only BEM props': class extends React.Component {
        render() {
            return BEM({ block: 'root' },
                $('div', props)
            );
        }
    },
    // no rebem for children, testing only className, without BEM props
    'only className': class extends React.Component {
Example #2
0
export function isPropsMatchBEM(props, bemjson) {
    const targetClasses = new Set(stringify(props).split(' '));
    const matchClasses = stringify(bemjson).split(' ');

    return matchClasses.every(matchClass => targetClasses.has(matchClass));
}