var assert = require('assert');

describe('lesshint', function () {
    var linter = require('../../../lib/linter');
    var propertyOrdering = require('../../../lib/linters/property_ordering');

    describe('#propertyOrdering()', function () {
        it('should allow blocks with only one property', function () {
            var source = '.foo { color: red; }';
            var ast;

            var options = {
                propertyOrdering: {
                    enabled: true,
                    style: 'alpha'
                }
            };

            ast = linter.parseAST(source);
            ast = ast.first().first('block');

            assert.strictEqual(null, propertyOrdering({
                config: options,
                node: ast
            }));
        });

        it('should allow blocks with alphabetized properties', function () {
            var source = '.foo { color: red; padding-top: 4px; right: 5px}';
            var ast;

            var options = {
                propertyOrdering: {
                    enabled: true,
                    style: 'alpha'
                }
            };

            ast = linter.parseAST(source);
            ast = ast.first().first('block');

            assert.strictEqual(null, propertyOrdering({
                config: options,
                node: ast
            }));
        });

        it('should not allow blocks with non-alphabetized properties', function () {
            var source = '.foo { padding-top: 4px; color: red; right: 5px}';
            var actual;
            var ast;

            var expected = {
                column: 26,
                line: 1,
                linter: 'propertyOrdering',
                message: 'Property ordering is not alphabetized'
            };

            var options = {
                propertyOrdering: {
                    enabled: true,
                    style: 'alpha'
                }
            };

            ast = linter.parseAST(source);
            ast = ast.first().first('block');

            actual = propertyOrdering({
                config: options,
                node: ast
            });

            assert.deepEqual(actual, expected);
        });

        it('should throw on invalid "style" value', function () {
            var source = '.foo { border: 0; }';
            var ast;

            var options = {
                propertyOrdering: {
                    enabled: true,
                    style: 'invalid'
                }
            };

            ast = linter.parseAST(source);
            ast = ast.first().first('block').first('declaration');

            assert.throws(propertyOrdering.bind(null, {
                config: options,
                node: ast
            }), Error);
        });
    });
});

@@ -2205,32 +2205,1059 @@
 );%0A        %7D);%0A%0A
+        it('should return null when disabled', function () %7B%0A            var source = '.foo %7B font-size: 16px; border: 0; %7D';%0A            var ast;%0A%0A            var options = %7B%0A                propertyOrdering: %7B%0A                    enabled: false%0A                %7D%0A            %7D;%0A%0A            ast = linter.parseAST(source);%0A            ast = ast.first().first('block').first('declaration');%0A%0A            assert.equal(null, propertyOrdering(%7B%0A                config: options,%0A                node: ast%0A            %7D));%0A        %7D);%0A%0A        it('should return null when disabled via shorthand', function () %7B%0A            var source = '.foo %7B font-size: 16px; border: 0; %7D';%0A            var ast;%0A%0A            var options = %7B%0A                propertyOrdering: false%0A            %7D;%0A%0A            ast = linter.parseAST(source);%0A            ast = ast.first().first('block').first('declaration');%0A%0A            assert.equal(null, propertyOrdering(%7B%0A                config: options,%0A                node: ast%0A            %7D));%0A        %7D);%0A%0A
         it('shou

Add tests for disabled propertyOrdering