Skip to content

Commit 216f3a1

Browse files
author
Diabeu
committedAug 23, 2017
test: use input instead of entry because of new rollup
1 parent 5c93d08 commit 216f3a1

File tree

1 file changed

+31
-6
lines changed

1 file changed

+31
-6
lines changed
 

‎test/mochajs/component.spec.js

+31-6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ const expect = require('chai').expect;
44
const angular = require('../../dist/rollup-plugin-angular.js');
55
const external = Object.keys(require('./../../package.json').dependencies).concat(['fs', 'path']);
66
const colors = require('colors');
7+
const sass = require('node-sass');
8+
const cleanCSS = require('clean-css');
9+
const htmlMinifier = require('html-minifier');
10+
const cssmin = new cleanCSS();
11+
const htmlminOpts = {
12+
caseSensitive: true,
13+
collapseWhitespace: true,
14+
removeComments: true
15+
};
716

817
process.chdir('test');
918

@@ -13,15 +22,20 @@ describe('rollup-plugin-angular', () => {
1322
console.info(`-------------------`);
1423
it('should not have component.html file content loaded from comment', () => {
1524
return rollup({
16-
entry: 'mochajs/component.js',
25+
input: 'mochajs/component.js',
1726
external: external,
1827
plugins: [
19-
angular()
28+
angular({
29+
replace: false
30+
})
2031
]
2132
})
2233
.then(bundle => {
2334
return bundle
24-
.generate({ format: 'iife', moduleName: 'component' })
35+
.generate({
36+
format: 'umd',
37+
name: 'component'
38+
})
2539
.then(generated => {
2640
expect(generated.code.includes(`component.html content loaded`)).to.equal(false);
2741
assert.ok(generated.code);
@@ -31,15 +45,26 @@ describe('rollup-plugin-angular', () => {
3145

3246
it('should have example-component.html file content loaded', () => {
3347
return rollup({
34-
entry: 'mochajs/example-component.js',
48+
input: 'mochajs/example-component.js',
3549
external: external,
3650
plugins: [
37-
angular()
51+
angular({
52+
preprocessors: {
53+
template: template => htmlMinifier.minify(template, htmlminOpts),
54+
style: scss => {
55+
const css = sass.renderSync({ data: scss }).css;
56+
return cssmin.minify(css).styles;
57+
},
58+
}
59+
})
3860
]
3961
})
4062
.then(bundle => {
4163
return bundle
42-
.generate({ format: 'umd', moduleName: 'component' })
64+
.generate({
65+
format: 'umd',
66+
name: 'component'
67+
})
4368
.then(generated => {
4469
expect(generated.code.includes(`blaah`)).to.equal(true);
4570
assert.ok(generated.code);

0 commit comments

Comments
 (0)
Please sign in to comment.