mirror of https://github.com/curbengh/hexo-yam
				
				
				
			test: option.enable
This commit is contained in:
		
							parent
							
								
									631503aa1a
								
							
						
					
					
						commit
						f7c600545b
					
				|  | @ -11,7 +11,7 @@ describe('html', () => { | ||||||
|   const Htmlminifier = require('html-minifier').minify |   const Htmlminifier = require('html-minifier').minify | ||||||
| 
 | 
 | ||||||
|   beforeEach(() => { |   beforeEach(() => { | ||||||
|     hexo.config.minify.html = htmlDefault |     hexo.config.minify.html = Object.assign({}, htmlDefault) | ||||||
|   }) |   }) | ||||||
| 
 | 
 | ||||||
|   test('default', () => { |   test('default', () => { | ||||||
|  | @ -22,6 +22,15 @@ describe('html', () => { | ||||||
|     expect(result).toBe(expected) |     expect(result).toBe(expected) | ||||||
|   }) |   }) | ||||||
| 
 | 
 | ||||||
|  |   test('disable', () => { | ||||||
|  |     hexo.config.minify.html.enable = false | ||||||
|  | 
 | ||||||
|  |     const input = '<p id="">foo</p>' | ||||||
|  |     const result = h(input, { path: '' }) | ||||||
|  | 
 | ||||||
|  |     expect(result).toBeUndefined() | ||||||
|  |   }) | ||||||
|  | 
 | ||||||
|   test('option', () => { |   test('option', () => { | ||||||
|     const customOpt = { removeEmptyAttributes: false } |     const customOpt = { removeEmptyAttributes: false } | ||||||
|     hexo.config.minify.html = customOpt |     hexo.config.minify.html = customOpt | ||||||
|  | @ -97,7 +106,7 @@ describe('css', () => { | ||||||
|   const CleanCSS = require('clean-css') |   const CleanCSS = require('clean-css') | ||||||
| 
 | 
 | ||||||
|   beforeEach(() => { |   beforeEach(() => { | ||||||
|     hexo.config.minify.css = cssDefault |     hexo.config.minify.css = Object.assign({}, cssDefault) | ||||||
|   }) |   }) | ||||||
| 
 | 
 | ||||||
|   test('default', async () => { |   test('default', async () => { | ||||||
|  | @ -107,6 +116,13 @@ describe('css', () => { | ||||||
|     expect(result).toBe(styles) |     expect(result).toBe(styles) | ||||||
|   }) |   }) | ||||||
| 
 | 
 | ||||||
|  |   test('disable', async () => { | ||||||
|  |     hexo.config.minify.css.enable = false | ||||||
|  |     const input = 'foo { bar: baz; } foo { aaa: bbb; }' | ||||||
|  |     const result = await c(input, { path: '' }) | ||||||
|  |     expect(result).toBeUndefined() | ||||||
|  |   }) | ||||||
|  | 
 | ||||||
|   test('option', async () => { |   test('option', async () => { | ||||||
|     const customOpt = { |     const customOpt = { | ||||||
|       level: { |       level: { | ||||||
|  | @ -152,7 +168,7 @@ describe('js', () => { | ||||||
|   const Terser = require('terser') |   const Terser = require('terser') | ||||||
| 
 | 
 | ||||||
|   beforeEach(() => { |   beforeEach(() => { | ||||||
|     hexo.config.minify.js = jsDefault |     hexo.config.minify.js = Object.assign({}, jsDefault) | ||||||
|   }) |   }) | ||||||
| 
 | 
 | ||||||
|   test('default', () => { |   test('default', () => { | ||||||
|  | @ -162,6 +178,15 @@ describe('js', () => { | ||||||
|     expect(result).toBe(code) |     expect(result).toBe(code) | ||||||
|   }) |   }) | ||||||
| 
 | 
 | ||||||
|  |   test('disable', () => { | ||||||
|  |     hexo.config.minify.js.enable = false | ||||||
|  | 
 | ||||||
|  |     const input = 'var o = { "foo": 1, bar: 3 };' | ||||||
|  |     const result = j(input, { path: '' }) | ||||||
|  | 
 | ||||||
|  |     expect(result).toBeUndefined() | ||||||
|  |   }) | ||||||
|  | 
 | ||||||
|   test('option', () => { |   test('option', () => { | ||||||
|     const customOpt = { |     const customOpt = { | ||||||
|       mangle: { |       mangle: { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue