@@ -261,6 +261,7 @@ describe('Notification', function () {
261261 } ) ;
262262 } ) ;
263263 } ) ;
264+
264265 describe ( 'titleLocKey' , function ( ) {
265266 it ( 'sets the aps.alert.title-loc-key property' , function ( ) {
266267 note . titleLocKey = 'Warning' ;
@@ -363,6 +364,108 @@ describe('Notification', function () {
363364 } ) ;
364365 } ) ;
365366
367+ describe ( 'subtitleLocKey' , function ( ) {
368+ it ( 'sets the aps.alert.subtitle-loc-key property' , function ( ) {
369+ note . subtitleLocKey = 'Warning' ;
370+ expect ( compiledOutput ( ) ) . to . have . nested . deep . property ( 'aps.alert.subtitle-loc-key' , 'Warning' ) ;
371+ } ) ;
372+
373+ context ( 'alert is already an object' , function ( ) {
374+ beforeEach ( function ( ) {
375+ note . alert = { body : 'Test' , 'launch-image' : 'test.png' } ;
376+ note . subtitleLocKey = 'Warning' ;
377+ } ) ;
378+
379+ it ( 'contains all expected properties' , function ( ) {
380+ expect ( compiledOutput ( ) ) . to . have . nested . deep . property ( 'aps.alert' ) . that . deep . equals ( {
381+ body : 'Test' ,
382+ 'launch-image' : 'test.png' ,
383+ 'subtitle-loc-key' : 'Warning' ,
384+ } ) ;
385+ } ) ;
386+ } ) ;
387+
388+ context ( 'alert is already a string' , function ( ) {
389+ beforeEach ( function ( ) {
390+ note . alert = 'Hello, world' ;
391+ note . subtitleLocKey = 'Warning' ;
392+ } ) ;
393+
394+ it ( 'retains the alert body correctly' , function ( ) {
395+ expect ( compiledOutput ( ) ) . to . have . nested . deep . property ( 'aps.alert.body' , 'Hello, world' ) ;
396+ } ) ;
397+
398+ it ( 'sets the aps.alert.subtitle-loc-key property' , function ( ) {
399+ expect ( compiledOutput ( ) ) . to . have . nested . deep . property (
400+ 'aps.alert.subtitle-loc-key' ,
401+ 'Warning'
402+ ) ;
403+ } ) ;
404+ } ) ;
405+
406+ describe ( 'setAlert' , function ( ) {
407+ it ( 'is chainable' , function ( ) {
408+ expect ( note . setSubtitleLocKey ( 'greeting' ) ) . to . equal ( note ) ;
409+ expect ( compiledOutput ( ) ) . to . have . nested . deep . property (
410+ 'aps.alert.subtitle-loc-key' ,
411+ 'greeting'
412+ ) ;
413+ } ) ;
414+ } ) ;
415+ } ) ;
416+
417+ describe ( 'subtitleLocArgs' , function ( ) {
418+ it ( 'sets the aps.alert.subtitle-loc-args property' , function ( ) {
419+ note . subtitleLocArgs = [ 'arg1' , 'arg2' ] ;
420+ expect ( compiledOutput ( ) )
421+ . to . have . nested . deep . property ( 'aps.alert.subtitle-loc-args' )
422+ . that . deep . equals ( [ 'arg1' , 'arg2' ] ) ;
423+ } ) ;
424+
425+ context ( 'alert is already an object' , function ( ) {
426+ beforeEach ( function ( ) {
427+ note . alert = { body : 'Test' , 'launch-image' : 'test.png' } ;
428+ note . subtitleLocArgs = [ 'Hi there' ] ;
429+ } ) ;
430+
431+ it ( 'contains all expected properties' , function ( ) {
432+ expect ( compiledOutput ( ) )
433+ . to . have . nested . deep . property ( 'aps.alert' )
434+ . that . deep . equals ( {
435+ body : 'Test' ,
436+ 'launch-image' : 'test.png' ,
437+ 'subtitle-loc-args' : [ 'Hi there' ] ,
438+ } ) ;
439+ } ) ;
440+ } ) ;
441+
442+ context ( 'alert is already a string' , function ( ) {
443+ beforeEach ( function ( ) {
444+ note . alert = 'Hello, world' ;
445+ note . subtitleLocArgs = [ 'Hi there' ] ;
446+ } ) ;
447+
448+ it ( 'retains the alert body' , function ( ) {
449+ expect ( compiledOutput ( ) ) . to . have . nested . deep . property ( 'aps.alert.body' , 'Hello, world' ) ;
450+ } ) ;
451+
452+ it ( 'sets the aps.alert.subtitle-loc-args property' , function ( ) {
453+ expect ( compiledOutput ( ) )
454+ . to . have . nested . deep . property ( 'aps.alert.subtitle-loc-args' )
455+ . that . deep . equals ( [ 'Hi there' ] ) ;
456+ } ) ;
457+ } ) ;
458+
459+ describe ( 'setTitleLocArgs' , function ( ) {
460+ it ( 'is chainable' , function ( ) {
461+ expect ( note . setTitleLocArgs ( [ 'iPhone 6s' ] ) ) . to . equal ( note ) ;
462+ expect ( compiledOutput ( ) )
463+ . to . have . nested . deep . property ( 'aps.alert.title-loc-args' )
464+ . that . deep . equals ( [ 'iPhone 6s' ] ) ;
465+ } ) ;
466+ } ) ;
467+ } ) ;
468+
366469 describe ( 'action' , function ( ) {
367470 it ( 'sets the aps.alert.action property' , function ( ) {
368471 note . action = 'View' ;
0 commit comments