<commit_before>var test = require('tape');
var Quilt = require('../quilt');
var Backbone = require('backbone');
Backbone.$ = require('jquery/dist/jquery')(window);

test('data-show', function(t) {
  var view = new Quilt.View({
    template: function(){
      return '<p><i data-show="x"></i></p>';
    },
    model: new Backbone.Model({x: true})
  }).render();
  t.ok(!view.$('i').is('[class*=hide-view]'));
  view.model.set({x: false});
  t.ok(view.$('i').is('[class*=hide-view]'));
  t.end();
});

test('data-hide', function(t) {
  var view = new Quilt.View({
    template: function() {
      return '<p><i data-hide="x"></i></p>';
    },
    model: new Backbone.Model({x: true})
  }).render();
  t.ok(view.$('i').is('[class*=hide-view]'));
  view.model.set({x: false});
  t.ok(!view.$('i').is('[class*=hide-view]'));
  t.end();
});

test('missing model', 0, function(t) {
  new Quilt.View({
    template: function() {
      return '<p><i data-hide="x"></i></p>';
    }
  }).render();
  t.end();
});<commit_msg>Add a test.<commit_after>var test = require('tape');
var Quilt = require('../quilt');
var Backbone = require('backbone');
Backbone.$ = require('jquery/dist/jquery')(window);

test('data-show', function(t) {
  var view = new Quilt.View({
    template: function(){
      return '<i data-show="x"></i>';
    },
    model: new Backbone.Model({x: true})
  }).render();
  t.ok(!view.$('i').is('[class*=hide-view]'));
  view.model.set({x: false});
  t.ok(view.$('i').is('[class*=hide-view]'));
  t.end();
});

test('data-hide', function(t) {
  var view = new Quilt.View({
    template: function() {
      return '<i data-hide="x"></i>';
    },
    model: new Backbone.Model({x: true})
  }).render();
  t.ok(view.$('i').is('[class*=hide-view]'));
  view.model.set({x: false});
  t.ok(!view.$('i').is('[class*=hide-view]'));
  t.end();
});

test('missing model', 0, function(t) {
  new Quilt.View({
    template: function() {
      return '<i data-hide="x"></i>';
    }
  }).render();
  t.end();
});

test('Multiple show views.', function(t) {
  var view = new Quilt.View({
    model: new Backbone.Model({foo: false, bar: false}),
    template: function() {
      return '<i data-show="foo" data-hide="bar"></i>';
    }
  }).render();
  t.ok(view.$('i').is('[class*=hide-view]'));
  t.end();
});
{'fraction_non_alphanumeric': 0.27925184862983904, 'fraction_numerical': 0.0008699434536755111, 'mean_word_length': 3.6558704453441297, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, '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': '3337753', 'n_tokens_mistral': 863, 'n_tokens_neox': 851, 'n_words': 157}