<commit_before>'use strict';

var check = require('./check');
var throws = require('./throws');

describe('lost-column', function() {
  describe('flexbox support', function() {
    it('supports being set in long form', function() {
      check(
        'a { lost-column: 1/3; lost-column-flexbox: flex; }',
        'a { flex-grow: 0; flex-shrink: 0; flex-basis: calc(99.9% * 1/3 - (30px - 30px * 1/3));' +
          'max-width: calc(99.9% * 1/3 - (30px - 30px * 1/3)); width:calc(99.9% * 1/3 - (30px - 30px * 1/3)); }' +
          'a:nth-child(1n) { margin-right: 30px; margin-left: 0; } a:last-child{ margin-right: 0; }' +
          'a:nth-child(3n) { margin-right: 0; margin-left: auto; }'
      );
      throws(
        'a { lost-column: 1/2; lost-column-flexbox: flexible; }',
        "lost-column-flexbox: property 'flexible' is unknown."
      );
    });
  });

  it('provides 3 column layout', function() {
    check(
      'a { lost-column: 1/3; }',
      'a { width: calc(99.9% * 1/3 - (30px - 30px * 1/3)); }\n' +
        'a:nth-child(1n) { float: left; margin-right: 30px; clear: none; }\n' +
        'a:last-child { margin-right: 0; }\n' +
        'a:nth-child(3n) { margin-right: 0; float: right; }\n' +
        'a:nth-child(3n + 1) { clear: both; }'
    );
  });

  it('provides 2/5 column layout', function() {
    check(
      'a { lost-column: 2/5; }',<commit_msg>Adds test for issue #435<commit_after>'use strict';

var check = require('./check');
var throws = require('./throws');

describe('lost-column', function() {
  describe('flexbox support', function() {
    it('supports being set in long form', function() {
      check(
        'a { lost-column: 1/3; lost-column-flexbox: flex; }',
        'a { flex-grow: 0; flex-shrink: 0; flex-basis: calc(99.9% * 1/3 - (30px - 30px * 1/3));' +
          'max-width: calc(99.9% * 1/3 - (30px - 30px * 1/3)); width:calc(99.9% * 1/3 - (30px - 30px * 1/3)); }' +
          'a:nth-child(1n) { margin-right: 30px; margin-left: 0; } a:last-child{ margin-right: 0; }' +
          'a:nth-child(3n) { margin-right: 0; margin-left: auto; }'
      );
      throws(
        'a { lost-column: 1/2; lost-column-flexbox: flexible; }',
        "lost-column-flexbox: property 'flexible' is unknown."
      );
    });
  });

  it('provides 3 column layout', function() {
    check(
      'a { lost-column: 1/3; }',
      'a { width: calc(99.9% * 1/3 - (30px - 30px * 1/3)); }\n' +
        'a:nth-child(1n) { float: left; margin-right: 30px; clear: none; }\n' +
        'a:last-child { margin-right: 0; }\n' +
        'a:nth-child(3n) { margin-right: 0; float: right; }\n' +
        'a:nth-child(3n + 1) { clear: both; }'
    );
  });

  it('generates valid output even with spaces at various places in the declaration', function() {
    check(
      'a { lost-column: 1 / 3; }',
      'a { width: calc(99.9% * 1/3 - (30px - 30px * 1/3)); }\n' +
        'a:nth-child(1n) { float: left; margin-right: 30px; clear: none; }\n' +
        'a:last-child { margin-right: 0; }\n' +
        'a:nth-child(3n) { margin-right: 0; float: right; }\n' +
        'a:nth-child(3n + 1) { clear: both; }'
    );
  });

  it('provides 2/5 column layout', function() {
    check(
      'a { lost-column: 2/5; }',
{'fraction_non_alphanumeric': 0.21408711770157554, 'fraction_numerical': 0.051899907321594066, 'mean_word_length': 2.33470648815654, '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': '6232159', 'n_tokens_mistral': 1364, 'n_tokens_neox': 1249, 'n_words': 292}