OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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/payments/cells/autofill_profile_item.h" |
| 6 |
| 7 #import "ios/chrome/browser/ui/collection_view/cells/test_utils.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 namespace { |
| 16 |
| 17 // Tests that the labels are set properly after a call to |configureCell:|. |
| 18 TEST(AutofillProfileItemTest, TextLabels) { |
| 19 AutofillProfileItem* item = [[AutofillProfileItem alloc] initWithType:0]; |
| 20 |
| 21 NSString* name = @"Jon Doe"; |
| 22 NSString* address = @"123 Main St, Anytown, USA"; |
| 23 NSString* phoneNumber = @"1234567890"; |
| 24 NSString* email = @"123-456-7890"; |
| 25 NSString* notification = @"More information is required"; |
| 26 |
| 27 item.name = name; |
| 28 item.address = address; |
| 29 item.phoneNumber = phoneNumber; |
| 30 item.email = email; |
| 31 item.notification = notification; |
| 32 |
| 33 id cell = [[[item cellClass] alloc] init]; |
| 34 ASSERT_TRUE([cell isMemberOfClass:[AutofillProfileCell class]]); |
| 35 |
| 36 AutofillProfileCell* autofillProfileCell = cell; |
| 37 EXPECT_FALSE(autofillProfileCell.nameLabel.text); |
| 38 EXPECT_FALSE(autofillProfileCell.addressLabel.text); |
| 39 EXPECT_FALSE(autofillProfileCell.phoneNumberLabel.text); |
| 40 EXPECT_FALSE(autofillProfileCell.emailLabel.text); |
| 41 EXPECT_FALSE(autofillProfileCell.notificationLabel.text); |
| 42 |
| 43 [item configureCell:autofillProfileCell]; |
| 44 EXPECT_NSEQ(name, autofillProfileCell.nameLabel.text); |
| 45 EXPECT_NSEQ(address, autofillProfileCell.addressLabel.text); |
| 46 EXPECT_NSEQ(phoneNumber, autofillProfileCell.phoneNumberLabel.text); |
| 47 EXPECT_NSEQ(email, autofillProfileCell.emailLabel.text); |
| 48 EXPECT_NSEQ(notification, autofillProfileCell.notificationLabel.text); |
| 49 } |
| 50 |
| 51 } // namespace |
OLD | NEW |