<commit_before>var vows = require('vows'),
    assert = require('assert'),
    Plates = require('../lib/plates');
    common = require('./common');

vows.describe('merge data into markup').addBatch({
  'when providing both data and markup': {
    
    '(1) a single tag with an `id` that corresponds to a `data-key`.': (

      function() {
        return common.createTest('test-1');
      }()

    ),
    
    '(2) a deeply nested tag with an `id` that corresponds to a `data-key`.': (

      function() {
        return common.createTest('test-2');
      }()

    ),

    '(3) a tag with an `id` that corresponds to a `data-key`, having a body of nested tags.': (

      function() {
        return common.createTest('test-3');
      }()

    ),

    '(4) a tag with an arbitrary attribute that corresponds to a `data-key`.': (

      function() {
      
        var map = Plates.Map();

        map.where('src').is('google.com').use('key1');
        map.where('src').is('yahoo.com').use('key2');

        return common.createTest('test-4', map);

      }()

    ),
    
    '(5) a tag with a class attribute whith a value that corresponds to a `data-key`.': (

      function() {
        
        var map = Plates.Map();
        map.where('class').is('hidden').use('key1');

        return common.createTest('test-5', map);      

      }()

    ),

    
    '(6) a tag with a class attribute whith a value that corresponds to a `data-key`, a second map item.': (

      function() {
        
        var map = Plates.Map();
        map.where('class').is('hidden').use('key1');
        map.where('href').is('/foo').use('key2').as('href');

        return common.createTest('test-6', map);      

      }()

    ),

    '(7) a map that redefines the default matching attribute of `id`.': (

      function() {
        
        var map = Plates.Map({
          where: 'class'
        });

        return common.createTest('test-7', map);

      }()

    ),

    '(8) using the insert shortcut.': (

      function() {
        
        var map = Plates.Map();

        map.where('href').is('/').insert('newurl');

        return common.createTest('test-8', map);

      }()
      
    ),

    '(9) iterate a collection.': (

      function() {
        
        var map = Plates.Map();

        map.where('href').is('/').insert('url');

        return common.createTest('test-9', map);

      }()

    ),

    '(10) a map that defines creating missing attributes.' : (

      function() {
        
        var map = Plates.Map({
          create: true
        });

        map.class('logo').use('url').as('src');
        map.where('name').is('first_name').use('fname').as('value');
        map.where('name').is('last_name').use('lname').as('value');

        return common.createTest('test-10', map);

      }()

    ),

   '(11) differing on "is" parameter only.': (

      function() {
        
        var map = Plates.Map();

        map.where('name').is('method').use('method').as('value');
        map.where('name').is('id').use('id').as('value');

        return common.createTest('test-11', map);

      }()

    ),

    '(9) iterate a collection.': (

      function() {
        
        var map = Plates.Map();

        map.where('href').is('/').insert('url');

        return common.createTest('test-9', map);

      }()

    ),

    '(12) iterate a collection of nested elements.': (

      function() {
        <commit_msg>Adds greater clarity to test<commit_after>var vows = require('vows'),
    assert = require('assert'),
    Plates = require('../lib/plates');
    common = require('./common');

vows.describe('merge data into markup').addBatch({
  'when providing both data and markup': {
    
    '(1) a single tag with an `id` that corresponds to a `data-key`.': (

      function() {
        return common.createTest('test-1');
      }()

    ),
    
    '(2) a deeply nested tag with an `id` that corresponds to a `data-key`.': (

      function() {
        return common.createTest('test-2');
      }()

    ),

    '(3) a tag with an `id` that corresponds to a `data-key`, having a body of nested tags.': (

      function() {
        return common.createTest('test-3');
      }()

    ),

    '(4) a tag with an arbitrary attribute that corresponds to a `data-key`.': (

      function() {
      
        var map = Plates.Map();

        map.where('src').is('google.com').use('key1');
        map.where('src').is('yahoo.com').use('key2');

        return common.createTest('test-4', map);

      }()

    ),
    
    '(5) a tag with a class attribute whith a value that corresponds to a `data-key`.': (

      function() {
        
        var map = Plates.Map();
        map.where('class').is('hidden').use('key1');

        return common.createTest('test-5', map);      

      }()

    ),

    
    '(6) a tag with a class attribute whith a value that corresponds to a `data-key`, a second map item.': (

      function() {
        
        var map = Plates.Map();
        map.where('class').is('hidden').use('key1');
        map.where('href').is('/foo').use('key2').as('href');

        return common.createTest('test-6', map);      

      }()

    ),

    '(7) a map that redefines the default matching attribute of `id`.': (

      function() {
        
        var map = Plates.Map({
          where: 'class'
        });

        return common.createTest('test-7', map);

      }()

    ),

    '(8) using the insert shortcut.': (

      function() {
        
        var map = Plates.Map();

        map.where('href').is('/').insert('newurl');

        return common.createTest('test-8', map);

      }()
      
    ),

    '(9) iterate a collection.': (

      function() {
        
        var map = Plates.Map();

        map.where('href').is('/').insert('url');

        return common.createTest('test-9', map);

      }()

    ),

    '(10) a map that defines creating missing attributes.' : (

      function() {
        
        var map = Plates.Map({
          create: true
        });

        map.class('logo').use('url').as('src');
        map.where('name').is('first_name').use('fname').as('value');
        map.where('name').is('last_name').use('lname').as('value');

        return common.createTest('test-10', map);

      }()

    ),

   '(11) differing on "is" parameter only.': (

      function() {
        
        var map = Plates.Map();

        map.where('name').is('method').use('method').as('value');
        map.where('name').is('id').use('id').as('value');

        return common.createTest('test-11', map);

      }()

    ),

    '(9) iterate a collection.': (

      function() {
        
        var map = Plates.Map();

        map.where('href').is('/').insert('url');

        return common.createTest('test-9', map);

      }()

    ),

    '(12) iterate a collection of over an element with children.': (

      function() {
        
{'fraction_non_alphanumeric': 0.18837849587016375, 'fraction_numerical': 0.010143457469931894, 'mean_word_length': 1.9270568278201865, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5476626', 'n_tokens_mistral': 2231, 'n_tokens_neox': 2058, 'n_words': 491}