diff --git a/lib/component-names.js b/lib/component-names.js index ed2704c..1215214 100644 --- a/lib/component-names.js +++ b/lib/component-names.js @@ -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 = '.'; diff --git a/tests/acceptance/unique-component-paths-test.js b/tests/acceptance/unique-component-paths-test.js new file mode 100644 index 0000000..ddffc9f --- /dev/null +++ b/tests/acceptance/unique-component-paths-test.js @@ -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)'); + }); +}); diff --git a/tests/dummy/app/router.js b/tests/dummy/app/router.js index db38766..a7b3aae 100644 --- a/tests/dummy/app/router.js +++ b/tests/dummy/app/router.js @@ -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'); diff --git a/tests/dummy/app/unique-component-paths/-components/test-component/styles.scss b/tests/dummy/app/unique-component-paths/-components/test-component/styles.scss new file mode 100644 index 0000000..7919e30 --- /dev/null +++ b/tests/dummy/app/unique-component-paths/-components/test-component/styles.scss @@ -0,0 +1,3 @@ +h1 { + color: rgb(0, 0, 14); +} diff --git a/tests/dummy/app/unique-component-paths/-components/test-component/template.hbs b/tests/dummy/app/unique-component-paths/-components/test-component/template.hbs new file mode 100644 index 0000000..5a2da7b --- /dev/null +++ b/tests/dummy/app/unique-component-paths/-components/test-component/template.hbs @@ -0,0 +1 @@ +