Skip to content

Commit bfee215

Browse files
committed
Add tests for styles in Vue components
1 parent e19b012 commit bfee215

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

__tests__/index.spec.js

+19
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,29 @@ describe('js-to-styles-vars-loader', () => {
257257
expect(operator.getPreprocessorType({ resource: '/path/to/resource.sass'})).toEqual('sass');
258258
});
259259

260+
it('should recognise sass resource in vue inline style', () => {
261+
expect(operator.getPreprocessorType({ resource: '/path/to/resource.vue?vue&type=style&index=0&id=2964abc9&scoped=true&lang=scss&'})).toEqual('sass');
262+
expect(operator.getPreprocessorType({ resource: '/path/to/resource.vue?vue&type=style&index=0&id=2964abc9&scoped=true&lang=sass&'})).toEqual('sass');
263+
});
264+
265+
it('should recognise sass resource in vue external style', () => {
266+
expect(operator.getPreprocessorType({ resource: '/path/to/resource.scss?vue&type=style&index=0&id=0e4a89e8&scoped=true&lang=css&'})).toEqual('sass');
267+
expect(operator.getPreprocessorType({ resource: '/path/to/resource.sass?vue&type=style&index=0&id=0e4a89e8&scoped=true&lang=css&'})).toEqual('sass');
268+
});
269+
260270
it('should recognise less resource', () => {
261271
expect(operator.getPreprocessorType({ resource: '/path/to/resource.less'})).toEqual('less');
262272
});
263273

274+
275+
it('should recognise sass resource in less inline style', () => {
276+
expect(operator.getPreprocessorType({ resource: '/path/to/resource.vue?vue&type=style&index=0&id=2964abc9&scoped=true&lang=less&'})).toEqual('less');
277+
});
278+
279+
it('should recognise sass resource in less external style', () => {
280+
expect(operator.getPreprocessorType({ resource: '/path/to/resource.less?vue&type=style&index=0&id=0e4a89e8&scoped=true&lang=css&'})).toEqual('less');
281+
});
282+
264283
it('throw error if proprocessor type is unknown', () => {
265284
const caller = () => {
266285
operator.getPreprocessorType({ resource: 'unknown.extension'});

0 commit comments

Comments
 (0)