<commit_before>'use strict'
const render = require('../../render')
const test = require('tape')
const parse = require('parse-element')
const s = require('vigour-state/s')
const strip = require('vigour-util/strip/formatting')

test('$test - $switch', function (t) {
  const state = s({
    field: { first: true },
    lulz: true,
    bla: true,
    navigation: {}
  })

  var app = render({
    switcher: {
      tag: 'switcher',
      $: 'navigation.$switch',
      $switch: (state) => state.key,
      properties: {
        field: {
          tag: 'field',
          first: {
            tag: 'first',
            $: 'first.$test',
            $test: (state) => state.compute() === true
          }
        },
        lulz: {
          tag: 'lulz',
          $: '$root.bla.$test',
          $test: (state) => state.compute() === true
        }
      }
    }
  }, state)

  t.same(
    parse(app),
    '<div><switcher></switcher></div>',
    'correct html on intial state'
  )

  state.navigation.set('$root.field')

  t.same(
    parse(app),
    strip(`
      <div>
        <switcher>
          <field>
            <first></first>
          </field>
        </switcher>
      </div>
    `),
    'set switcher'
  )

  state.navigation.set('$root.lulz')

  t.same(
    parse(app),
    strip(`
      <div>
        <switcher>
          <lulz></lulz>
        </switcher>
      </div>
    `),
    'switch to other property'
  )

  t.end()
})
<commit_msg>fixed test (fires for remove now -- may break soem stuff)<commit_after>'use strict'
const render = require('../../render')
const test = require('tape')
const parse = require('parse-element')
const s = require('vigour-state/s')
const strip = require('vigour-util/strip/formatting')

test('$test - $switch', function (t) {
  const state = s({
    field: { first: true },
    lulz: true,
    bla: true,
    navigation: {}
  })

  var app = render({
    switcher: {
      tag: 'switcher',
      $: 'navigation.$switch',
      $switch: (state) => state.key,
      properties: {
        field: {
          tag: 'field',
          first: {
            tag: 'first',
            $: 'first.$test',
            $test: (state) => state && state.compute() === true
          }
        },
        lulz: {
          tag: 'lulz',
          $: '$root.bla.$test',
          $test: (state) => state && state.compute() === true
        }
      }
    }
  }, state)

  t.same(
    parse(app),
    '<div><switcher></switcher></div>',
    'correct html on intial state'
  )

  state.navigation.set('$root.field')

  t.same(
    parse(app),
    strip(`
      <div>
        <switcher>
          <field>
            <first></first>
          </field>
        </switcher>
      </div>
    `),
    'set switcher'
  )

  state.navigation.set('$root.lulz')

  t.same(
    parse(app),
    strip(`
      <div>
        <switcher>
          <lulz></lulz>
        </switcher>
      </div>
    `),
    'switch to other property'
  )

  t.end()
})

{'fraction_non_alphanumeric': 0.18175675675675676, 'fraction_numerical': 0.0, 'mean_word_length': 1.734072022160665, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 45, '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': '4969209', 'n_tokens_mistral': 1015, 'n_tokens_neox': 1010, 'n_words': 207}