Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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