Merge pull request #18 from jantimon/feature/plugin-integration-tests
Integration tests for extract-text-webpack-plugin
This commit is contained in:
commit
0b755ad75b
|
|
@ -23,9 +23,12 @@
|
|||
},
|
||||
"homepage": "https://github.com/ampedandwired/html-webpack-plugin",
|
||||
"devDependencies": {
|
||||
"css-loader": "^0.9.1",
|
||||
"extract-text-webpack-plugin": "^0.5.0",
|
||||
"jasmine-node": "^1.14.5",
|
||||
"jshint": "^2.5.2",
|
||||
"rimraf": "^2.2.8",
|
||||
"style-loader": "^0.9.0",
|
||||
"webpack": "^1.3.3-beta1"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
|
|||
|
|
@ -263,6 +263,86 @@ describe('HtmlWebpackPlugin', function() {
|
|||
}, ['<script src="index_bundle.js?%hash%"'], null, done);
|
||||
});
|
||||
|
||||
it('should work with the css extract plugin', function (done) {
|
||||
var ExtractTextPlugin = require("extract-text-webpack-plugin");
|
||||
testHtmlPlugin({
|
||||
entry: path.join(__dirname, 'fixtures/theme.js'),
|
||||
output: {
|
||||
path: OUTPUT_DIR,
|
||||
filename: 'index_bundle.js'
|
||||
},
|
||||
module: {
|
||||
loaders: [
|
||||
{ test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader') }
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new HtmlWebpackPlugin(),
|
||||
new ExtractTextPlugin("styles.css")
|
||||
]
|
||||
}, ['<link href="styles.css"'], null, done);
|
||||
});
|
||||
|
||||
it('should allow to add cache hashes to with the css assets', function (done) {
|
||||
var ExtractTextPlugin = require("extract-text-webpack-plugin");
|
||||
testHtmlPlugin({
|
||||
entry: path.join(__dirname, 'fixtures/theme.js'),
|
||||
output: {
|
||||
path: OUTPUT_DIR,
|
||||
filename: 'index_bundle.js'
|
||||
},
|
||||
module: {
|
||||
loaders: [
|
||||
{ test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader') }
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new HtmlWebpackPlugin({hash: true}),
|
||||
new ExtractTextPlugin("styles.css")
|
||||
]
|
||||
}, ['<link href="styles.css?%hash%"'], null, done);
|
||||
});
|
||||
|
||||
it('should inject css files when using the extract text plugin', function (done) {
|
||||
var ExtractTextPlugin = require("extract-text-webpack-plugin");
|
||||
testHtmlPlugin({
|
||||
entry: path.join(__dirname, 'fixtures/theme.js'),
|
||||
output: {
|
||||
path: OUTPUT_DIR,
|
||||
filename: 'index_bundle.js'
|
||||
},
|
||||
module: {
|
||||
loaders: [
|
||||
{ test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader') }
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new HtmlWebpackPlugin({inject: true}),
|
||||
new ExtractTextPlugin("styles.css")
|
||||
]
|
||||
}, ['<link href="styles.css"'], null, done);
|
||||
});
|
||||
|
||||
it('should allow to add cache hashes to with injected css assets', function (done) {
|
||||
var ExtractTextPlugin = require("extract-text-webpack-plugin");
|
||||
testHtmlPlugin({
|
||||
entry: path.join(__dirname, 'fixtures/theme.js'),
|
||||
output: {
|
||||
path: OUTPUT_DIR,
|
||||
filename: 'index_bundle.js'
|
||||
},
|
||||
module: {
|
||||
loaders: [
|
||||
{ test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader') }
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new HtmlWebpackPlugin({hash: true, inject: true}),
|
||||
new ExtractTextPlugin("styles.css")
|
||||
]
|
||||
}, ['<link href="styles.css?%hash%"'], null, done);
|
||||
});
|
||||
|
||||
it('prepends the webpack public path to script src', function(done) {
|
||||
testHtmlPlugin({
|
||||
entry: path.join(__dirname, 'fixtures/index.js'),
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
body {
|
||||
background: snow;
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
require('./main.css');
|
||||
require('./index.js');
|
||||
Loading…
Reference in New Issue