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/payments/cells/shipping_address_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(ShippingAddressItemTest, TextLabels) { |
| 19 ShippingAddressItem* item = [[ShippingAddressItem alloc] initWithType:0]; |
| 20 |
| 21 NSString* name = @"Jon Doe"; |
| 22 NSString* address = @"123 Main St, Anytown, USA"; |
| 23 NSString* phoneNumber = @"1234567890"; |
| 24 |
| 25 item.name = name; |
| 26 item.address = address; |
| 27 item.phoneNumber = phoneNumber; |
| 28 |
| 29 id cell = [[[item cellClass] alloc] init]; |
| 30 ASSERT_TRUE([cell isMemberOfClass:[ShippingAddressCell class]]); |
| 31 |
| 32 ShippingAddressCell* shippingAddressCell = cell; |
| 33 EXPECT_FALSE(shippingAddressCell.nameLabel.text); |
| 34 EXPECT_FALSE(shippingAddressCell.addressLabel.text); |
| 35 EXPECT_FALSE(shippingAddressCell.phoneNumberLabel.text); |
| 36 |
| 37 [item configureCell:shippingAddressCell]; |
| 38 EXPECT_NSEQ(name, shippingAddressCell.nameLabel.text); |
| 39 EXPECT_NSEQ(address, shippingAddressCell.addressLabel.text); |
| 40 EXPECT_NSEQ(phoneNumber, shippingAddressCell.phoneNumberLabel.text); |
| 41 } |
| 42 |
| 43 } // namespace |
OLD | NEW |