Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Unified Diff: ios/chrome/browser/ui/payments/cells/payments_selector_edit_item_unittests.mm

Issue 2879433002: [Payment Request] PaymentsSelectorEditItem (Closed)
Patch Set: Addressed comment Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/chrome/browser/ui/payments/cells/payments_selector_edit_item.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/ui/payments/cells/payments_selector_edit_item_unittests.mm
diff --git a/ios/chrome/browser/ui/payments/cells/payments_selector_edit_item_unittests.mm b/ios/chrome/browser/ui/payments/cells/payments_selector_edit_item_unittests.mm
new file mode 100644
index 0000000000000000000000000000000000000000..de11de45d9fdfe6e6b6ea4f2baed7da94aa24398
--- /dev/null
+++ b/ios/chrome/browser/ui/payments/cells/payments_selector_edit_item_unittests.mm
@@ -0,0 +1,44 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import "ios/chrome/browser/ui/payments/cells/payments_selector_edit_item.h"
+
+#import "ios/chrome/browser/ui/collection_view/cells/collection_view_detail_item.h"
+#import "ios/chrome/browser/ui/collection_view/cells/test_utils.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "testing/gtest_mac.h"
+
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
+namespace {
+
+// Tests that the UILabels are set properly after a call to |configureCell:|.
+TEST(PaymentRequestPaymentsSelectorEditItemTest, TextLabels) {
+ PaymentsSelectorEditItem* item = [[PaymentsSelectorEditItem alloc] init];
+ NSString* name = @"Name text";
+ NSString* value = @"Value text";
+
+ item.name = name;
+ item.value = value;
+
+ id cell = [[[item cellClass] alloc] init];
+ ASSERT_TRUE([cell isMemberOfClass:[CollectionViewDetailCell class]]);
+
+ CollectionViewDetailCell* detailCell = cell;
+ EXPECT_FALSE(detailCell.textLabel.text);
+ EXPECT_FALSE(detailCell.detailTextLabel.text);
+
+ [item configureCell:cell];
+ EXPECT_NSEQ(name, detailCell.textLabel.text);
+ EXPECT_NSEQ(value, detailCell.detailTextLabel.text);
+
+ item.required = YES;
+ NSString* requiredName = [NSString stringWithFormat:@"%@*", name];
+ [item configureCell:cell];
+ EXPECT_NSEQ(requiredName, detailCell.textLabel.text);
+}
+
+} // namespace
« no previous file with comments | « ios/chrome/browser/ui/payments/cells/payments_selector_edit_item.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698