parent
2d92d1ec16
commit
beea262e6f
@ -1,72 +1,51 @@
|
||||
'use strict';
|
||||
import { assert } from 'chai';
|
||||
import { compile } from 'sass';
|
||||
import { readFileSync } from 'fs';
|
||||
import { Options } from 'sass/types/options';
|
||||
|
||||
const chai = require('chai');
|
||||
const assert = chai.assert;
|
||||
const expected = readFileSync(__dirname + '/sass/aliases/expected.css').toString().trim();
|
||||
const expectedAlpha = readFileSync(__dirname + '/sass/aliases/expected-alpha.css').toString().trim();
|
||||
|
||||
const sass = require('sass');
|
||||
const fs = require('fs');
|
||||
|
||||
const expected = fs.readFileSync(__dirname + '/sass/aliases/expected.css').toString().trim();
|
||||
const expectedAlpha = fs.readFileSync(__dirname + '/sass/aliases/expected-alpha.css').toString().trim();
|
||||
const options: Options<'sync'> = {
|
||||
style: 'compressed',
|
||||
}
|
||||
|
||||
describe('hsv()', function () {
|
||||
it('works', function () {
|
||||
const actual = sass.renderSync({
|
||||
file: __dirname + '/sass/aliases/hsv-test.scss',
|
||||
outputStyle: 'compressed',
|
||||
}).css.toString().trim();
|
||||
|
||||
const actual = compile(__dirname + '/sass/aliases/hsv-test.scss', options).css.toString().trim();
|
||||
assert.equal(actual, expected);
|
||||
});
|
||||
});
|
||||
|
||||
describe('hsb()', function () {
|
||||
it('works', function () {
|
||||
const actual = sass.renderSync({
|
||||
file: __dirname + '/sass/aliases/hsb.scss',
|
||||
outputStyle: 'compressed',
|
||||
}).css.toString().trim();
|
||||
|
||||
const actual = compile(__dirname + '/sass/aliases/hsb.scss', options).css.toString().trim();
|
||||
assert.equal(actual, expected);
|
||||
});
|
||||
});
|
||||
|
||||
describe('hsva()', function () {
|
||||
it('works', function () {
|
||||
const actual = sass.renderSync({
|
||||
file: __dirname + '/sass/aliases/hsva.scss',
|
||||
outputStyle: 'compressed',
|
||||
}).css.toString().trim();
|
||||
|
||||
const actual = compile(__dirname + '/sass/aliases/hsva.scss', options).css.toString().trim();
|
||||
assert.equal(actual, expectedAlpha);
|
||||
});
|
||||
|
||||
it('requires alpha param', function () {
|
||||
assert.throws(function () {
|
||||
sass.renderSync({
|
||||
file: __dirname + '/sass/aliases/hsva-error.scss',
|
||||
outputStyle: 'compressed',
|
||||
});
|
||||
compile(__dirname + '/sass/aliases/hsva-error.scss', options);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('hsba()', function () {
|
||||
it('works', function () {
|
||||
const actual = sass.renderSync({
|
||||
file: __dirname + '/sass/aliases/hsba.scss',
|
||||
outputStyle: 'compressed',
|
||||
}).css.toString().trim();
|
||||
|
||||
const actual = compile(__dirname + '/sass/aliases/hsba.scss', options).css.toString().trim();
|
||||
assert.equal(actual, expectedAlpha);
|
||||
});
|
||||
|
||||
it('requires alpha param', function () {
|
||||
assert.throws(function () {
|
||||
sass.renderSync({
|
||||
file: __dirname + '/sass/aliases/hsba-error.scss',
|
||||
outputStyle: 'compressed',
|
||||
});
|
||||
compile(__dirname + '/sass/aliases/hsba-error.scss', options);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,74 +1,49 @@
|
||||
'use strict';
|
||||
import { assert } from 'chai';
|
||||
import { compile } from 'sass';
|
||||
import { readFileSync } from 'fs';
|
||||
import { Options } from 'sass/types/options';
|
||||
|
||||
const chai = require('chai');
|
||||
const assert = chai.assert;
|
||||
const expected = readFileSync(__dirname + '/sass/angles/expected.css').toString().trim();
|
||||
|
||||
const sass = require('sass');
|
||||
const fs = require('fs');
|
||||
|
||||
const expected = fs.readFileSync(__dirname + '/sass/angles/expected.css').toString().trim();
|
||||
const options: Options<'sync'> = {
|
||||
style: 'compressed',
|
||||
}
|
||||
|
||||
describe('angle units', function () {
|
||||
it('accepts unitless as degrees', function () {
|
||||
const actual = sass.renderSync({
|
||||
file: __dirname + '/sass/angles/unitless.scss',
|
||||
outputStyle: 'compressed',
|
||||
}).css.toString().trim();
|
||||
|
||||
const actual = compile(__dirname + '/sass/angles/unitless.scss', options).css.toString().trim();
|
||||
assert.equal(actual, expected);
|
||||
});
|
||||
|
||||
it('accepts degrees', function () {
|
||||
const actual = sass.renderSync({
|
||||
file: __dirname + '/sass/angles/deg.scss',
|
||||
outputStyle: 'compressed',
|
||||
}).css.toString().trim();
|
||||
|
||||
const actual = compile(__dirname + '/sass/angles/deg.scss', options).css.toString().trim();
|
||||
assert.equal(actual, expected);
|
||||
});
|
||||
|
||||
it('accepts radians', function () {
|
||||
const actual = sass.renderSync({
|
||||
file: __dirname + '/sass/angles/rad.scss',
|
||||
outputStyle: 'compressed',
|
||||
}).css.toString().trim();
|
||||
|
||||
const actual = compile(__dirname + '/sass/angles/rad.scss', options).css.toString().trim();
|
||||
assert.equal(actual, expected);
|
||||
});
|
||||
|
||||
it('accepts turns', function () {
|
||||
const actual = sass.renderSync({
|
||||
file: __dirname + '/sass/angles/turn.scss',
|
||||
outputStyle: 'compressed',
|
||||
}).css.toString().trim();
|
||||
|
||||
const actual = compile(__dirname + '/sass/angles/turn.scss', options).css.toString().trim();
|
||||
assert.equal(actual, expected);
|
||||
});
|
||||
|
||||
it('accepts grads', function () {
|
||||
const actual = sass.renderSync({
|
||||
file: __dirname + '/sass/angles/grad.scss',
|
||||
outputStyle: 'compressed',
|
||||
}).css.toString().trim();
|
||||
|
||||
const actual = compile(__dirname + '/sass/angles/grad.scss', options).css.toString().trim();
|
||||
assert.equal(actual, expected);
|
||||
});
|
||||
|
||||
it('does not allow incompatible units: %', function () {
|
||||
assert.throws(function () {
|
||||
sass.renderSync({
|
||||
file: __dirname + '/sass/angles/percent.scss',
|
||||
outputStyle: 'compressed',
|
||||
});
|
||||
compile(__dirname + '/sass/angles/percent.scss', options);
|
||||
});
|
||||
});
|
||||
|
||||
it('does not allow incompatible units: pt', function () {
|
||||
assert.throws(function () {
|
||||
sass.renderSync({
|
||||
file: __dirname + '/sass/angles/pt.scss',
|
||||
outputStyle: 'compressed',
|
||||
});
|
||||
compile(__dirname + '/sass/angles/pt.scss', options);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,47 +1,34 @@
|
||||
'use strict';
|
||||
import { assert } from 'chai';
|
||||
import { compile } from 'sass';
|
||||
import { readFileSync } from 'fs';
|
||||
import { Options } from 'sass/types/options';
|
||||
|
||||
const chai = require('chai');
|
||||
const assert = chai.assert;
|
||||
const expected = readFileSync(__dirname + '/sass/frac/expected.css').toString().trim();
|
||||
|
||||
const sass = require('sass');
|
||||
const fs = require('fs');
|
||||
|
||||
const expected = fs.readFileSync(__dirname + '/sass/frac/expected.css').toString().trim();
|
||||
const options: Options<'sync'> = {
|
||||
style: 'compressed',
|
||||
}
|
||||
|
||||
describe('fraction units', function () {
|
||||
it('accepts unitless as fractions', function () {
|
||||
const actual = sass.renderSync({
|
||||
file: __dirname + '/sass/frac/fraction.scss',
|
||||
outputStyle: 'compressed',
|
||||
}).css.toString().trim();
|
||||
|
||||
const actual = compile(__dirname + '/sass/frac/fraction.scss', options).css.toString().trim();
|
||||
assert.equal(actual, expected);
|
||||
});
|
||||
|
||||
it('accepts percent', function () {
|
||||
const actual = sass.renderSync({
|
||||
file: __dirname + '/sass/frac/percent.scss',
|
||||
outputStyle: 'compressed',
|
||||
}).css.toString().trim();
|
||||
|
||||
const actual = compile(__dirname + '/sass/frac/percent.scss', options).css.toString().trim();
|
||||
assert.equal(actual, expected);
|
||||
});
|
||||
|
||||
it('does not allow incompatible units: deg', function () {
|
||||
assert.throws(function () {
|
||||
sass.renderSync({
|
||||
file: __dirname + '/sass/frac/deg.scss',
|
||||
outputStyle: 'compressed',
|
||||
});
|
||||
compile(__dirname + '/sass/frac/deg.scss', options);
|
||||
});
|
||||
});
|
||||
|
||||
it('does not allow incompatible units: pt', function () {
|
||||
assert.throws(function () {
|
||||
sass.renderSync({
|
||||
file: __dirname + '/sass/frac/pt.scss',
|
||||
outputStyle: 'compressed',
|
||||
});
|
||||
compile(__dirname + '/sass/frac/pt.scss', options);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -0,0 +1,2 @@
|
||||
{
|
||||
}
|
Loading…
Reference in new issue