OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #import "ios/chrome/browser/ui/settings/cells/autofill_data_item.h" |
| 6 |
| 7 #import "ios/third_party/material_components_ios/src/components/CollectionCells/
src/MaterialCollectionCells.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "testing/gtest_mac.h" |
| 10 |
| 11 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 12 #error "This file requires ARC support." |
| 13 #endif |
| 14 |
| 15 // Tests that the UILabels are set properly after a call to |configureCell:|. |
| 16 TEST(AutofillDataItemTest, TextLabels) { |
| 17 AutofillDataItem* item = [[AutofillDataItem alloc] initWithType:0]; |
| 18 NSString* mainText = @"Main text"; |
| 19 NSString* leadingDetailText = @"Leading detail text"; |
| 20 NSString* trailingDetailText = @"Trailing detail text"; |
| 21 |
| 22 item.text = mainText; |
| 23 item.leadingDetailText = leadingDetailText; |
| 24 item.trailingDetailText = trailingDetailText; |
| 25 item.accessoryType = MDCCollectionViewCellAccessoryCheckmark; |
| 26 |
| 27 id cell = [[[item cellClass] alloc] init]; |
| 28 ASSERT_TRUE([cell isMemberOfClass:[AutofillDataCell class]]); |
| 29 |
| 30 AutofillDataCell* autofillDataCell = cell; |
| 31 EXPECT_FALSE(autofillDataCell.textLabel.text); |
| 32 EXPECT_FALSE(autofillDataCell.leadingDetailTextLabel.text); |
| 33 EXPECT_FALSE(autofillDataCell.trailingDetailTextLabel.text); |
| 34 EXPECT_EQ(MDCCollectionViewCellAccessoryNone, autofillDataCell.accessoryType); |
| 35 |
| 36 [item configureCell:cell]; |
| 37 EXPECT_NSEQ(mainText, autofillDataCell.textLabel.text); |
| 38 EXPECT_NSEQ(leadingDetailText, autofillDataCell.leadingDetailTextLabel.text); |
| 39 EXPECT_NSEQ(trailingDetailText, |
| 40 autofillDataCell.trailingDetailTextLabel.text); |
| 41 EXPECT_EQ(MDCCollectionViewCellAccessoryCheckmark, |
| 42 autofillDataCell.accessoryType); |
| 43 } |
OLD | NEW |