Skip to content

Commit

Permalink
fix: false component recognition for style file (#338)
Browse files Browse the repository at this point in the history
  • Loading branch information
lifeart authored Nov 8, 2021
1 parent 849140c commit c80e15e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils/path-matcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export class ClassicPathMatcher {
let fullName = str.slice(str.indexOf(strToMatch) + strToMatch.length, str.length).slice(0, -extName.length);

if (type === 'component') {
if (['component', 'template', 'index', 'index-test', 'component-test', 'styles', 'module'].includes(fileName)) {
if (['component', 'template', 'index', 'index-test', 'component-test', 'style', 'styles', 'module'].includes(fileName)) {
fullName = fullName.replace(`/${fileName}`, '');
}

Expand Down
1 change: 1 addition & 0 deletions test/utils/path-matcher-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ describe('ClassicPathMatcher', () => {
});

expect(m('frontend/app/components/audio-player/styles.css')).toEqual({ type: 'component', name: 'audio-player', scope: 'application', kind: 'style' });
expect(m('app/components/ui/bottom-container/style.css')).toEqual({ type: 'component', name: 'ui/bottom-container', scope: 'application', kind: 'style' });
expect(m('frontend/app/components/audio-player/styles.css')).toEqual({ type: 'component', name: 'audio-player', scope: 'application', kind: 'style' });
expect(m('frontend/app/components/audio-player/styles.scss')).toEqual({ type: 'component', name: 'audio-player', scope: 'application', kind: 'style' });
expect(m('frontend/app/components/audio-player/module.less')).toEqual({ type: 'component', name: 'audio-player', scope: 'application', kind: 'style' });
Expand Down

0 comments on commit c80e15e

Please # to comment.