{"size": 1630, "ext": "js", "max_stars_repo_path": "test/DOMUtil.js", "max_stars_repo_name": "furf/old-coding-test", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/DOMUtil.js", "max_issues_repo_name": "furf/old-coding-test", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/DOMUtil.js", "max_forks_repo_name": "furf/old-coding-test", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 32.6, "max_line_length": 107, "alphanum_fraction": 0.6306748466}
import React from 'react';
import ReactDOM from 'react-dom';
import { expect } from 'chai';
import { shallow, mount, render } from 'enzyme';
import {generateNodePath} from '../src/DOMUtil.js';

describe('DOMUtil.generateNodePath', function() {

  it('should render a non-<div>\'s nodeName', function() {
    const wrapper = mount(
      <span>Lorem ipsum dolor sit amet.</span>
    );
    expect(generateNodePath(wrapper.find('span').node, wrapper.node)).to.equal('span');
  });

  it('should not render a <div>\'s nodeName', function() {
    const wrapper = mount(
      <div>Lorem ipsum dolor sit amet.</div>
    );
    expect(generateNodePath(wrapper.find('div').node, wrapper.node)).to.equal('');
  });

  it('should render a <div>\'s className', function() {
    const wrapper = mount(
      <div className="hero">Lorem ipsum dolor sit amet.</div>
    );
    expect(generateNodePath(wrapper.find('div').node, wrapper.node)).to.equal('.hero');
  });

  it('should render multiple classNames', function() {
    const wrapper = mount(
      <span className="lorem-ipsum message">Lorem ipsum dolor sit amet.</span>
    );
    expect(generateNodePath(wrapper.find('span').node, wrapper.node)).to.equal('span.lorem-ipsum.message');
  });

  it('should ignore "invisible" <div> elements', function() {
    const wrapper = mount(
      <div className="root">
        <div className="hero">
          <div>
            <h1 className="heading big">Coding Test</h1>
          </div>
        </div>
      </div>
    );
    expect(generateNodePath(wrapper.find('h1').node, wrapper.node)).to.equal('.root .hero h1.heading.big');
  });
});
