Skip to content

Only replacing 'components/' if it's at the start of the path name. #238

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 31, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/component-names.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var md5 = require('md5');
module.exports = {
path: function(actualPath, classicStyleDir) {
var terminator = '/';
var pathSegementToRemove = 'components/';
var pathSegementToRemove = /^components\//;

if (actualPath.includes(classicStyleDir)) {
terminator = '.';
Expand Down
12 changes: 12 additions & 0 deletions tests/acceptance/unique-component-paths-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { test } from 'qunit';
import moduleForAcceptance from '../../tests/helpers/module-for-acceptance';

moduleForAcceptance(`Acceptance | Unique Paths`);

test('base rule followed', function(assert) {
visit(`/unique-component-paths`);

andThen(function() {
assert.equal(find('h1').css('color'), 'rgb(0, 0, 14)');
});
});
1 change: 1 addition & 0 deletions tests/dummy/app/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export default Ember.Router.extend({
this.route('no-style-files-yet');
this.route('classic-structure');
this.route('classic-structure-nested');
this.route('unique-component-paths');

this.route('addon', function() {
this.route('scss');
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
h1 {
color: rgb(0, 0, 14);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h1> my color should be rgb(0, 0, 14) </h1>
1 change: 1 addition & 0 deletions tests/dummy/app/unique-component-paths/template.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{unique-component-paths/-components/test-component}}