Merge pull request #303 from jackmcdade/master

Prevent @apply from adding !important.
This commit is contained in:
Adam Wathan 2017-12-11 16:42:14 -05:00 committed by GitHub
commit 0c671fbd3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View File

@ -14,6 +14,15 @@ test("it copies a class's declarations into itself", () => {
})
})
test('it removes important from applied classes', () => {
const output = '.a { color: red !important; } .b { color: red; }'
return run('.a { color: red !important; } .b { @apply .a; }').then(result => {
expect(result.css).toEqual(output)
expect(result.warnings().length).toBe(0)
})
})
test('it fails if the class does not exist', () => {
return run('.b { @apply .a; }').catch(e => {
expect(e).toMatchObject({ name: 'CssSyntaxError' })

View File

@ -58,6 +58,10 @@ export default function() {
})
})
decls.forEach(decl => {
decl.important = false
})
atRule.before(decls)
atRule.params = customProperties.join(' ')