<commit_before>var maquette = require("../src/maquette.js");
var assert = require("assert");
var jsdom = require('mocha-jsdom');
var expect = require('chai').expect;

var h = maquette.h;

describe('Maquette', function () {
  describe('#createDom()', function () {

    jsdom();

    it('should create and update single textnodes', function () {
      var projection = maquette.createDom(h("div", ["text"]));
      expect(projection.domNode.outerHTML).to.equal("<div>text</div>");

      projection.update(h("div", ["text2"]));
      expect(projection.domNode.outerHTML).to.equal("<div>text2</div>");

      projection.update(h("div", ["text2", h("span", ["a"])]));
      expect(projection.domNode.outerHTML).to.equal("<div>text2<span>a</span></div>");

      projection.update(h("div", ["text2"]));
      expect(projection.domNode.outerHTML).to.equal("<div>text2</div>");

      projection.update(h("div", ["text"]));
      expect(projection.domNode.outerHTML).to.equal("<div>text</div>");
    });

  });
});<commit_msg>1 more test<commit_after>var maquette = require("../src/maquette.js");
var assert = require("assert");
var jsdom = require('mocha-jsdom');
var expect = require('chai').expect;

var h = maquette.h;

describe('Maquette', function () {
  describe('#createDom()', function () {

    jsdom();

    it("should create and update single textnodes", function () {
      var projection = maquette.createDom(h("div", ["text"]));
      expect(projection.domNode.outerHTML).to.equal("<div>text</div>");

      projection.update(h("div", ["text2"]));
      expect(projection.domNode.outerHTML).to.equal("<div>text2</div>");

      projection.update(h("div", ["text2", h("span", ["a"])]));
      expect(projection.domNode.outerHTML).to.equal("<div>text2<span>a</span></div>");

      projection.update(h("div", ["text2"]));
      expect(projection.domNode.outerHTML).to.equal("<div>text2</div>");

      projection.update(h("div", ["text"]));
      expect(projection.domNode.outerHTML).to.equal("<div>text</div>");
    });

    it("should work correctly with adjacent textnodes", function () {
      var projection = maquette.createDom(h("div", ["", "1", ""]));
      expect(projection.domNode.outerHTML).to.equal("<div>1</div>");

      projection.update(h("div", ["",""]));
      expect(projection.domNode.outerHTML).to.equal("<div></div>");

      projection.update(h("div", ["", "1", ""]));
      expect(projection.domNode.outerHTML).to.equal("<div>1</div>");
    });


  });
});
{'fraction_non_alphanumeric': 0.2335209003215434, 'fraction_numerical': 0.006832797427652733, 'mean_word_length': 4.375809935205184, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, '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': '5350369', 'n_tokens_mistral': 835, 'n_tokens_neox': 807, 'n_words': 111}