Skip to content

Commit

Permalink
Added ie opacity filter
Browse files Browse the repository at this point in the history
  • Loading branch information
renatoi committed Apr 30, 2015
1 parent ce07607 commit 26e1e9a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/atomizer.js
Expand Up @@ -285,6 +285,10 @@ Atomizer.prototype.parseConfig = function (config/*:AtomizerConfig*/, options/*:
if (prop === 'display' && value === 'inline-block') {
treeo.declarations['*display'] = 'inline';
}
/* istanbul ignore else */
if (prop === 'opacity') {
treeo.declarations.filter = 'alpha(opacity=' + parseFloat(value, 10) * 100 + ')';
}
}
if (value !== null) {
// value could be an object for custom classes with breakPoints
Expand Down
10 changes: 7 additions & 3 deletions tests/atomizer.js
Expand Up @@ -211,7 +211,7 @@ describe('Atomizer()', function () {
' }',
'}\n'
].join('\n');
var result = atomizer.getCss(config, {ie: true});
var result = atomizer.getCss(config);
expect(result).to.equal(expected);
});
it ('returns expected css for custom classes with break points with missing breakPoints', function () {
Expand All @@ -237,7 +237,7 @@ describe('Atomizer()', function () {
' }',
'}\n'
].join('\n');
var result = atomizer.getCss(config, {ie: true});
var result = atomizer.getCss(config);
expect(result).to.equal(expected);
});
it ('returns css if coliding helper and atomic rule is used at the same time', function () {
Expand Down Expand Up @@ -337,7 +337,7 @@ describe('Atomizer()', function () {
// set rules here so if helper change, we don't fail the test
var atomizer = new Atomizer();
var config = {
classNames: ['D(ib)', 'Ov(h)', 'Ov(s)', 'Ov(a)']
classNames: ['Op(.33)', 'D(ib)', 'Ov(h)', 'Ov(s)', 'Ov(a)']
};
var expected = [
'.D\\(ib\\) {',
Expand All @@ -347,6 +347,10 @@ describe('Atomizer()', function () {
'.D\\(ib\\), .Ov\\(h\\), .Ov\\(s\\), .Ov\\(a\\) {',
' zoom: 1;',
'}',
'.Op\\(\\.33\\) {',
' opacity: .33;',
' filter: alpha(opacity=33);',
'}',
'.Ov\\(h\\) {',
' overflow: hidden;',
'}',
Expand Down

0 comments on commit 26e1e9a

Please sign in to comment.