{"size": 1773, "ext": "js", "max_stars_repo_path": "tests.js", "max_stars_repo_name": "rasshofer/css-selector-tree", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "tests.js", "max_issues_repo_name": "rasshofer/css-selector-tree", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "tests.js", "max_forks_repo_name": "rasshofer/css-selector-tree", "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": 24.625, "max_line_length": 95, "alphanum_fraction": 0.6818950931}
var fs = require('fs');
var path = require('path');
var tap = require('tap');
var cssSelectorTree = require('./css-selector-tree');

// API

tap.equal(typeof cssSelectorTree, 'object');
tap.equal(typeof cssSelectorTree.tree, 'function');
tap.equal(typeof cssSelectorTree.subject, 'function');
tap.equal(typeof cssSelectorTree.conditions, 'function');

// Tree API

tap.equal(cssSelectorTree.tree(null), false);
tap.equal(cssSelectorTree.tree(), false);
tap.equal(cssSelectorTree.tree(''), false);
tap.equal(cssSelectorTree.tree(new Array(3).join(' ')), false);
tap.deepEqual(cssSelectorTree.tree('.grid-homepage .teaser .article-title .headline'), [{
  type: 'class',
  name: 'headline'
}, {
  type: 'child'
}, {
  type: 'class',
  name: 'article-title'
}, {
  type: 'child'
}, {
  type: 'class',
  name: 'teaser'
}, {
  type: 'child'
}, {
  type: 'class',
  name: 'grid-homepage'
}]);

// Subject API

tap.equal(cssSelectorTree.subject(null), false);
tap.equal(cssSelectorTree.subject(), false);
tap.equal(cssSelectorTree.subject(''), false);
tap.equal(cssSelectorTree.subject(new Array(3).join(' ')), false);
tap.deepEqual(cssSelectorTree.subject('.grid-homepage .teaser .article-title .headline'), {
  type: 'class',
  name: 'headline'
});

// Conditions API

tap.equal(cssSelectorTree.conditions(null), false);
tap.equal(cssSelectorTree.conditions(), false);
tap.equal(cssSelectorTree.conditions(''), false);
tap.equal(cssSelectorTree.conditions(new Array(3).join(' ')), false);
tap.deepEqual(cssSelectorTree.conditions('.grid-homepage .teaser .article-title .headline'), [{
  type: 'child'
}, {
  type: 'class',
  name: 'article-title'
}, {
  type: 'child'
}, {
  type: 'class',
  name: 'teaser'
}, {
  type: 'child'
}, {
  type: 'class',
  name: 'grid-homepage'
}]);
