Commit 7c37a716 authored by Evan You's avatar Evan You

test: duplicate css modules test

parent 230abd48
......@@ -113,13 +113,18 @@ test('should not duplicate css modules value imports', done => {
]
}
}
}, ({ window, module, code }) => {
}, ({ window, exports, code }) => {
const localsRE = /exports.locals = {\s+"color": "red"\s+};/
const matches = code.match(localsRE)
expect(matches.length).toBe(1)
const styles = window.getComputedStyle(window.document.querySelector('h1'))
console.log(styles)
const styles = window.document.querySelectorAll('style')
expect(styles.length).toBe(2) // one for values, one for the component
const style = normalizeNewline(styles[1].textContent)
// value should be injected
expect(style).toMatch('color: red;')
// exports is set as the locals imported from values.css
expect(exports.color).toBe('red')
done()
})
})
import values from './duplicate-cssm.css'
import Comp from './duplicate-cssm.vue'
export { values }
export default Comp
window.exports = values
<template>
<h1 :class="$style.red">hi</h1>
</template>
<style module>
@value color from './duplicate-cssm.css';
.red {
color: color;
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment