Skip to content
This repository has been archived by the owner on Dec 26, 2018. It is now read-only.

Commit

Permalink
Test extract css (#101)
Browse files Browse the repository at this point in the history
* hash not used

* Test css extract.
  • Loading branch information
zigomir authored and yyx990803 committed Jun 23, 2016
1 parent d391b9f commit 1b05390
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
5 changes: 4 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"root": true,
"extends": "vue"
"extends": "vue",
"env": {
"mocha": true
}
}
3 changes: 3 additions & 0 deletions test/fixtures/style-export.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<style>
h2 {color: red;}
</style>
17 changes: 16 additions & 1 deletion test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ process.env.VUEIFY_TEST = true
const fs = require('fs')
const path = require('path')
const expect = require('chai').expect
const hash = require('hash-sum')
const rimraf = require('rimraf')
const mkdirp = require('mkdirp')
const browserify = require('browserify')
Expand Down Expand Up @@ -37,6 +36,18 @@ function test (file, assert) {
})
}

function testCssExtract (file, assert) {
it(file, done => {
fs.writeFileSync(mockEntry, 'window.vueModule = require("../fixtures/' + file + '.vue")')
browserify(mockEntry)
.transform(vueify)
.plugin('./plugins/extract-css', { out: { write: assert, end: done }})
.bundle((err, buf) => {
if (err) return done(err)
})
})
}

function assertRenderFn (options, template) {
const compiled = vueCompiler.compile(template)
expect(options.render.toString()).to.equal('function (){' + compiled.render + '}')
Expand Down Expand Up @@ -122,4 +133,8 @@ describe('vueify', () => {
var id = 'data-v-' + genId(require.resolve('./fixtures/media-query.vue'))
expect(style).to.contain('@media print {\n .foo[' + id + '] {\n color: #000;\n }\n}')
})

testCssExtract('style-export', css => {
expect(css).to.equal('h2 {color: red;}')
})
})

0 comments on commit 1b05390

Please sign in to comment.