From d366294ab9ce496ce93cafb0d606493266082786 Mon Sep 17 00:00:00 2001 From: Giovanni Pellerano Date: Sun, 17 May 2020 21:24:32 +0200 Subject: [PATCH] Fix issue https://github.com/vkalinichev/postcss-rtl/issues/64 --- src/prefixes-config.js | 2 -- src/test.js | 27 --------------------------- 2 files changed, 29 deletions(-) diff --git a/src/prefixes-config.js b/src/prefixes-config.js index 9bdf552..cfb817c 100644 --- a/src/prefixes-config.js +++ b/src/prefixes-config.js @@ -3,7 +3,6 @@ module.exports = ({prefix}) => ({ prefixes: { ltr: `[${prefix}=ltr]`, rtl: `[${prefix}=rtl]`, - dir: `[${prefix}]`, }, regex: new RegExp(`\\[${prefix}(=(\\w+|"\\w+"))?\\]`), }, @@ -11,7 +10,6 @@ module.exports = ({prefix}) => ({ prefixes: { ltr: `.${prefix}-ltr`, rtl: `.${prefix}-rtl`, - dir: `.${prefix}`, }, regex: new RegExp(`\\.${prefix}(-\\w+)?`), }, diff --git a/src/test.js b/src/test.js index 2602467..98ffe67 100644 --- a/src/test.js +++ b/src/test.js @@ -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 }'