katoikia-app/web-ui/web-react/node_modules/postcss-attribute-case-inse.../test/test.js

57 lines
1.2 KiB
JavaScript
Raw Normal View History

2022-07-06 04:15:11 +00:00
import postcss from 'postcss';
import { expect } from 'chai';
import plugin from '..';
const test = (input, output, opts, done) => {
postcss([
plugin(opts)
])
.process(input, { from: '<inline>' })
.then(result => {
expect(result.css).to.eql(output);
expect(result.warnings()).to.be.empty; // eslint-disable-line no-unused-expressions
done();
})
.catch(done);
};
describe('postcss-attribute-case-insensitive', () => {
it('simple', done => {
test(
'[data-foo=test i] { display: block; }',
'[data-foo=test],[data-foo=Test],[data-foo=tEst],[data-foo=TEst],[data-foo=teSt],[data-foo=TeSt],[data-foo=tESt],[data-foo=TESt],[data-foo=tesT],[data-foo=TesT],[data-foo=tEsT],[data-foo=TEsT],[data-foo=teST],[data-foo=TeST],[data-foo=tEST],[data-foo=TEST] { display: block; }',
{},
done
);
});
it('with spaces', done => {
test(
'[foo="a b" i]{}',
'[foo="a b"],[foo="A b"],[foo="a B"],[foo="A B"]{}',
{},
done
);
});
it('not insensitive', done => {
test(
'[foo=a]{}',
'[foo=a]{}',
{},
done
);
});
it('several attributes', done => {
test(
'[foo=a i],[foobar=b],[bar=c i]{}',
'[foobar=b],[foo=a],[foo=A],[bar=c],[bar=C]{}',
{},
done
);
});
});