Skip to content

Commit

Permalink
fix(component name parsing): only switching out the word 'compoent/' …
Browse files Browse the repository at this point in the history
…if it is what starts the path, not for nest options. This should be revisited with unification Closes #236
  • Loading branch information
webark committed Jul 31, 2017
1 parent 2625b05 commit 54e087e
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 1 deletion.
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}}

0 comments on commit 54e087e

Please sign in to comment.