@@ -322,39 +322,70 @@ describe("LibraryTemplatePlugin", function() {
322322 describe ( "name is an object of names per target" , function ( ) {
323323 [ {
324324 type : "umd" ,
325+ namedDefine : true ,
325326 assertion : function ( compilationContext ) {
326327 compilationContext . name . should . be . exactly ( "barRoot" ) ;
327328 compilationContext . names . should . deepEqual ( {
328329 root : "barRoot" ,
329330 amd : "bar-amd"
330331 } ) ;
331332 compilationContext . optionalAmdExternalAsGlobal . should . be . false ( ) ;
332- compilationContext . namedDefine . should . be . exactly ( "bar" ) ;
333+ compilationContext . namedDefine . should . be . exactly ( true ) ;
334+ compilationContext . auxiliaryComment . should . be . exactly ( "baz" ) ;
335+ }
336+ } ,
337+ {
338+ type : "umd" ,
339+ namedDefine : false ,
340+ assertion : function ( compilationContext ) {
341+ compilationContext . name . should . be . exactly ( "barRoot" ) ;
342+ compilationContext . names . should . deepEqual ( {
343+ root : "barRoot" ,
344+ amd : "bar-amd"
345+ } ) ;
346+ compilationContext . optionalAmdExternalAsGlobal . should . be . false ( ) ;
347+ compilationContext . namedDefine . should . be . exactly ( false ) ;
333348 compilationContext . auxiliaryComment . should . be . exactly ( "baz" ) ;
334349 }
335350 } ,
336351 {
337352 type : "umd2" ,
353+ namedDefine : true ,
338354 assertion : function ( compilationContext ) {
339355 compilationContext . name . should . be . exactly ( "barRoot" ) ;
340356 compilationContext . names . should . deepEqual ( {
341357 root : "barRoot" ,
342358 amd : "bar-amd"
343359 } ) ;
344360 compilationContext . optionalAmdExternalAsGlobal . should . be . true ( ) ;
345- compilationContext . namedDefine . should . be . exactly ( "bar" ) ;
361+ compilationContext . namedDefine . should . be . exactly ( true ) ;
362+ compilationContext . auxiliaryComment . should . be . exactly ( "baz" ) ;
363+ }
364+ } ,
365+ {
366+ type : "umd2" ,
367+ namedDefine : false ,
368+ assertion : function ( compilationContext ) {
369+ compilationContext . name . should . be . exactly ( "barRoot" ) ;
370+ compilationContext . names . should . deepEqual ( {
371+ root : "barRoot" ,
372+ amd : "bar-amd"
373+ } ) ;
374+ compilationContext . optionalAmdExternalAsGlobal . should . be . true ( ) ;
375+ compilationContext . namedDefine . should . be . exactly ( false ) ;
346376 compilationContext . auxiliaryComment . should . be . exactly ( "baz" ) ;
347377 }
348378 }
349379 ] . forEach ( function ( targetTypeAndAssertion ) {
350380 var type = targetTypeAndAssertion . type ;
381+ var namedDefine = targetTypeAndAssertion . namedDefine ;
351382
352383 describe ( "when target is " + type , function ( ) {
353384 beforeEach ( function ( ) {
354385 env . eventBindings = applyPluginWithOptions ( LibraryTemplatePlugin , {
355386 root : "barRoot" ,
356387 amd : "bar-amd"
357- } , type , "bar" , "baz" ) ;
388+ } , type , namedDefine , "baz" ) ;
358389 env . eventBinding = env . eventBindings [ 0 ] ;
359390 env . eventBinding . handler ( env . compilation ) ;
360391 } ) ;
0 commit comments