Skip to content

Commit

Permalink
[ButtonBar] Update tests to reflect that titleTextAttributes appearan…
Browse files Browse the repository at this point in the history
…ce only works on iOS 9.

Summary: Part of https://github.com/google/material-components-ios/issues/370.

Reviewers: #mdc_ios_owners, junius, iangordon

Reviewed By: #mdc_ios_owners, junius, iangordon

Subscribers: iangordon

Projects: #material_components_ios

Differential Revision: http://codereview.cc/D685
  • Loading branch information
jverkoey committed Apr 20, 2016
1 parent 35206a4 commit 916866a
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion components/ButtonBar/tests/unit/ButtonBarIssue370Tests.swift
Expand Up @@ -18,7 +18,7 @@ import XCTest
import MaterialComponents

// Tests confirming that the Button Bar respects UI appearance for bar button item
// titleTextAttributes.
// titleTextAttributes on iOS 9 and above.
//
// Based on issue https://github.com/google/material-components-ios/issues/370
class ButtonBarIssue370Tests: XCTestCase {
Expand Down Expand Up @@ -49,6 +49,12 @@ class ButtonBarIssue370Tests: XCTestCase {

func testGlobalAppearanceOnly() {
UIBarButtonItem.appearance().setTitleTextAttributes(globalAttributes, forState: .Normal)

if UIBarButtonItem.appearance().titleTextAttributesForState(.Normal) == nil {
// This feature is not supported on this OS
return
}

let item = UIBarButtonItem(title: "Text", style: .Plain, target: nil, action: nil)
buttonBar.items = [item]

Expand Down Expand Up @@ -76,6 +82,12 @@ class ButtonBarIssue370Tests: XCTestCase {

func testGlobalAppearanceAndDirectMerging() {
UIBarButtonItem.appearance().setTitleTextAttributes(fontAttributes, forState: .Normal)

if UIBarButtonItem.appearance().titleTextAttributesForState(.Normal) == nil {
// This feature is not supported on this OS
return
}

let item = UIBarButtonItem(title: "Text", style: .Plain, target: nil, action: nil)
item.setTitleTextAttributes(directAttributes, forState: .Normal)
buttonBar.items = [item]
Expand Down

0 comments on commit 916866a

Please sign in to comment.