@@ -475,26 +475,25 @@ - (void)testCustomBadgeColorsOverrideDefaultBadgeAppearanceWhenSetBeforeBarItems
475
475
[self generateAndVerifySnapshot ];
476
476
}
477
477
478
- - (void )testClearBadgeColorsRendersClearBackgroundAndUILabelDefaultTextColor {
478
+ - (void )testClearBadgeColorRendersClearBackgroundAndDefaultFont {
479
479
// Given
480
480
self.tabItem1 .badgeValue = @" " ;
481
481
self.tabItem2 .badgeValue = @" Black on Clear" ;
482
- self.tabItem3 .badgeValue = @" Black on Green" ;
483
482
self.navigationBar .frame = CGRectMake (0 , 0 , MDCBottomNavigationBarTestWidthiPad,
484
483
MDCBottomNavigationBarTestHeightTypical);
485
484
486
485
// When
487
- MDCBadgeAppearance *greenAppearance = [[MDCBadgeAppearance alloc ] init ];
488
- greenAppearance .font = [UIFont systemFontOfSize: 8.0 ] ;
489
- greenAppearance .backgroundColor = UIColor.greenColor ;
490
- greenAppearance .textColor = UIColor.blackColor ;
486
+ MDCBadgeAppearance *normalAppearance = [[MDCBadgeAppearance alloc ] init ];
487
+ normalAppearance .font = nil ;
488
+ normalAppearance .backgroundColor = UIColor.clearColor ;
489
+ normalAppearance .textColor = UIColor.blackColor ;
491
490
MDCBottomNavigationBarItem *barItem1 =
492
491
[[MDCBottomNavigationBarItem alloc ] initWithBarItem: self .tabItem1];
493
492
MDCBottomNavigationBarItem *barItem2 =
494
- [[MDCBottomNavigationBarItem alloc ] initWithBarItem: self .tabItem2];
493
+ [[MDCBottomNavigationBarItem alloc ] initWithBarItem: self .tabItem2
494
+ badgeAppearance: normalAppearance];
495
495
MDCBottomNavigationBarItem *barItem3 =
496
- [[MDCBottomNavigationBarItem alloc ] initWithBarItem: self .tabItem3
497
- badgeAppearance: greenAppearance];
496
+ [[MDCBottomNavigationBarItem alloc ] initWithBarItem: self .tabItem3];
498
497
MDCBottomNavigationBarItem *barItem4 =
499
498
[[MDCBottomNavigationBarItem alloc ] initWithBarItem: self .tabItem4];
500
499
MDCBottomNavigationBarItem *barItem5 =
@@ -510,10 +509,10 @@ - (void)testClearBadgeColorsRendersClearBackgroundAndUILabelDefaultTextColor {
510
509
[self generateAndVerifySnapshot ];
511
510
}
512
511
513
- - (void )testNilBadgeColorsRendersTintBackgroundAndUILabelDefaultTextColor {
512
+ - (void )testNilBadgeColorsRendersTintBackgroundAndNavigationBarDefaultTextColor {
514
513
// Given
515
514
self.tabItem1 .badgeValue = @" " ;
516
- self.tabItem2 .badgeValue = @" Black on Tint Color" ;
515
+ self.tabItem2 .badgeValue = @" White on Tint Color" ;
517
516
self.tabItem3 .badgeValue = @" Black on Green" ;
518
517
self.navigationBar .frame = CGRectMake (0 , 0 , MDCBottomNavigationBarTestWidthiPad,
519
518
MDCBottomNavigationBarTestHeightTypical);
@@ -545,6 +544,24 @@ - (void)testNilBadgeColorsRendersTintBackgroundAndUILabelDefaultTextColor {
545
544
[self generateAndVerifySnapshot ];
546
545
}
547
546
547
+ - (void )testDefaultBadgeTextFont {
548
+ // Given
549
+ self.tabItem1 .badgeValue = @" " ;
550
+ self.tabItem2 .badgeValue = @" 10" ;
551
+ self.navigationBar .frame = CGRectMake (0 , 0 , MDCBottomNavigationBarTestWidthTypical,
552
+ MDCBottomNavigationBarTestHeightTypical);
553
+
554
+ // When
555
+ MDCBadgeAppearance *badgeAppearance = [[MDCBadgeAppearance alloc ] init ];
556
+ badgeAppearance.font = nil ;
557
+ self.navigationBar .itemBadgeAppearance = badgeAppearance;
558
+ self.navigationBar .items =
559
+ @[ self .tabItem1, self .tabItem2, self .tabItem3, self .tabItem4, self .tabItem5 ];
560
+
561
+ // Then
562
+ [self generateAndVerifySnapshot ];
563
+ }
564
+
548
565
- (void )testCustomBadgeTextFontSetBeforeItems {
549
566
// Given
550
567
self.tabItem1 .badgeValue = @" " ;
@@ -563,7 +580,7 @@ - (void)testCustomBadgeTextFontSetBeforeItems {
563
580
[self generateAndVerifySnapshot ];
564
581
}
565
582
566
- - (void )testCustomBadgeTextFontSetAfterItems {
583
+ - (void )testCustomBadgeTextFontSetAfterItemsUsesDefaultBadgeColor {
567
584
// Given
568
585
self.tabItem1 .badgeValue = @" " ;
569
586
self.tabItem2 .badgeValue = @" 10" ;
0 commit comments