<commit_before>﻿///<reference path='../typings/tsd.d.ts'/>
import { expect } from 'chai';
import plugin from '../lib/plugin';
import postcss from 'postcss';

// ReSharper disable WrongExpressionStatement
describe('postcss-nested-props plugin', () => {

	it('unwraps a nested property', () => {
		check(
			'a{b:{c:d}}',
			'a{b-c:d}'
		);
	});

	it('unwraps a deeply nested property', () => {
		check(
			'a{b:{c:{d:{e:{f:g}}}}}',
			'a{b-c-d-e-f:g}'
		);
	});

	it('unwraps two nested properties in the same rule', () => {
		check(
			'a{b:{c:{d:e}}f:{g:{h:i}}}',
			'a{b-c-d:e;f-g-h:i}'
		);
	});

	it('unwraps a property namespace paired with a value', () => {
		check(
			'a{b:c{d:e}}',
			'a{b:c;b-d:e}'
		);
	});

	it('preserves nested rules w/o a colon in the selector', () => {
		check(
			'a{b{c{d:e}}}',
			'a{b{c{d:e}}}'
		);
	});

	it('preserves the :not() pseudo-class', () => {
		check(
			'a{b:not(c){d:e}}',
			'a{b:not(c){d:e}}'
		);
	});

	it('preserves the :after pseudo-element', () => {
		check(
			'a{b:after{c:d}}',
			'a{b:after{c:d}}'
		);
	});

	it('preserves the ::after pseudo-element', () => {
		check(
			'a{b::after{c:d}}',
			'a{b::after{c:d}}'
		);
	});

});

function check(input: string, output: string) {
	const processor = postcss([plugin()]);
	expect(processor.process(input).css).to.equal(output);
}
<commit_msg>Add more tests<commit_after>﻿///<reference path='../typings/tsd.d.ts'/>
import { expect } from 'chai';
import plugin from '../lib/plugin';
import postcss from 'postcss';
const pseudoClasses = require('pseudo-classes');
const pseudoElements = require('pseudo-elements');

// ReSharper disable WrongExpressionStatement
describe('postcss-nested-props plugin', () => {

	it('unwraps a nested property', () => {
		check(
			'a{b:{c:d}}',
			'a{b-c:d}'
		);
	});

	it('unwraps a deeply nested property', () => {
		check(
			'a{b:{c:{d:{e:{f:g}}}}}',
			'a{b-c-d-e-f:g}'
		);
	});

	it('unwraps two nested properties in the same rule', () => {
		check(
			'a{b:{c:{d:e}}f:{g:{h:i}}}',
			'a{b-c-d:e;f-g-h:i}'
		);
	});

	it('unwraps a property namespace paired with a value', () => {
		check(
			'a{b:c{d:e}}',
			'a{b:c;b-d:e}'
		);
	});

	it('preserves nested rules w/o a colon in the selector', () => {
		check(
			'a{b{c{d:e}}}',
			'a{b{c{d:e}}}'
		);
	});

	pseudoClasses().forEach(pseudoClass => {
		it(`preserves the :${pseudoClass}() pseudo-class`, () => {
			check(
				`a{b:${pseudoClass}(c){d:e}}`,
				`a{b:${pseudoClass}(c){d:e}}`
			);
		});
	});

	pseudoElements().forEach(pseudoElement => {
		it(`preserves the ::${pseudoElement} pseudo-element`, () => {
			check(
				`a{b::${pseudoElement}{c:d}}`,
				`a{b::${pseudoElement}{c:d}}`
			);
		});
	});

});

function check(input: string, output: string) {
	const processor = postcss([plugin()]);
	expect(processor.process(input).css).to.equal(output);
}

{'fraction_non_alphanumeric': 0.25308025308025306, 'fraction_numerical': 0.0, 'mean_word_length': 3.0704607046070462, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 24, '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': '7341224', 'n_tokens_mistral': 1357, 'n_tokens_neox': 1218, 'n_words': 199}