<commit_before>import { equal, deepEqual, doesNotThrow, throws } from 'assert';
import html from '../lib/html';
import createTree from '../lib/tree/create';
import validateMemory from './util/validateMemory';

describe('HTML (Tagged template)', function() {
  afterEach(() => validateMemory());

  it('will return null when passed a falsy value', () => {
    equal(html(), null);
    equal(html(null), null);
    equal(html(undefined), null);
    equal(html(0), null);
    equal(html(NaN), null);
    equal(html(false), null);
  });

  it('will support running as a standalone function', () => {
    equal(html('<div/>').nodeName, 'div');
  });

  it('will interpolate a single string value in an attribute', function() {
    const foo = 'foo';
    const span = html`<span class="${foo}" />`;

    equal(span.attributes.class, 'foo');
  });

  it('will interpolate multiple string values in an attribute', function() {
    const foo = 'foo';
    const bar = 'bar';

    const multipleValues = html`<span class="${foo} ${bar}" />`;

    equal(multipleValues.attributes.class, 'foo bar');
  });

  it('will interpolate value-less attributes', function() {
    const checked = 'checked';
    const input = html`<input type="checkbox" ${checked}>`;
<commit_msg>Add in test for namespace attributes<commit_after>import { equal, deepEqual, doesNotThrow, throws } from 'assert';
import html from '../lib/html';
import createTree from '../lib/tree/create';
import validateMemory from './util/validateMemory';

describe('HTML (Tagged template)', function() {
  afterEach(() => validateMemory());

  it('will return null when passed a falsy value', () => {
    equal(html(), null);
    equal(html(null), null);
    equal(html(undefined), null);
    equal(html(0), null);
    equal(html(NaN), null);
    equal(html(false), null);
  });

  it('will support running as a standalone function', () => {
    equal(html('<div/>').nodeName, 'div');
  });

  it('will interpolate a single string value in an attribute', function() {
    const foo = 'foo';
    const span = html`<span class="${foo}" />`;

    equal(span.attributes.class, 'foo');
  });

  it('will interpolate multiple string values in an attribute', function() {
    const foo = 'foo';
    const bar = 'bar';

    const multipleValues = html`<span class="${foo} ${bar}" />`;

    equal(multipleValues.attributes.class, 'foo bar');
  });

  it('will support namespace attributes', function() {
    const div = html`<div ns:key="value" />`;

    equal(div.attributes['ns:key'], 'value');
  });

  it('will interpolate value-less attributes', function() {
    const checked = 'checked';
    const input = html`<input type="checkbox" ${checked}>`;

{'fraction_non_alphanumeric': 0.17942050520059435, 'fraction_numerical': 0.0007429420505200594, 'mean_word_length': 4.0336448598130845, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 18, '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': '5977341', 'n_tokens_mistral': 804, 'n_tokens_neox': 775, 'n_words': 234}