Skip to content

Commit

Permalink
fix(scss @ rules): now allowing namespaceing of rules deinfed inside …
Browse files Browse the repository at this point in the history
…of a scss @ for rule. Fixes #216
  • Loading branch information
webark committed Feb 24, 2017
1 parent 24d03ef commit 6840c5e
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ember-cli-build.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
/* eslint-env node */
'use strict';

var EmberAddon = require('ember-cli/lib/broccoli/ember-addon');
let EmberAddon = require('ember-cli/lib/broccoli/ember-addon');

module.exports = function(defaults) {
var app = new EmberAddon(defaults, {
// Add options here
let app = new EmberAddon(defaults, {
"ember-cli-babel": {
includePolyfill: true
},
});

/*
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"eslint-plugin-ember-suave": "^1.0.0",
"loader.js": "^4.0.10",
"no-style-files-yet": "file:./tests/dummy/lib/no-style-files-yet",
"postcss-selector-namespace": "^1.3.0",
"second-test-addon": "file:./tests/dummy/lib/second-test-addon",
"test-addon": "file:./tests/dummy/lib/test-addon"
},
Expand Down
11 changes: 11 additions & 0 deletions tests/acceptance/scss-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,14 @@ test('mixin psudo elements do not get scoped', function(assert) {
assert.equal(item.css('color'), 'rgb(0, 0, 6)');
});
});

test('children of root @for rules are namspaced', function(assert) {
visit(`/${TYPE}`);

andThen(function() {
for (let index of Array(10).keys()) {
let item = find(`[class$=__element--${index}]`);
assert.equal(item.css('color'), `rgb(0, 0, ${index})`);
}
});
});
9 changes: 9 additions & 0 deletions tests/dummy/app/components/scss/for-loop/component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Ember from 'ember';

const {
Component,
} = Ember;

export default Component.extend({
items: [...Array(10).keys()],
});
5 changes: 5 additions & 0 deletions tests/dummy/app/components/scss/for-loop/styles.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@for $index from 0 through 9 {
&__element--#{$index} {
color: rgb(0, 0, $index);
}
}
3 changes: 3 additions & 0 deletions tests/dummy/app/components/scss/for-loop/template.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{{#each items as |item|}}
<span class="{{componentCssClassName}}__element--{{item}}"></span>
{{/each}}
1 change: 1 addition & 0 deletions tests/dummy/app/scss/template.hbs
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
{{scss/base-rules}}
{{scss/for-loop}}

0 comments on commit 6840c5e

Please # to comment.