Skip to content

Commit

Permalink
Fix issue #64
Browse files Browse the repository at this point in the history
  • Loading branch information
evilaliv3 committed May 17, 2020
1 parent 6cb1a8c commit d366294
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 29 deletions.
2 changes: 0 additions & 2 deletions src/prefixes-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@ module.exports = ({prefix}) => ({
prefixes: {
ltr: `[${prefix}=ltr]`,
rtl: `[${prefix}=rtl]`,
dir: `[${prefix}]`,
},
regex: new RegExp(`\\[${prefix}(=(\\w+|"\\w+"))?\\]`),
},
class: {
prefixes: {
ltr: `.${prefix}-ltr`,
rtl: `.${prefix}-rtl`,
dir: `.${prefix}`,
},
regex: new RegExp(`\\.${prefix}(-\\w+)?`),
},
Expand Down
27 changes: 0 additions & 27 deletions src/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,39 +16,12 @@ const run = (t, input, output, opts) => postcss([
t.is(result.warnings().length, 0);
});

test('Should NOT add [dir] prefix to symmetric rules', t => run(t,
'a { font-size: 1em }',
'a { font-size: 1em }'));

test('Should ONLY create LTR & RTL rules to asymmetric rules', t => run(t,
'a { font-size: 1em; text-align: left }',
'a { font-size: 1em }'
+ '[dir=ltr] a { text-align: left }'
+ '[dir=rtl] a { text-align: right }'));

test('Should add [dir] prefix to symmetric rules with direction related declarations', t => run(t,
'a { text-align: center }',
'[dir] a { text-align: center }'));

test('Should add [dir] prefix to symmetric rules with direction related declarations (2)', t => run(t,
'a { font-size: 1em; text-align: center }',
'a { font-size: 1em }'
+ '[dir] a { text-align: center }'));

test('Should add [dir] prefix to symmetric rules with direction related declarations (3)', t => run(t,
'a { text-align: left }'
+ 'a { text-align: center }',
'[dir=ltr] a { text-align: left }'
+ '[dir=rtl] a { text-align: right }'
+ '[dir] a { text-align: center }'));

test('Should add [dir] prefix to symmetric rules with direction related declarations (4)', t => run(t,
'a { margin: 0 10px 0 0 }'
+ 'a { margin-top: 20px }',
'[dir=ltr] a { margin: 0 10px 0 0 }'
+ '[dir=rtl] a { margin: 0 0 0 10px }'
+ '[dir] a { margin-top: 20px }'));

test('Creates both LTR & RTL rules for asymmetric declarations', t => run(t,
'a { text-align: left }',
'[dir=ltr] a { text-align: left }'
Expand Down

0 comments on commit d366294

Please sign in to comment.