Skip to content

Commit d2d2a62

Browse files
authored
Update ccb label/icon in updateState (#2164) (#2166)
* update label/icon every time * pr update * turn xcuitest back on
1 parent 7de9aaf commit d2d2a62

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

Demos/FluentUIDemo_iOS/FluentUIDemoTests/CommandBarTest.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class CommandBarTest: BaseTest {
2828

2929
// ensures that tapping on text style button rotates through text styles
3030
func testChangeTextStyleButton() throws {
31-
let textStyleButtonNumber: Int = 15
31+
let textStyleButtonNumber: Int = 16
3232
let textStyleButton: XCUIElement = app.buttons.element(boundBy: textStyleButtonNumber)
3333

3434
XCTAssert(app.buttons["Body"].exists)

Sources/FluentUI_iOS/Components/Command Bar/CommandBarButton.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ class CommandBarButton: UIButton {
4848
isAccessibilityElement = false
4949
} else {
5050
var buttonConfiguration = UIButton.Configuration.plain()
51-
buttonConfiguration.title = item.title
52-
buttonConfiguration.image = item.iconImage
5351
buttonConfiguration.imagePadding = CommandBarTokenSet.buttonImagePadding
5452
buttonConfiguration.contentInsets = CommandBarTokenSet.buttonContentInsets
5553
buttonConfiguration.background.cornerRadius = 0
@@ -89,6 +87,9 @@ class CommandBarButton: UIButton {
8987
return
9088
}
9189

90+
configuration?.title = item.title
91+
configuration?.image = item.iconImage
92+
9293
if let font = item.titleFont {
9394
let attributeContainer = AttributeContainer([NSAttributedString.Key.font: font])
9495
configuration?.attributedTitle?.setAttributes(attributeContainer)

0 commit comments

Comments
 (0)