Skip to content
Permalink
Browse files
Adds support for scoped selectors in @supports queries (#908)
* Adds support for scoped selectors in @supports queries

Added testing for @supports as well

* Update test.js

* Update scope-id.js
  • Loading branch information
fimion authored and yyx990803 committed Jul 29, 2017
1 parent e6d5956 commit 7253e32a60d4a4bd8a1e7bdb1913a236249f5703
Showing with 20 additions and 1 deletion.
  1. +1 −1 lib/style-compiler/plugins/scope-id.js
  2. +7 −0 test/fixtures/supports-query.vue
  3. +12 −0 test/test.js
@@ -9,7 +9,7 @@ module.exports = postcss.plugin('add-id', function (opts) {
if (!node.selector) {
// handle media queries
if (node.type === 'atrule') {
if (node.name === 'media') {
if (node.name === 'media' || node.name === 'supports') {
node.each(rewriteSelector)
} else if (node.name === 'keyframes') {
// register keyframes
@@ -0,0 +1,7 @@
<style scoped>
@supports ( color: #000 ) {
.foo {
color: #000;
}
}
</style>
@@ -309,6 +309,18 @@ describe('vue-loader', function () {
})
})

it('supports-query', done => {
test({
entry: './test/fixtures/supports-query.vue'
}, (window) => {
var style = window.document.querySelector('style').textContent
style = normalizeNewline(style)
var id = 'data-v-' + hash('vue-loader/test/fixtures/supports-query.vue')
expect(style).to.contain('@supports ( color: #000 ) {\n.foo[' + id + '] {\n color: #000;\n}\n}')
done()
})
})

it('extract CSS', done => {
bundle({
entry: './test/fixtures/extract-css.vue',

0 comments on commit 7253e32

Please sign in to comment.