|
1 | 1 | const interleave = require('../src/utils/tagged-template-literal').interleave
|
| 2 | +const hasInterpolationTag = require('../src/utils/tagged-template-literal').hasInterpolationTag |
| 3 | +const parseInterpolationTag = require('../src/utils/tagged-template-literal').parseInterpolationTag |
2 | 4 | const isLastDeclarationCompleted = require('../src/utils/general').isLastDeclarationCompleted
|
3 | 5 | const nextNonWhitespaceChar = require('../src/utils/general').nextNonWhitespaceChar
|
4 | 6 | const reverseString = require('../src/utils/general').reverseString
|
@@ -335,4 +337,41 @@ describe('utils', () => {
|
335 | 337 | expect(fn(' \tstylelint-disable \t')).toBe(true)
|
336 | 338 | })
|
337 | 339 | })
|
| 340 | + |
| 341 | + describe('hasInterpolationTag', () => { |
| 342 | + const fn = hasInterpolationTag |
| 343 | + it('works for starting comment', () => { |
| 344 | + const expression = { |
| 345 | + leadingComments: [{ value: ' scp-block ' }], |
| 346 | + trailingComments: [] |
| 347 | + } |
| 348 | + expect(fn(expression)).toBe(true) |
| 349 | + }) |
| 350 | + |
| 351 | + it('correctly identifies lack of tag', () => { |
| 352 | + const expression = { |
| 353 | + leadingComments: [{ value: 'some test value' }], |
| 354 | + trailingComments: [{ value: 'second test value' }] |
| 355 | + } |
| 356 | + expect(fn(expression)).toBe(false) |
| 357 | + }) |
| 358 | + }) |
| 359 | + |
| 360 | + describe('parseInterpolationTag', () => { |
| 361 | + const fn = parseInterpolationTag |
| 362 | + it('correctly works as dummy', () => { |
| 363 | + // This is temporary |
| 364 | + const expression1 = { |
| 365 | + leadingComments: [{ value: ' scp-block ' }], |
| 366 | + trailingComments: [] |
| 367 | + } |
| 368 | + expect(fn(expression1)).toBe('-interpolation-tag-mixin: test') |
| 369 | + |
| 370 | + const expression2 = { |
| 371 | + leadingComments: [{ value: 'some test value' }], |
| 372 | + trailingComments: [{ value: 'second test value' }] |
| 373 | + } |
| 374 | + expect(fn(expression2)).toBe(undefined) |
| 375 | + }) |
| 376 | + }) |
338 | 377 | })
|
0 commit comments