1- var should = require ( "should" ) ;
2- var sinon = require ( "sinon" ) ;
3- var TemplatePluginEnvironment = require ( "./helpers/TemplatePluginEnvironment" ) ;
4- var ConcatSource = require ( "webpack-sources" ) . ConcatSource ;
5- var JsonpExportMainTemplatePlugin = require ( "../lib/JsonpExportMainTemplatePlugin" ) ;
6-
7- describe ( "JsonpExportMainTemplatePlugin" , function ( ) {
8- var env ;
9-
10- var applyTemplatePluginWithOptions = function ( Plugin , name ) {
11- var plugin = new Plugin ( name ) ;
12- var templatePluginEnvironment = new TemplatePluginEnvironment ( ) ;
13- var environment = templatePluginEnvironment . getEnvironmentStub ( ) ;
1+ "use strict" ;
2+
3+ const should = require ( "should" ) ;
4+ const sinon = require ( "sinon" ) ;
5+ const TemplatePluginEnvironment = require ( "./helpers/TemplatePluginEnvironment" ) ;
6+ const ConcatSource = require ( "webpack-sources" ) . ConcatSource ;
7+ const JsonpExportMainTemplatePlugin = require ( "../lib/JsonpExportMainTemplatePlugin" ) ;
8+
9+ describe ( "JsonpExportMainTemplatePlugin" , ( ) => {
10+ let env ;
11+
12+ const applyTemplatePluginWithOptions = function ( Plugin , name ) {
13+ const plugin = new Plugin ( name ) ;
14+ const templatePluginEnvironment = new TemplatePluginEnvironment ( ) ;
15+ const environment = templatePluginEnvironment . getEnvironmentStub ( ) ;
1416 environment . mainTemplate . applyPluginsWaterfall = ( ) => "templateName" ;
1517 plugin . apply ( environment ) ;
16- return templatePluginEnvironment
18+ return templatePluginEnvironment ;
1719 } ;
1820
19- beforeEach ( function ( ) {
20- env = { }
21- } ) ;
21+ beforeEach ( ( ) => env = { } ) ;
2222
23- it ( "has apply function" , function ( ) {
24- ( new JsonpExportMainTemplatePlugin ( ) ) . apply . should . be . a . Function ( ) ;
25- } ) ;
23+ it ( "has apply function" , ( ) => ( new JsonpExportMainTemplatePlugin ( ) ) . apply . should . be . a . Function ( ) ) ;
2624
27- describe ( "when applied" , function ( ) {
28- beforeEach ( function ( ) {
29- env . templatePlugin = applyTemplatePluginWithOptions ( JsonpExportMainTemplatePlugin , "foo" ) ;
30- } ) ;
25+ describe ( "when applied" , ( ) => {
26+ beforeEach ( ( ) =>
27+ env . templatePlugin = applyTemplatePluginWithOptions ( JsonpExportMainTemplatePlugin , "foo" ) ) ;
3128
32- describe ( "event handlers" , function ( ) {
33- beforeEach ( function ( ) {
34- env . eventBindings = env . templatePlugin . getEventBindings ( ) ;
35- } ) ;
29+ describe ( "event handlers" , ( ) => {
30+ beforeEach ( ( ) => env . eventBindings = env . templatePlugin . getEventBindings ( ) ) ;
3631
37- it ( "binds one handlers" , function ( ) {
38- env . eventBindings . length . should . be . exactly ( 1 ) ;
39- } ) ;
32+ it ( "binds one handlers" , ( ) => env . eventBindings . length . should . be . exactly ( 1 ) ) ;
4033
41- describe ( "render-with-entry handler" , function ( ) {
42- beforeEach ( function ( ) {
43- env . eventBinding = env . eventBindings [ 0 ] ;
44- } ) ;
34+ describe ( "render-with-entry handler" , ( ) => {
35+ beforeEach ( ( ) => env . eventBinding = env . eventBindings [ 0 ] ) ;
4536
46- it ( "binds to render-with-entry event" , function ( ) {
47- env . eventBinding . name . should . be . exactly ( "render-with-entry" ) ;
48- } ) ;
37+ it ( "binds to render-with-entry event" , ( ) =>
38+ env . eventBinding . name . should . be . exactly ( "render-with-entry" ) ) ;
4939
50- it ( "creates source wrapper calling JSONP global callback" , function ( ) {
51- var source = env . eventBinding . handler ( "moduleSource()" , env . chunk , "bar" ) ;
40+ it ( "creates source wrapper calling JSONP global callback" , ( ) => {
41+ const source = env . eventBinding . handler ( "moduleSource()" , env . chunk , "bar" ) ;
5242 source . should . be . instanceof ( ConcatSource ) ;
53- source . source ( ) . should . be . exactly ( ' templateName(moduleSource());' ) ;
43+ source . source ( ) . should . be . exactly ( " templateName(moduleSource());" ) ;
5444 } ) ;
5545 } ) ;
5646 } ) ;
5747
58- describe ( "main template event handlers" , function ( ) {
59- beforeEach ( function ( ) {
60- env . mainTemplateBindings = env . templatePlugin . getMainTemplateBindings ( ) ;
61- } ) ;
48+ describe ( "main template event handlers" , ( ) => {
49+ beforeEach ( ( ) => env . mainTemplateBindings = env . templatePlugin . getMainTemplateBindings ( ) ) ;
6250
63- it ( "binds two handlers" , function ( ) {
64- env . mainTemplateBindings . length . should . be . exactly ( 2 ) ;
65- } ) ;
51+ it ( "binds two handlers" , ( ) => env . mainTemplateBindings . length . should . be . exactly ( 2 ) ) ;
6652
67- describe ( "global-hash-paths handler" , function ( ) {
68- beforeEach ( function ( ) {
69- env . mainTemplateBinding = env . mainTemplateBindings [ 0 ] ;
70- } ) ;
53+ describe ( "global-hash-paths handler" , ( ) => {
54+ beforeEach ( ( ) => env . mainTemplateBinding = env . mainTemplateBindings [ 0 ] ) ;
7155
72- it ( "binds to global-hash-paths event" , function ( ) {
73- env . mainTemplateBinding . name . should . be . exactly ( "global-hash-paths" ) ;
74- } ) ;
56+ it ( "binds to global-hash-paths event" , ( ) => env . mainTemplateBinding . name . should . be . exactly ( "global-hash-paths" ) ) ;
7557
76- it ( "adds name to path array" , function ( ) {
77- env . mainTemplateBinding . handler ( [ ] ) . should . deepEqual ( [ "foo" ] ) ;
78- } ) ;
58+ it ( "adds name to path array" , ( ) => env . mainTemplateBinding . handler ( [ ] ) . should . deepEqual ( [ "foo" ] ) ) ;
7959 } ) ;
8060
81- describe ( "hash handler" , function ( ) {
82- beforeEach ( function ( ) {
83- env . mainTemplateBinding = env . mainTemplateBindings [ 1 ] ;
84- } ) ;
61+ describe ( "hash handler" , ( ) => {
62+ beforeEach ( ( ) => env . mainTemplateBinding = env . mainTemplateBindings [ 1 ] ) ;
8563
86- it ( "binds to hash event" , function ( ) {
87- env . mainTemplateBinding . name . should . be . exactly ( "hash" ) ;
88- } ) ;
64+ it ( "binds to hash event" , ( ) => env . mainTemplateBinding . name . should . be . exactly ( "hash" ) ) ;
8965
90- it ( "updates hash" , function ( ) {
91- var hash = {
66+ it ( "updates hash" , ( ) => {
67+ const hash = {
9268 update : sinon . spy ( )
9369 } ;
9470 env . mainTemplateBinding . handler ( hash ) ;
@@ -98,6 +74,6 @@ describe("JsonpExportMainTemplatePlugin", function() {
9874 hash . update . secondCall . args [ 0 ] . should . be . exactly ( "foo" ) ;
9975 } ) ;
10076 } ) ;
101- } )
77+ } ) ;
10278 } ) ;
10379} ) ;
0 commit comments